Skip to content

Add feature to enforce license availability for libraries#1196

Merged
mikepenz merged 2 commits intodevelopfrom
feature/1190
Jul 4, 2025
Merged

Add feature to enforce license availability for libraries#1196
mikepenz merged 2 commits intodevelopfrom
feature/1190

Conversation

@mikepenz
Copy link
Owner

@mikepenz mikepenz requested a review from Copilot June 10, 2025 21:41
Copy link
Contributor

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

Adds a new requireLicense flag to fail or warn the build on libraries missing license data and splits out an Android‐specific Gradle plugin.

  • Introduce requireLicense DSL and task input to enforce license presence
  • Update AboutLibrariesTask to log or fail when licenses are missing
  • Split Android task registration into a separate plugin and update migration docs

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/BaseAboutLibrariesTask.kt Add requireLicense task input
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt Enforce and log missing licenses based on requireLicense
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesPluginAndroidExtension.kt Refactor Android task registration to use a configurable block
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesPluginAndroid.kt New Android Gradle plugin implementation
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesPlugin.kt Remove legacy Android registration
plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesExtension.kt Add requireLicense property and deprecations
plugin-build/plugin/build.gradle.kts Register the new Android plugin artifact
app/build.gradle.kts Apply aboutlibraries.plugin.android and drop deprecated DSL
app-test/build.gradle.kts Remove obsolete Android DSL block
MIGRATION.md Document v13.0.0 plugin split and new plugin id
Comments suppressed due to low confidence (2)

plugin-build/plugin/src/main/kotlin/com/mikepenz/aboutlibraries/plugin/AboutLibrariesTask.kt:127

  • There are no tests covering the new requireLicense behavior. Consider adding unit tests for both warn and fail modes when libraries have no license.
val librariesWithoutLicense = if (requireLicense.get()) libraries.filter { it.licenses.isEmpty() } else emptyList()

MIGRATION.md:3

  • Add a note that aboutLibraries { android { ... } } blocks should be removed or replaced when upgrading, since registerAndroidTasks is now a no-op.
#### v13.0.0

@get:Input
abstract val variant: Property<String?>

@Input
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

Use @get:Input instead of @Input on the Kotlin property so that Gradle correctly recognizes requireLicense as an up-to-date input.

Suggested change
@Input
@get:Input

Copilot uses AI. Check for mistakes.
internal fun configureAndroidTasks(
project: Project,
extension: AboutLibrariesExtension,
block: (Project, AboutLibrariesExtension, @Suppress("DEPRECATION") com.android.build.gradle.api.BaseVariant) -> Unit = ::configureAndroidTasks,
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

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

The default block references configureAndroidTasks itself, leading to infinite recursion; it should reference the Android‐specific configureAndroidResourceTasks handler instead.

Suggested change
block: (Project, AboutLibrariesExtension, @Suppress("DEPRECATION") com.android.build.gradle.api.BaseVariant) -> Unit = ::configureAndroidTasks,
block: (Project, AboutLibrariesExtension, @Suppress("DEPRECATION") com.android.build.gradle.api.BaseVariant) -> Unit = ::configureAndroidResourceTasks,

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

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

This is not correct. it references the equally named function further down in the file.

@mikepenz mikepenz force-pushed the feature/1190 branch 2 times, most recently from eb70340 to c671ff3 Compare June 15, 2025 07:03
mikepenz added 2 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 merged commit bdfa959 into develop Jul 4, 2025
3 checks passed
@mikepenz mikepenz deleted the feature/1190 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.

Is there a way to fail build if a dependency has unspecified license?

2 participants