cashapp / licensee

Gradle plugin which validates the licenses of your dependency graph match what you expect
https://cashapp.github.io/licensee/docs/1.x/
Apache License 2.0
614 stars 28 forks source link

allowDependency(gav): add depencency provider overload #202

Closed hfhbd closed 1 year ago

hfhbd commented 1 year ago

Currently, you need to specify the gav twice, once in your dependencies and again in the allowDependency call:

// build.gradle.kts
dependencies {
    api("com.ibm.db2:jcc:11.5.8.0")
}

licensee {
    allowDependency("com.ibm.db2", "jcc", "11.5.8.0") {
        because("License available")
    }
}

While migrating to the libs version catalog, using this depency provider would be nice too:

// build.gradle.kts
dependencies {
    api(libs.db2.driver)
}

licensee {
    allowDependency(libs.db2.driver) {
        because("License available")
    }
}

I will create a PR today/tomorrow if you want this too.

JakeWharton commented 1 year ago

Sounds good to me.

Let's make sure we test catalog entries which do and do not contain a version.

JakeWharton commented 1 year ago

BTW I have successfully tested the latest version internally. I was going to release today, but I'll wait for this to land and then release immediately after.

hfhbd commented 1 year ago

Let's make sure we test catalog entries which do and do not contain a version.

What do you expect if the entry does not contain a version? I would expect an error.

JakeWharton commented 1 year ago

Yep, same. Just want to make sure we cover it as I suspect calling getVersion() (or whatever) will return an empty string.