Skip to content
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

[Discussion] Advice for using the license gather plugin in a multi-module project. #53

Open
bric3 opened this issue Nov 2, 2022 · 3 comments

Comments

@bric3
Copy link

bric3 commented Nov 2, 2022

I'm working on a project that is split across sub-modules, some of these modules had plugins that adds dependencies (that are part of a platform).

I would like to report only the dependencies that I'm actually declaring (and of course their dependencies). However the setup indicates the task has to be configured for each modules (It'd be nice if the plugin could do this automatically).

Also, is there a way to merge the reports (metadata) ?

@vlsi
Copy link
Owner

vlsi commented Nov 2, 2022

Technically speaking, MetadataStore.load(folders: Iterable<File>) loads and merges multiple files.
You could register VerifyLicenseCompatibilityTask task and configure VerifyLicenseCompatibilityTask.metadata file collection with several files, so the verification task should combine the information.
Have you tried it?

However the setup indicates the task has to be configured for each modules

That sounds like a convention plugin to me.

In other words, something like

plugins {
  id("com.github.vlsi.license-gather.verify")
}

// registers verification tasks for common types of projects.
// For instance, in case of java-library, and java-application it could verify runtimeClasspath
// there might be an extension for handing known cases
// For example
licenseVerifications {
    allow(SpdxLicense.EPL_2_0) {
        // The message would be displayed, so the verification results are easier to understand
        because("ISSUE-23: EPL-2.0 is fine in our projects")
    }
    allow(new SimpleLicense("The W3C License", uri("http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/java-binding.zip"))) {
        because("ISSUE-42: John Smith decided the license is OK")
    }
    // License category
    // See https://www.apache.org/legal/resolved.html
    allow(AsfLicenseCategory.A) {
        because("The ASF category A is allowed")
    }
    reject(AsfLicenseCategory.X) {
        because("The ASF category X is forbidden")
    }
}

WDYT?

@bric3
Copy link
Author

bric3 commented Nov 3, 2022

Technically speaking, MetadataStore.load(folders: Iterable<File>) loads and merges multiple files.
You could register VerifyLicenseCompatibilityTask task and configure VerifyLicenseCompatibilityTask.metadata file collection with several files, so the verification task should combine the information.
Have you tried it?

I'll give it a try when I have access to my laptop.

However the setup indicates the task has to be configured for each modules

That sounds like a convention plugin to me.

That's indeed a possibility, but it requires to setup the project this way (with plugin conventions). But I saw some plugins that do most of this stuff automatically like io.cloudflight.license-gradle-plugin , which somehow pushed me to to discuss about multi-module.

@vlsi
Copy link
Owner

vlsi commented Nov 3, 2022

I mean I could release both com.github.vlsi.license-gather.base and com.github.vlsi.license-gather.verify plugins.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants