Fail if no allowed licenses are specified with StrictMode.FAIL#1208
Fail if no allowed licenses are specified with StrictMode.FAIL#1208
Conversation
mikepenz
commented
Jul 1, 2025
- fail if no allowed licenses are specified with strict mode set to FAIL
- FIX strict mode set to FAIL doesn't fail if no licenses are allowed #1204
…out `afterEvaluate` we have to split the plugin into the main part, and the android auto generation code - NOTE: Breaking change
- FIX #1190 # Conflicts: # plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt # plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/BaseAboutLibrariesTask.kt
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to fail the build when StrictMode.FAIL is used without any allowed licenses and introduces an option to require license information on all libraries. It also splits the Android support into a separate plugin and updates task registration accordingly.
- Introduce
requireLicenseflag and wire it into task inputs - Enhance
AboutLibrariesTaskto throw or warn on missing licenses and license-less libraries - Split Android-specific task registration into a dedicated Gradle plugin
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| BaseAboutLibrariesTask.kt | Added requireLicense property as a task input |
| AboutLibrariesTask.kt | Updated license validation flow and logging for missing license info |
| AboutLibrariesPluginAndroidExtension.kt | Refactored configureAndroidTasks to accept a custom block parameter |
| AboutLibrariesPluginAndroid.kt | New Android-specific plugin implementation |
| AboutLibrariesPlugin.kt | Always invoke Android task registration, removed deprecated guard |
| AboutLibrariesExtension.kt | Added requireLicense to LibraryConfig and deprecated old Android config |
| build.gradle.kts | Registered new Android plugin in the Gradle plugin block |
| app/build.gradle.kts & app-test/build.gradle.kts | Switched to the new Android plugin ID and removed deprecated android {} block |
| MIGRATION.md | Added notes for v13.0.0 Android plugin split |
Comments suppressed due to low confidence (3)
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt:129
- Consider adding tests to verify behavior when
requireLicenseis true: ensure libraries with no license trigger the correct warning or failure under differentstrictModesettings.
val librariesWithoutLicense = if (requireLicense.get()) libraries.filter { it.licenses.isEmpty() } else emptyList()
MIGRATION.md:3
- [nitpick] Add a note about the new
requireLicenseflag underlibrary {}so users know how to enforce license presence when upgrading.
#### v13.0.0
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesPluginAndroidExtension.kt:8
- The default
blockparameter is set to::configureAndroidTasks(itself), causing infinite recursion when registering variants. Consider defaulting to the Android-specific handler (::configureAndroidResourceTasks) or removing the default.
internal fun configureAndroidTasks(
| @get:Input | ||
| abstract val variant: Property<String?> | ||
|
|
||
| @Input |
There was a problem hiding this comment.
Gradle task input properties in Kotlin need the annotation on the getter (@get:Input), otherwise this property won’t be recognized as an input.
| @Input | |
| @get:Input |