gradle-license-plugin
gradle-license-plugin copied to clipboard
License report task creation fails for androidTest + variant
I wanted to try out the useVariantSpecificAssetDirs flag (set to true) together with the ignoredPatterns feature so I updated to 0.9.1-SNAPSHOT. I ran into an issue when building though:
What went wrong:
A problem occurred configuring project ':app'.
> Could not create task ':app:licenseVariant1ReleaseAndroidTestReport'.
> AndroidSourceSet with name 'variant1ReleaseAndroidTest' not found.
In the app module's build.gradle I do:
project.afterEvaluate {
tasks.forEach({ <--- Triggers the exception
// Do stuff
})
}
Partial stacktrace:
Caused by: org.gradle.api.UnknownDomainObjectException: AndroidSourceSet with name 'variant1ReleaseAndroidTest' not found.
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.createNotFoundException(DefaultNamedDomainObjectCollection.java:504)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:333)
at com.jaredsburrows.license.ProjectAndroidKt.configureVariant$lambda-7$lambda-6(projectAndroid.kt:99)
I have three androidTest source sets:
androidTest androidTestVariant1 androidTestVariant2
No debug/release specific source sets though. So far I've, unsuccessfully, tried to disable the creation of the androidTest related license tasks.
Do you have an example repo or the actual build.gradle* file?
When removing, project.afterEvaluate the error goes away. I am not sure if this is directly related to the license plugin.
Feel free to comment or update this. Closing for now.