Open coolboy0961 opened 3 years ago
I found the fail and succeed pattern.
1. rm -rf ./hooks ./platforms ./node_modules npm ci build android → fail
2. rm -rf ./hooks ./platforms ./node_modules npm ci build ios → succeed build android → fail
3. rm -rf ./hooks ./platforms ./node_modules npm ci build android → fail build ios → succeed build android → succeed
I also noticed that if app.grade is not found,
@nativescript-community/licenses will using android X library androidx.legacy:legacy-support-v4:1.0.0
.
Maybe @nativescript-community/licenses execute something when app.grade is not found and it let android build succeed.
@coolboy0961 I think the best would be for to try with a sample app without @nativescript/firebase
. If you can reproduce it there it would be easier for me to fix it. There might be indeed an issue with the path
@coolboy0961 OK, I will create a sample app to reproduce the problem.
@farfromrefug
I created the sample app to reproduce the problem, could you clone it? https://github.com/coolboy0961/sample-app-for-reproduce.git
The steps to confirm build android successfully without install @nativescript/firebase
ns build android
$ ns build android
npm WARN deprecated xmldom@0.1.31: Deprecated due to CVE-2021-21366 resolved in 0.5.0
@nativescript-community/licenses@1.1.11 postinstall /Users/chenj49/git/sample-app-reproduce-license/node_modules/@nativescript-community/licenses node postinstall.js
@nativescript/core@8.0.8 postinstall /Users/chenj49/git/sample-app-reproduce-license/node_modules/@nativescript/core node cli-hooks/postinstall.js
npm notice created a lockfile as package-lock.json. You should commit this file. added 399 packages from 295 contributors and audited 400 packages in 19.759s
40 packages are looking for funding
run npm fund
for details
found 2 vulnerabilities (1 low, 1 moderate)
run npm audit fix
to fix them, or npm audit
for details
Copying template files...
Platform android successfully added. v8.0.0
Preparing project...
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue($color) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 75 │ $color-brightness: round((red($color) 299) + (green($color) 587) + (blue($color) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 75:76 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/variables/_blue.scss 2:9 @import app/components/Home.vue 31:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue(#ffffff) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 76 │ $light-color: round((red(#ffffff) 299) + (green(#ffffff) 587) + (blue(#ffffff) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 76:73 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/variables/_blue.scss 2:9 @import app/components/Home.vue 31:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div($light-color, 1.7)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 78 │ @return abs($color-brightness) < ($light-color / 1.7); │ ^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 78:39 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/variables/_blue.scss 2:9 @import app/components/Home.vue 31:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue($color) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 75 │ $color-brightness: round((red($color) 299) + (green($color) 587) + (blue($color) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 75:76 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/core/_index.scss 2:9 @import node_modules/@nativescript/theme/core.scss 8:9 @import app/app.scss 1:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue(#ffffff) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 76 │ $light-color: round((red(#ffffff) 299) + (green(#ffffff) 587) + (blue(#ffffff) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 76:73 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/core/_index.scss 2:9 @import node_modules/@nativescript/theme/core.scss 8:9 @import app/app.scss 1:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div($light-color, 1.7)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 78 │ @return abs($color-brightness) < ($light-color / 1.7); │ ^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 78:39 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/core/_index.scss 2:9 @import node_modules/@nativescript/theme/core.scss 8:9 @import app/app.scss 1:9 root stylesheet
assets by path .js 6.87 MiB asset vendor.js 6.51 MiB [emitted] (name: vendor) (id hint: defaultVendor) asset bundle.js 350 KiB [emitted] (name: bundle) asset runtime.js 12.9 KiB [emitted] (name: runtime) assets by path fonts/.ttf 374 KiB asset fonts/fa-solid-900.ttf 204 KiB [emitted] [from: app/fonts/fa-solid-900.ttf] [copied] asset fonts/fa-brands-400.ttf 131 KiB [emitted] [from: app/fonts/fa-brands-400.ttf] [copied] asset fonts/fa-regular-400.ttf 39.1 KiB [emitted] [from: app/fonts/fa-regular-400.ttf] [copied] Entrypoint bundle 6.87 MiB = runtime.js 12.9 KiB vendor.js 6.51 MiB bundle.js 350 KiB runtime modules 2.72 KiB 8 modules orphan modules 356 bytes [orphan] 6 modules modules by path ./node_modules/@nativescript/core/ 1.4 MiB 162 modules modules by path ./node_modules/css-tree/ 318 KiB 113 modules modules by path ./app/ 127 KiB 9 modules modules by path ./node_modules/source-map/lib/.js 38.2 KiB 6 modules modules by path ./node_modules/reduce-css-calc/dist/ 131 KiB modules by path ./node_modules/reduce-css-calc/dist/lib/.js 11.1 KiB 3 modules modules by path ./node_modules/reduce-css-calc/dist/.js 120 KiB 2 modules modules by path ./node_modules/postcss-value-parser/lib/.js 9.11 KiB 5 modules modules by path ./node_modules/mdn-data/css/.json 242 KiB 3 modules modules by path external "~/.json" 84 bytes external "~/licenses.json" 42 bytes [built] [code generated] external "~/package.json" 42 bytes [optional] [built] [code generated] 4 modules webpack 5.49.0 compiled successfully in 7309 ms Webpack compilation complete. @nativescript-community/licenses:
@nativescript-community/licenses: > Configure project :app @nativescript-community/licenses:
@nativescript-community/licenses: + couldn't load user-defined configuration from /Users/chenj49/git/sample-app-reproduce-license/app/App_Resources/Android/app.gradle. File doesn't exist. @nativescript-community/licenses:
@nativescript-community/licenses: + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
@nativescript-community/licenses: + adding aar plugin dependency: /Users/chenj49/git/sample-app-reproduce-license/node_modules/@nativescript/core/platforms/android/widgets-release.aar @nativescript-community/licenses:
@nativescript-community/licenses:
@nativescript-community/licenses: > Task :app:generateLicenseReport 1 actionable task: 1 executed
child process exited with code 0 Updating runtime package.json with configuration values... Project successfully prepared (android) Building project... Gradle build...
The steps to reproduce the android license build error
$ ns plugin add @nativescript/firebase
npm WARN deprecated prompt-lite@0.1.1: I wrote this module a very long time ago; you should use something else.
npm WARN deprecated uuid@3.0.1: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
@nativescript/firebase@11.1.3 postinstall /Users/chenj49/git/sample-app-reproduce-license/node_modules/@nativescript/firebase node postinstall-hooks.js && node scripts/postinstall.js
NativeScript Firebase Plugin Installation
No existing firebase.nativescript.json config file found, so let's configure the Firebase plugin!
prompt: Are you using iOS (y/n): (y)
prompt: Are you using Android (y/n): (y)
prompt: Do you want to enable Firebase Analytics? (y/n): (y)
prompt: Are you using Firestore? (y/n): (n)
prompt: Are you using Realtime DB? (y/n): (n)
prompt: Are you using Firebase Authentication (pretty likely if you use Firestore or Realtime DB)? (y/n): (y)
prompt: Are you using Firebase RemoteConfig? (y/n): (n)
prompt: Are you using Performance Monitoring? (y/n): (n)
prompt: Are you using this plugin as a Push Notification client for an external (NOT Firebase Cloud Messaging) Push service? (y/n): (n)
prompt: Are you using Firebase Cloud Messaging? (y/n): (n)
prompt: Are you using In-App Messaging? (y/n): (n)
prompt: Are you using Firebase Crashlytics? (y/n): (n)
prompt: Are you using Firebase Storage? (y/n): (n)
prompt: Are you using Firebase Cloud Functions? (y/n): (n)
prompt: Are you using Firebase Facebook Authentication? (y/n): (n)
prompt: Are you using Firebase Google Authentication? (y/n): (n)
prompt: Are you using AdMob? (y/n): (n)
prompt: Are you using Firebase Dynamic Links? (y/n): (n)
prompt: Are you using ML Kit? (y/n): (n)
Successfully created iOS (Pod) file.
Install google-service.json after-prepare copy hook.
Install google-service.json before-checkForChanges copy hook.
Successfully created Android (include.gradle) file.
Install google-service.json after-prepare copy hook.
Install google-service.json before-checkForChanges copy hook.
Firebase post install completed. To re-run this script, navigate to the root directory of nativescript-plugin-firebase
in your node_modules
folder and run: npm run config
.
prompt: Do you want to save the selected configuration. Reinstalling the dependency will reuse the setup from: firebase.nativescript.json. CI will be easier. (y/n): (y)
40 packages are looking for funding
run npm fund
for details
found 4 vulnerabilities (2 low, 2 moderate)
run npm audit fix
to fix them, or npm audit
for details
Successfully installed plugin @nativescript/firebase.
- `ns build android`
$ ns build android Preparing project... DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue($color) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 75 │ $color-brightness: round((red($color) 299) + (green($color) 587) + (blue($color) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 75:76 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/variables/_blue.scss 2:9 @import app/components/Home.vue 31:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue(#ffffff) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 76 │ $light-color: round((red(#ffffff) 299) + (green(#ffffff) 587) + (blue(#ffffff) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 76:73 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/variables/_blue.scss 2:9 @import app/components/Home.vue 31:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div($light-color, 1.7)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 78 │ @return abs($color-brightness) < ($light-color / 1.7); │ ^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 78:39 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/variables/_blue.scss 2:9 @import app/components/Home.vue 31:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue($color) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 75 │ $color-brightness: round((red($color) 299) + (green($color) 587) + (blue($color) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 75:76 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/core/_index.scss 2:9 @import node_modules/@nativescript/theme/core.scss 8:9 @import app/app.scss 1:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div(blue(#ffffff) * 114, 1000)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 76 │ $light-color: round((red(#ffffff) 299) + (green(#ffffff) 587) + (blue(#ffffff) * 114) / 1000); │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 76:73 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/core/_index.scss 2:9 @import node_modules/@nativescript/theme/core.scss 8:9 @import app/app.scss 1:9 root stylesheet
DEPRECATION WARNING: Using / for division is deprecated and will be removed in Dart Sass 2.0.0.
Recommendation: math.div($light-color, 1.7)
More info and automated migrator: https://sass-lang.com/d/slash-div
╷ 78 │ @return abs($color-brightness) < ($light-color / 1.7); │ ^^^^^^^^^^^^^^^^^^ ╵ node_modules/@nativescript/theme/scss/mixins/_utilities.scss 78:39 check-contrast() node_modules/@nativescript/theme/scss/mixins/_utilities.scss 84:49 alternate() node_modules/@nativescript/theme/scss/variables/_index.scss 56:11 @import node_modules/@nativescript/theme/scss/core/_index.scss 2:9 @import node_modules/@nativescript/theme/core.scss 8:9 @import app/app.scss 1:9 root stylesheet
assets by status 6.87 MiB [emitted] asset vendor.js 6.51 MiB [emitted] (name: vendor) (id hint: defaultVendor) asset bundle.js 351 KiB [emitted] (name: bundle) asset runtime.js 12.9 KiB [emitted] (name: runtime) assets by status 374 KiB [compared for emit] asset fonts/fa-solid-900.ttf 204 KiB [compared for emit] [from: app/fonts/fa-solid-900.ttf] [copied] asset fonts/fa-brands-400.ttf 131 KiB [compared for emit] [from: app/fonts/fa-brands-400.ttf] [copied] asset fonts/fa-regular-400.ttf 39.1 KiB [compared for emit] [from: app/fonts/fa-regular-400.ttf] [copied] Entrypoint bundle 6.87 MiB = runtime.js 12.9 KiB vendor.js 6.51 MiB bundle.js 351 KiB runtime modules 2.72 KiB 8 modules orphan modules 356 bytes [orphan] 6 modules modules by path ./node_modules/@nativescript/core/ 1.4 MiB 162 modules modules by path ./node_modules/css-tree/ 318 KiB 113 modules modules by path ./app/ 128 KiB 9 modules modules by path ./node_modules/source-map/lib/.js 38.2 KiB 6 modules modules by path ./node_modules/reduce-css-calc/dist/ 131 KiB modules by path ./node_modules/reduce-css-calc/dist/lib/.js 11.1 KiB 3 modules modules by path ./node_modules/reduce-css-calc/dist/.js 120 KiB 2 modules modules by path ./node_modules/postcss-value-parser/lib/.js 9.11 KiB 5 modules modules by path ./node_modules/mdn-data/css/.json 242 KiB 3 modules modules by path external "~/.json" 84 bytes external "~/licenses.json" 42 bytes [built] [code generated] external "~/package.json" 42 bytes [optional] [built] [code generated] 4 modules webpack 5.49.0 compiled successfully in 6834 ms Webpack compilation complete. nativescript-plugin-firebase: /Users/chenj49/git/sample-app-reproduce-license/platforms/android/.pluginfirebaseinfo not found, forcing prepare! nativescript-plugin-firebase: running release build or change in environment detected, forcing prepare! Built aar for @nativescript/firebase @nativescript-community/licenses:
@nativescript-community/licenses: > Configure project :app
@nativescript-community/licenses: + setting applicationId
@nativescript-community/licenses: Script '/Users/chenj49/git/sample-app-reproduce-license/node_modules/@nativescript/firebase/platforms/android/include.gradle' line: 96
@nativescript-community/licenses: A problem occurred evaluating script.
@nativescript-community/licenses: Plugin with id 'com.google.gms.google-services' not found.
@nativescript-community/licenses:
child process exited with code 1
Error: generateLicenseReport failed
at ChildProcess.
Appendix:
the steps for creating sample app
ns create sample-app-reproduce-license --vue --ts cd sample-app-reproduce-license ns plugin add @nativescript-community/licenses ns plugin add @nativescript-community/ui-lottie
- add Podfile at App_Resource/iOS/Podfile
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET' end end end
- add external setting to webpack.config.js
const webpack = require("@nativescript/webpack");
module.exports = (env) => { webpack.init(env);
// Learn how to customize:
// https://docs.nativescript.org/webpack
webpack.chainWebpack((config) => {
config.externals(
// make sure to keep pre-defined externals
config.get("externals").concat([
// add your own externals
"~/licenses.json",
])
);
});
return webpack.resolveConfig();
};
- Add following code in app.ts to output license info to console log.
const licenses = require("~/licenses.json"); console.log(licenses);
@coolboy0961 so you confirm this is an issue with the firebase plugin? If so as i told you i wont fix it from my side :s the firebase plugin completely rewrite your gradle files which is total madness. There is no way for me to ensure it would work :s If i understood wrong and it still fails without the firebase plugin, ping me again!
@farfromrefug
your plugin works well without the firebase plugin. I also confirmed that the firebase plugin add something in platform/android/app.grade like following image when I executed ios build.
I will not ask you to change the firebase plugin but is there anyway to let the hook of @nativescript-community/licenses execute at the end of hooks? I manually add the things which is add by the firebase plugin automatically into the app.grade and then android build succeed. So, I think if I can let the firebase plugin change app.grade first, the hook of @nativescript-community/licenses should execute successfully.
In view of this kind of plugin that modifies app.grade, could you consider putting the timing of plugin hook execution at the end?
@coolboy0961 First there is no "order" in hooks so we cant set that. Second the order wont change anything as my hook does NOT modify the app.gradle.
My hook simply injects itself at gradle build time through include.gradle
. I dont know what firebase does and why the order would change anything.
@farfromrefug Sorry, me again. I really want to use your plugin to generate both ios and android licenses. Please forgive me to add issue again.
I got an error
@nativescript-community/licenses: Plugin with id 'com.google.gms.google-services' not found.
when I build android package. com.google.gms.google-services is a plugin which is used in @nativescript/firebase. You can find it innode_modules/@nativescript/firebase/platforms/android/include.gradle
.Sometimes build android package will success, I do not know how it happens. But in that time, I noticed this log
@nativescript-community/licenses: + couldn't load user-defined configuration from /Users/chenj49/git/git_gs-linemo-native-app/native-app/app/App_Resources/Android/app.gradle. File doesn't exist.
. My real app.gradle file path is/Users/chenj49/git/git_gs-linemo-native-app/native-app/App_Resources/Android/app.gradle
. So I think something wrong in @nativescript-community/licenses because it looked a wrong path, and that lead to make android build succeed.I do not know what's wrong with it, I can not ask you to fix something exactly, but I really hope that we can make this plugin working on @nativescript/firebase.
I will share the logs in following situations.
The following log is output when build ios package successfully.
The following log is output when build android package successfully.
The following log is output when build android package fail.