vlsi-release-plugins icon indicating copy to clipboard operation
vlsi-release-plugins copied to clipboard

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

Open bric3 opened this issue 3 years ago • 3 comments

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) ?

bric3 avatar Nov 02 '22 12:11 bric3

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?

vlsi avatar Nov 02 '22 13:11 vlsi

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.

bric3 avatar Nov 03 '22 13:11 bric3

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

vlsi avatar Nov 03 '22 16:11 vlsi