jaredsburrows / gradle-license-plugin

Gradle plugin that provides a task to generate a HTML license report of your project.
https://central.sonatype.com/artifact/com.jaredsburrows/gradle-license-plugin
Apache License 2.0
399 stars 65 forks source link

Issue related to Androidx and jettifier resulting in empty json and html #104

Closed pranavvij closed 2 years ago

pranavvij commented 4 years ago

After enabling Jetifier and Androidx into my project, the license report shows empty results. I tried printing the productFlavours in LicensePlugin, which gives an empty result. here is the POC which demos this behavior. Investigating too as to why this issue prevails.

tagboola commented 4 years ago

I'm getting the same error as well. When I run it in the command line via ./gradlew licenseDebugReport it generates report with the correct dependencies. However, when I add it as task before preBuild I get an empty report. Here is the configuration that generates an empty report:

afterEvaluate {
    android.applicationVariants.all {
        variant ->
            def taskName ="license${variant.name.capitalize()}Report"
            if (variant.respondsTo("getPreBuildProvider")) {
                variant.preBuildProvider.configure { dependsOn(taskName) }
            } else {
                variant.preBuild.dependsOn(taskName)
            }
    }
}
jaredsburrows commented 4 years ago

@pranavvij I just tried your project. What is the error you are seeing?

git https://github.com/pranavvij/gradle-kotlin-plugin cd gradle-kotlin-plugin gradlew licenseDebugReport cat app/build/reports/licenses/licenseDebugReport.json

