EddyVerbruggen / nativescript-plugin-firebase

:fire: NativeScript plugin for Firebase
https://firebase.google.com
MIT License
1.01k stars 442 forks source link

Purpose of copyMetadata task injection in build.gradle? #695

Open lambourn opened 6 years ago

lambourn commented 6 years ago

While debugging an issue with Firebase Analytics not sending events on Android, I stumbled across this: in the after-prepare hook script firebase-build-gradle.js, the {N} build.gradle file is patched/modified and the task copyMetadata is created.

What is the purpose here? The default {N} build.gradle does emit metadata to src/main/assets/metadata and the injected copyMetadatatask copies them to either /build/intermediates/assets/debug/metadata or /build/intermediates/assets/release/metadata

I have an issue here as I use flavors for my build and this somehow breaks the above.

TNS 4.0.0, nativescript-plugin-firebase 5.3.1

EddyVerbruggen commented 6 years ago

Tip: open that file on GHithub and hit the 'blame' button and scroll to the lines that copy the metadata. That should indicate which issue lead to this change.

Note that it wasn't tested with falvors so I'm not surprised if there's an issue. Feel free to share a repo reproducing the issue.

lambourn commented 6 years ago

Thanks. I followed the thread on #549 and your comment on it. Still not sure why the files explicitely need to get copied there but anyways.

As for flavors: once flavors (e.g. dev and prod) are defined, the folder structure below android/app/build/intermediates/assets will have these flavors as subfolders, like android/app/build/intermediates/assets/dev and android/app/build/intermediates/assets/prod with debug / release subfolders as per the selected build type.

I'll see if I can fix it and open a PR.