google / play-services-plugins

Plugins to help with using Google Play services SDK.
https://developers.google.com/android/guides/overview
Apache License 2.0
458 stars 135 forks source link

OSS Licenses Dependencies Always Absent #252

Open kkovach opened 1 year ago

kkovach commented 1 year ago

The generated dependencies.json file is always the default "absent" and as a result the dependency list is always the default "Debug License Info". I created a sample app and was able to get it working, but have not been able to get it working in my actual project, so there's clearly something different with my build file or something. My project has multiple flavor dimensions. I did add some some flavors to my sample as well. I did take time to make sure that the versions in the sample were the same as my project. They are listed below.

I did notice one difference between the behavior of the sample and my actual project. In the sample that works when I run the fooReleaseOssDependencyTask task there is a dependent task that runs called collectFooReleaseDependencies.

This "collect" task is not available in my project where I am getting empty dependencies. When I run my flavorReleaseOssDependencyTask in my project that has the issue I do not see a similar collectFlavorReleaseDependencies run. I also checked to see if it is available with ./gradlew :app:tasks --all and it is not in the list. I am assuming that this collect task comes from the oss-license-plugin?

I wonder if this is some clue as to why my build might be different? Any thoughts or advice would be appreciated. I can also work on adding my build file but need to clean it up first. Thanks.

build.gradle.kts.txt

Alexander13Oster commented 1 year ago

Hi @kkovach, i had the same problem. The plugin looks for the debuggable flag and not whether it is a "release" or "debug" build. In your config release is configured with isDebuggable = true which is why it is always absent.

caller9 commented 1 year ago

Alexander is correct. The Android Gradle Plugin only generates the dependency list that the plugin consumes for releasable builds.

javadude commented 1 year ago

We should have a manually-run task to generate the list regardless of build type

tejaswini-rav commented 1 year ago

@javadude is there any command to get the list regardless build type?

javadude commented 1 year ago

@tejaswini-rav Not that I know of offhand. I haven't had a chance to look into it - right now it depends on what the Android Gradle Plugin provides, and I don't know that there is an option there (other than marking isDebuggable = false)

FYI there are other plugins out there that do similar things. I used to use https://github.com/jaredsburrows/gradle-license-plugin, generating JSON from it and creating my own pages to display in my work apps.

tejaswini-rav commented 1 year ago

@javadude thankyou for the getback and reference link, i tried with release build version and it worked, not sure the default google provided OssLicenseActivity is looking pretty though :) but will try the other reference !