licenseDebugReport.json ``` [ { "project": "Android AppCompat Library v7", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2011", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.appcompat:appcompat:1.0.0" }, { "project": "Android Arch-Common", "description": "Android Arch-Common", "version": "2.0.0", "developers": [ "The Android Open Source Project" ], "url": "https://developer.android.com/topic/libraries/architecture/index.html", "year": "2017", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.arch.core:core-common:2.0.0" }, { "project": "Android Arch-Runtime", "description": "Android Arch-Runtime", "version": "2.0.0", "developers": [ "The Android Open Source Project" ], "url": "https://developer.android.com/topic/libraries/architecture/index.html", "year": "2017", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.arch.core:core-runtime:2.0.0" }, { "project": "Android Lifecycle LiveData", "description": "Android Lifecycle LiveData", "version": "2.0.0", "developers": [ "The Android Open Source Project" ], "url": "https://developer.android.com/topic/libraries/architecture/index.html", "year": "2017", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.lifecycle:lifecycle-livedata:2.0.0" }, { "project": "Android Lifecycle LiveData Core", "description": "Android Lifecycle LiveData Core", "version": "2.0.0", "developers": [ "The Android Open Source Project" ], "url": "https://developer.android.com/topic/libraries/architecture/index.html", "year": "2017", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.lifecycle:lifecycle-livedata-core:2.0.0" }, { "project": "Android Lifecycle Runtime", "description": "Android Lifecycle Runtime", "version": "2.0.0", "developers": [ "The Android Open Source Project" ], "url": "https://developer.android.com/topic/libraries/architecture/index.html", "year": "2017", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.lifecycle:lifecycle-runtime:2.0.0" }, { "project": "Android Lifecycle ViewModel", "description": "Android Lifecycle ViewModel", "version": "2.0.0", "developers": [ "The Android Open Source Project" ], "url": "https://developer.android.com/topic/libraries/architecture/index.html", "year": "2017", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.lifecycle:lifecycle-viewmodel:2.0.0" }, { "project": "Android Lifecycle-Common", "description": "Android Lifecycle-Common", "version": "2.0.0", "developers": [ "The Android Open Source Project" ], "url": "https://developer.android.com/topic/libraries/architecture/index.html", "year": "2017", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.lifecycle:lifecycle-common:2.0.0" }, { "project": "Android Support AnimatedVectorDrawable", "description": "Android Support AnimatedVectorDrawable", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2015", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.vectordrawable:vectordrawable-animated:1.0.0" }, { "project": "Android Support ExifInterface", "description": "Android Support ExifInterface", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2016", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.exifinterface:exifinterface:1.0.0" }, { "project": "Android Support Library Annotations", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs.", "version": "1.0.2", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2013", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.annotation:annotation:1.0.2" }, { "project": "Android Support Library Async Layout Inflater", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.asynclayoutinflater:asynclayoutinflater:1.0.0" }, { "project": "Android Support Library collections", "description": "Standalone efficient collections.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.collection:collection:1.0.0" }, { "project": "Android Support Library compat", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.2", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2015", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.core:core:1.0.2" }, { "project": "Android Support Library Coordinator Layout", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2011", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.coordinatorlayout:coordinatorlayout:1.0.0" }, { "project": "Android Support Library core UI", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2011", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.legacy:legacy-support-core-ui:1.0.0" }, { "project": "Android Support Library core utils", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2011", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.legacy:legacy-support-core-utils:1.0.0" }, { "project": "Android Support Library Cursor Adapter", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.cursoradapter:cursoradapter:1.0.0" }, { "project": "Android Support Library Custom View", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.customview:customview:1.0.0" }, { "project": "Android Support Library Custom View", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" }, { "project": "Android Support Library Document File", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.documentfile:documentfile:1.0.0" }, { "project": "Android Support Library Drawer Layout", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.drawerlayout:drawerlayout:1.0.0" }, { "project": "Android Support Library fragment", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2011", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.fragment:fragment:1.0.0" }, { "project": "Android Support Library Interpolators", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.interpolator:interpolator:1.0.0" }, { "project": "Android Support Library loader", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2011", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.loader:loader:1.0.0" }, { "project": "Android Support Library Local Broadcast Manager", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0" }, { "project": "Android Support Library Print", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.print:print:1.0.0" }, { "project": "Android Support Library Sliding Pane Layout", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.slidingpanelayout:slidingpanelayout:1.0.0" }, { "project": "Android Support Library View Pager", "description": "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren\u0027t a part of the framework APIs. Compatible on devices running API 14 or later.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.viewpager:viewpager:1.0.0" }, { "project": "Android Support VectorDrawable", "description": "Android Support VectorDrawable", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2015", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.vectordrawable:vectordrawable:1.0.0" }, { "project": "android-image-cropper", "description": null, "version": "2.8.0", "developers": [], "url": null, "year": null, "licenses": [], "dependency": "com.theartofdev.edmodo:android-image-cropper:2.8.0" }, { "project": "Core Kotlin Extensions", "description": "Kotlin extensions for \u0027core\u0027 artifact", "version": "1.0.2", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.core:core-ktx:1.0.2" }, { "project": "IntelliJ IDEA Annotations", "description": "A set of annotations used for code inspection support and code documentation.", "version": "13.0", "developers": [ "JetBrains Team" ], "url": "http://www.jetbrains.org", "year": null, "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "org.jetbrains:annotations:13.0" }, { "project": "org.jetbrains.kotlin:kotlin-android-extensions-runtime", "description": "Kotlin Android Extensions Runtime", "version": "1.3.31", "developers": [ "Kotlin Team" ], "url": "https://kotlinlang.org/", "year": null, "licenses": [ { "license": "The Apache License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.3.31" }, { "project": "org.jetbrains.kotlin:kotlin-stdlib", "description": "Kotlin Standard Library for JVM", "version": "1.3.31", "developers": [ "Kotlin Team" ], "url": "https://kotlinlang.org/", "year": null, "licenses": [ { "license": "The Apache License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "org.jetbrains.kotlin:kotlin-stdlib:1.3.31" }, { "project": "org.jetbrains.kotlin:kotlin-stdlib-common", "description": "Kotlin Common Standard Library", "version": "1.3.31", "developers": [ "Kotlin Team" ], "url": "https://kotlinlang.org/", "year": null, "licenses": [ { "license": "The Apache License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "org.jetbrains.kotlin:kotlin-stdlib-common:1.3.31" }, { "project": "VersionedParcelable and friends", "description": "Provides a stable but relatively compact binary serialization format that can be passed across processes or persisted safely.", "version": "1.0.0", "developers": [ "The Android Open Source Project" ], "url": "http://developer.android.com/tools/extras/support-library.html", "year": "2018", "licenses": [ { "license": "The Apache Software License, Version 2.0", "license_url": "http://www.apache.org/licenses/LICENSE-2.0.txt" } ], "dependency": "androidx.versionedparcelable:versionedparcelable:1.0.0" } ] ```
pranavvij commented 4 years ago

@jaredsburrows gradlew licenseDebugReport works perfectly. There is no issue with that, but as soon as I make preBuild dependOn license task. It gives an empty report. I think the main issue with that is probably the Androidx and jettifier. Refer to the below build.gradle which shows the illustration of the issue. https://github.com/pranavvij/gradle-kotlin-plugin/blob/master/app/build.gradle#L42

tom-pratt commented 4 years ago

Any more info on this? I am facing the same issue and depend on triggering the license task automatically in this way.

BsBrabi commented 4 years ago

A workaround is to run the task manually via the command line, see https://github.com/jaredsburrows/gradle-license-plugin/issues/113#issuecomment-594366803.

jaredsburrows commented 2 years ago

You can setup yourself or run manually.

This works:

tasks.whenTaskAdded {
  if (name == "assembleDebug") {
    dependsOn("licenseDebugReport")
  }
}

tasks.whenTaskAdded {
  if (name == "assembleRelease") {
    dependsOn("licenseReleaseReport")
  }
}