Skip to content

Fail if no allowed licenses are specified with StrictMode.FAIL #1208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 4, 2025

Conversation

mikepenz
Copy link
Owner

@mikepenz mikepenz commented Jul 1, 2025

mikepenz added 3 commits July 1, 2025 20:23
…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
@mikepenz mikepenz requested a review from Copilot July 1, 2025 18:48
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 requireLicense flag and wire it into task inputs
  • Enhance AboutLibrariesTask to 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 requireLicense is true: ensure libraries with no license trigger the correct warning or failure under different strictMode settings.
            val librariesWithoutLicense = if (requireLicense.get()) libraries.filter { it.licenses.isEmpty() } else emptyList()

MIGRATION.md:3

  • [nitpick] Add a note about the new requireLicense flag under library {} 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 block parameter 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(

@@ -37,6 +37,9 @@ abstract class BaseAboutLibrariesTask : DefaultTask() {
@get:Input
abstract val variant: Property<String?>

@Input
Copy link
Preview

Copilot AI Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gradle task input properties in Kotlin need the annotation on the getter (@get:Input), otherwise this property won’t be recognized as an input.

Suggested change
@Input
@get:Input

Copilot uses AI. Check for mistakes.

@mikepenz mikepenz merged commit fdc1f52 into develop Jul 4, 2025
3 checks passed
@mikepenz mikepenz deleted the feature/1204 branch July 4, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

strict mode set to FAIL doesn't fail if no licenses are allowed
1 participant