Giter Site home page Giter Site logo

Add license check about vlsi-release-plugins HOT 9 CLOSED

vlsi avatar vlsi commented on June 11, 2024
Add license check

from vlsi-release-plugins.

Comments (9)

DreierF avatar DreierF commented on June 11, 2024 1

Thanks for the quick response!
I tried to dig into it, but I have to admit I didn't understand yet how all the pieces fit together and won't have the time in the near future to continue working on it.

from vlsi-release-plugins.

vlsi avatar vlsi commented on June 11, 2024

Hi,

I think it makes sense. Historically, the only license classification I saw was https://www.apache.org/legal/resolved.html (which was basically the only motivation for the plugin itself).

So I have

val licenseInterpreter = Apache2LicenseInterpreter()
licenseInterpreter.licenseCategory.putAll(licenseCategory.get())
dependencies
.map {
it.key to it.value.license
}
.groupByTo(TreeMap()) { (_, license) ->
licenseInterpreter.eval(license)
}
.filterKeys { it !in allowedTypes }
.forEach { (category, dependencies) ->
val header =
"Dependencies of license category $category are not allowed for $artifactType artifacts"
and https://github.com/vlsi/vlsi-release-plugins/blob/acaadb520a8ca9bc8e06403de97f8798c008a977/plugins/stage-vote-release-plugin/src/main/kotlin/com/github/vlsi/gradle/release/Apache2LicenseInterpreter.kt

Splitting "verify license" from Apache2LicenseRenderer into a separate task sounds like the right thing to do.

from vlsi-release-plugins.

vlsi avatar vlsi commented on June 11, 2024

Do you think you could prepare a PR for a "check license compatibility" or "verify license compatibility" (I'm not sure regarding the naming) task in license-gather-plugin?

from vlsi-release-plugins.

vlsi avatar vlsi commented on June 11, 2024

By the way, do you have a use-case (a github project?) for this "license check"?

from vlsi-release-plugins.

DreierF avatar DreierF commented on June 11, 2024

I have a use-case, but the project I'm working on is not open source unfortunately.

from vlsi-release-plugins.

vlsi avatar vlsi commented on June 11, 2024

I see. Do you have a reference for the known compatible licenses? Are you going to add "allowed" licenses one by one?

For instance, the ASF has three license categories: A (allowed in source form), B (allowed only in binary artifacts), and X (forbidden everywhere).

So one of the configurations could be:

val gatherLicenes by tasks.registering(GatherLicenseTask::class) {
    configuration(configurations.runtimeClasspath)
    // configure license overrides, etc
}

val verifyLicenseCompatibility by tasks.register(VerifyLicenseCompatibilityTask::class) {
    metadata.set(gatherLicenes) // <-- "metadata" could probably have a better naming
    allow(AsfLicenseCategory.A)
}

from vlsi-release-plugins.

DreierF avatar DreierF commented on June 11, 2024

Allowing whole categories would be a nice usability helper, but in the general case I think we would also need the ability to allow licenses one by one as well as custom named licenses (e.g. jgit which is detected as Eclipse Distribution License (New BSD License))

from vlsi-release-plugins.

vlsi avatar vlsi commented on June 11, 2024

I think behind the lines of VerifyLicenseCompatibilityTask below, so adding "non-standard" would be like

allow(
    SimpleLicense(
        "Java HTML Tidy License",
        uri("http://jtidy.svn.sourceforge.net/viewvc/jtidy/trunk/jtidy/LICENSE.txt?revision=95")
    )
)
class VerifyLicenseCompatibilityTask : DefaultTask() {
    /**
     * This is a file collected by [GatherLicenseTask].
     */
    @InputFiles
    val metadata = objectFactory.fileCollection()

    @Input
    val acceptableLicenses = objectFactory.setProperty<LicenseExpression>()

    /**
     * Outputs `OK` when verification is successful.
     */
    @OutputFile
    val resultFile = objectFactory.fileProperty()

    fun allow(license: License) {
        acceptableLicenses.add(license.asExpression())
    }

    fun allow(license: Set<License>) { // or vararg?
        acceptableLicenses.add(license.asExpression())
    }

    fun allow(licenseExpression: LicenseExpression) {
        acceptableLicenses.add(licenseExpression)
    }

    fun allow(licenseExpression: Set<LicenseExpression>) { // or vararg?
        acceptableLicenses.add(licenseExpression)
    }
...

from vlsi-release-plugins.

DreierF avatar DreierF commented on June 11, 2024

Sounds good 🙂
Thank you very much for pushing that idea forward!

from vlsi-release-plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.