Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: many new android features #5774

Open
wants to merge 126 commits into
base: main
Choose a base branch
from

Conversation

farfromrefug
Copy link
Contributor

@farfromrefug farfromrefug commented Dec 24, 2023

Thought it was time to make that big PR. It is quite impossible now to divide everything as each part depends on the other.
I really hope we can make that work for everyone to enjoy the new features.
I ll try to list them all. Dont hesitate if you have questions

TODO

There is one thing i would like to improve which is this. I commented on the reason why we need that.
Though i am sure we might find a better solution. The issue with the way i did it if that if new task are added (either tools update of maybe through plugin) that list will need to be update which is ugly. I already had to add tasks added by the sentry plugin...
Maybe @triniwiz you know a way to do it better. I know the reason is that by reading the buildMetada task (or the tasks it depends on like those handling jars) gradle thinks buildMetadata uses as an input the output of all those tasks. TBH i dont really understand fully the code of the buildMetadata task ...

farfromrefug and others added 30 commits May 7, 2021 17:05
Along with that we simply need to have a cli parameter and an option in nativescript.config
# Conflicts:
#	lib/services/plugins-service.ts
fix: require.resolve for packages with exports field in package.json
can still be enabled with `generateBuildConfig` and `generateR`
# Conflicts:
#	lib/services/log-source-map-service.ts
#	lib/services/metadata-filtering-service.ts
#	lib/services/test-execution-service.ts
#	vendor/gradle-plugin/build.gradle
# Conflicts:
#	lib/services/android-plugin-build-service.ts
#	vendor/gradle-plugin/build.gradle
@farfromrefug
Copy link
Contributor Author

@rigor789 any chance to boost this one so that it gets merged?
Maybe an alpha version so that the team can test with their projects?
I have contributors forced to use my fork because we need this

@edusperoni i think you did some work around gradle? I still have to fix the why i need this https://github.com/farfromrefug/nativescript-cli/blob/new_big_merge_test/vendor/gradle-app/app/build.gradle#L986. There is something wrong with our buildMetadata task which makes all tasks depends on it

Copy link
Member

@rigor789 rigor789 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very large changeset - I tried to look through and note things that jumped out.

The tests are also failing:

Test results
1428 passing (23s)
  35 failing

  1) update controller method tests
       handles exact versions:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  2) update controller method tests
       handles range versions:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  3) update controller method tests
       handles range versions:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  4) update controller method tests
       handles latest tag versions:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  5) update controller method tests
       handles existing tag versions:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  6) update controller method tests
       handles non-existing tag versions:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  7) update controller method tests
       handles partially existing tag versions:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  8) update controller method tests
       handles no version - falls back to latest:
     TypeError: this.$projectDataService.getProjectData(...).getBuildRelativeDirectoryPath is not a function
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:299:46)
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/controllers/update-controller.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (lib/controllers/update-controller.js:4:12)
      at UpdateController.cleanUpProject (lib/controllers/update-controller.js:154:16)
      at UpdateController.<anonymous> (lib/controllers/update-controller.ts:112:14)
      at Generator.next (<anonymous>)
      at fulfilled (lib/controllers/update-controller.js:5:58)

  9) Plugins service
       plugin add
         fails when the plugin does not support the installed framework:
     Error: unable to resolve liveSyncProcessDataService
      at Yok.resolveDependency (lib/common/yok.ts:521:10)
      at Yok.resolveByName (lib/common/yok.ts:488:22)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/common/yok.ts:460:17
      at Array.map (<anonymous>)
      at Yok.resolveConstructor (lib/common/yok.ts:456:42)
      at Yok.resolveByName (lib/common/yok.ts:505:21)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/common/yok.ts:460:17
      at Array.map (<anonymous>)
      at Yok.resolveConstructor (lib/common/yok.ts:456:42)
      at Yok.resolveByName (lib/common/yok.ts:505:21)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/plugins-service.ts:427:47
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/plugins-service.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (test/plugins-service.js:4:12)
      at Context.<anonymous> (test/plugins-service.ts:377:84)
      at processImmediate (node:internal/timers:478:21)

  10) Plugins service
       plugin install
         fails when the plugin does not support the installed framework:
     Error: unable to resolve liveSyncProcessDataService
      at Yok.resolveDependency (lib/common/yok.ts:521:10)
      at Yok.resolveByName (lib/common/yok.ts:488:22)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/common/yok.ts:460:17
      at Array.map (<anonymous>)
      at Yok.resolveConstructor (lib/common/yok.ts:456:42)
      at Yok.resolveByName (lib/common/yok.ts:505:21)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/common/yok.ts:460:17
      at Array.map (<anonymous>)
      at Yok.resolveConstructor (lib/common/yok.ts:456:42)
      at Yok.resolveByName (lib/common/yok.ts:505:21)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/plugins-service.ts:427:47
      at Generator.next (<anonymous>)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/plugins-service.js:8:71
      at new Promise (<anonymous>)
      at __awaiter (test/plugins-service.js:4:12)
      at Context.<anonymous> (test/plugins-service.ts:377:84)
      at processImmediate (node:internal/timers:478:21)

  11) androidPluginBuildService
       buildAar
         builds aar when all supported files are in the plugin:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  12) androidPluginBuildService
       buildAar
         builds aar when there are res and assets folders:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  13) androidPluginBuildService
       buildAar
         builds aar when there is an android manifest:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  14) androidPluginBuildService
       buildAar
         builds aar when plugin is already build and source files have changed since last buid:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  15) androidPluginBuildService
       buildAar
         builds aar with the latest runtime gradle versions when no project dir is specified:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  16) androidPluginBuildService
       buildAar
         builds aar with the latest runtime gradle versions when a project dir without runtime versions is specified:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  17) androidPluginBuildService
       buildAar
         builds aar with the specified runtime gradle versions when the project runtime has gradle versions:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  18) androidPluginBuildService
       buildAar
         builds aar with the hardcoded gradle versions when the project runtime and the latest runtime do not have versions specified:
     TypeError: Cannot read properties of undefined (reading 'android')
      at AndroidPluginBuildService.<anonymous> (lib/services/android-plugin-build-service.ts:394:34)
      at Generator.next (<anonymous>)
      at fulfilled (lib/services/android-plugin-build-service.js:11:58)

  19) androidProjectService
       "before each" hook for "release no bundle":
     Error: unable to resolve liveSyncProcessDataService
      at Yok.resolveDependency (lib/common/yok.ts:521:10)
      at Yok.resolveByName (lib/common/yok.ts:488:22)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at /Users/rigor789/Code/NativeScript/nativescript-cli/lib/common/yok.ts:460:17
      at Array.map (<anonymous>)
      at Yok.resolveConstructor (lib/common/yok.ts:456:42)
      at Yok.resolveByName (lib/common/yok.ts:505:21)
      at Yok.resolve (lib/common/yok.ts:416:16)
      at Context.<anonymous> (test/services/android-project-service.ts:88:36)
      at processImmediate (node:internal/timers:478:21)

  20) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for debug build with info log:

      AssertionError: expected [ 'assembleDebug', '--quiet', …(12) ] to deeply equal [ 'assembleDebug', '--quiet', …(9) ]
      + expected - actual

       [
         "assembleDebug"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  21) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for debug build with trace log:

      AssertionError: expected [ 'assembleDebug', …(14) ] to deeply equal [ 'assembleDebug', …(11) ]
      + expected - actual

       [
         "assembleDebug"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  22) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for release build with info log:

      AssertionError: expected [ 'assembleRelease', '--quiet', …(17) ] to deeply equal [ 'assembleRelease', '--quiet', …(14) ]
      + expected - actual

       [
         "assembleRelease"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  23) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for release build with trace log:

      AssertionError: expected [ 'assembleRelease', …(19) ] to deeply equal [ 'assembleRelease', …(16) ]
      + expected - actual

       [
         "assembleRelease"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  24) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for debug build with info log and android bundle:

      AssertionError: expected [ 'bundleDebug', '--quiet', …(12) ] to deeply equal [ 'bundleDebug', '--quiet', …(9) ]
      + expected - actual

       [
         "bundleDebug"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  25) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for debug build with trace log and android bundle:

      AssertionError: expected [ Array(15) ] to deeply equal [ Array(12) ]
      + expected - actual

       [
         "bundleDebug"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  26) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for release build with info log and android bundle:

      AssertionError: expected [ 'bundleRelease', '--quiet', …(17) ] to deeply equal [ 'bundleRelease', '--quiet', …(14) ]
      + expected - actual

       [
         "bundleRelease"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  27) GradleBuildArgsService
       getBuildTaskArgs
         should return correct args for release build with trace log and android bundle:

      AssertionError: expected [ 'bundleRelease', …(19) ] to deeply equal [ 'bundleRelease', …(16) ]
      + expected - actual

       [
         "bundleRelease"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  28) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for debug clean build with info log:

      AssertionError: expected [ 'clean', '--quiet', …(12) ] to deeply equal [ 'clean', '--quiet', …(9) ]
      + expected - actual

       [
         "clean"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  29) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for debug clean build with trace log:

      AssertionError: expected [ 'clean', '--stacktrace', …(13) ] to deeply equal [ 'clean', '--stacktrace', …(10) ]
      + expected - actual

       [
         "clean"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  30) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for release clean build with info log:

      AssertionError: expected [ 'clean', '--quiet', …(17) ] to deeply equal [ 'clean', '--quiet', …(14) ]
      + expected - actual

       [
         "clean"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  31) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for release clean build with trace log:

      AssertionError: expected [ 'clean', '--stacktrace', …(18) ] to deeply equal [ 'clean', '--stacktrace', …(15) ]
      + expected - actual

       [
         "clean"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  32) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for debug clean build with info log and android bundle:

      AssertionError: expected [ 'clean', '--quiet', …(12) ] to deeply equal [ 'clean', '--quiet', …(9) ]
      + expected - actual

       [
         "clean"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  33) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for debug clean build with trace log and android bundle:

      AssertionError: expected [ 'clean', '--stacktrace', …(13) ] to deeply equal [ 'clean', '--stacktrace', …(10) ]
      + expected - actual

       [
         "clean"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
       ]

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  34) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for release clean build with info log and android bundle:

      AssertionError: expected [ 'clean', '--quiet', …(17) ] to deeply equal [ 'clean', '--quiet', …(14) ]
      + expected - actual

       [
         "clean"
         "--quiet"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

  35) GradleBuildArgsService
       getCleanTaskArgs
         should return correct args for release clean build with trace log and android bundle:

      AssertionError: expected [ 'clean', '--stacktrace', …(18) ] to deeply equal [ 'clean', '--stacktrace', …(15) ]
      + expected - actual

       [
         "clean"
         "--stacktrace"
         "--debug"
      -  "--stacktrace"
         "-PcompileSdk=android-28"
         "-PtargetSdk=26"
         "-PbuildToolsVersion=my-build-tools-version"
         "-PgenerateTypings=true"
      +  "-DprojectRoot=/path/to/projectDir"
         "-PprojectRoot=/path/to/projectDir"
      -  "-DprojectRoot=/path/to/projectDir"
         "-PappPath=/path/to/projectDir/app"
         "-PappBuildPath=platforms"
      -  "-DappBuildPath=platforms"
      -  "-PappPath=/path/to/projectDir/app"
         "-PappResourcesPath=/path/to/projectDir/app/App_Resources"
         "-Prelease"
         "-PksPath=/var/folders/7_/qj96kqbd2jz83dlnh9v97p7w0000gn/T/ksPath2024213-80054-1ddb9qk.yi07h"
         "-Palias=keyStoreAlias"

      at /Users/rigor789/Code/NativeScript/nativescript-cli/test/services/android/gradle-build-args-service.ts:57:11
      at Generator.next (<anonymous>)
      at fulfilled (test/services/android/gradle-build-args-service.js:5:58)

lib/controllers/platform-controller.ts Outdated Show resolved Hide resolved
lib/controllers/prepare-controller.ts Outdated Show resolved Hide resolved
@@ -58,6 +60,8 @@ export class AndroidBuildData extends BuildData {
this.keyStoreAliasPassword = data.keyStoreAliasPassword;
this.keyStorePassword = data.keyStorePassword;
this.androidBundle = data.androidBundle || data.aab;
this.buildFilterDevicesArch = !this.androidBundle && data.filterDevicesArch !== false ;
this.gradleFlavor = data.flavor;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be named data.gradleFlavor for consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can yes. But to me flavor is more of an android option than a gradle option. I mean gradlePath and gradleArgs are options for the gradle "tool".
Let me know what you prefer and i ll change

package.json Outdated Show resolved Hide resolved
lib/services/device/device-install-app-service.ts Outdated Show resolved Hide resolved
lib/services/device/device-install-app-service.ts Outdated Show resolved Hide resolved
lib/services/device/device-install-app-service.ts Outdated Show resolved Hide resolved
lib/services/android/gradle-build-args-service.ts Outdated Show resolved Hide resolved
lib/services/android/gradle-build-args-service.ts Outdated Show resolved Hide resolved
@farfromrefug
Copy link
Contributor Author

@rigor789 I am sorry I resolved by mistake the conflicts I pushed fixes for...

@farfromrefug
Copy link
Contributor Author

@rigor789 now all tests are passing here

Copy link
Member

@rigor789 rigor789 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running ns debug android always rebuilds the app - traced it back to android-project-service.ts setting nativeChanged = true.

This is related to the ABI filtering, is the build supposed to always create <abi>.*.apk? Because it's not doing that:

image

return regexp.test(entry);
});
if (files.length === 0) {
changesInfo.nativeChanged = true;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@farfromrefug this seems to be causing a rebuild every time you run ns debug android.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@farfromrefug possible to adjust that portion to not rebuild on initial run?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NathanWalker we started discussing that with @rigor789. I proposed to add a test to detect universal builds (through apk name). If we agree on that (or another solution) i ll implement it

@rigor789 rigor789 removed this from the 9.0 milestone Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants