-
Notifications
You must be signed in to change notification settings - Fork 30
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
Extension: Add providers overload #313
Comments
What would it look like if the collections were exposed directly? Something like licensee {
allowed.add("Apache-2.0")
} ? |
Yes, exposing the collections would be my favorite design too, but what about // kotlin
licensee {
val allowed: SetProperty<SpdxId>
allowed.add(SpdxId.MIT)
val allowedUrls: NamedDomainObjectContainer<AllowedUrl>
allowedUrls.register("https://example.com/license.html") {
it.reason.set("is Apache-2.0")
}
val allowedDependencies: NamedDomainObjectContainer<AllowDependency>
allowedDependencies.register("asdf:asdf:0.0.1") {
it.reason.set("foo")
}
allowedDependency(libs.asdf) { // custom function
it.reason.set("foo")
}
allowedDependency("asdf", "asdf", "0.0.1") { // custom function
it.reason.set("foo")
}
val ignoreDependencies: NamedDomainObjectContainer<IgnoreDependency>
ignoreDependencies.register("asdf:asdf") {
it.reason.set("asdf")
it.transitive.set(true)
}
ignoreDependencies.register("asdf") {
it.reason.set("asdf")
it.transitive.set(true)
}
violationAction.set(ViolationAction.FAIL)
unusedAction.set(UnusedAction.LOG)
} With Groovy, And I also think, if we break api, we could also generate a sealed class at build time: // Auto-generated by Gradle :generateSpdxID from json file
sealed class SpdxId(val id: String, vararg val urls: String) {
data object MIT : SpdxId("MIT", "")
;
companion object {
fun getById(id: String): SpdxId? = when(id) {
"MIT" -> MIT
else -> null
}
fun getByUrl(url: String): SpdxId? = when (url) {
else -> null
}
}
} |
I think that could be a regular enum, which your semicolon leads me to believe you may have also thought of. I'm unsure as to whether we should do a 2.x for this, or just evolve the API over a few versions and slowly deprecate and hide the old things. |
Yes, I did but you can't override I am okay with both. |
Right, makes sense. We can probably just do a single class, though, and |
Use-case:
We want to set the allowed SPDX ids based on another task/file input (from our internal OSS tool), so it should support a provider overload to support CC.
Question: Should we add providers overloads for all possible inputs?
We could switch to
Property
inputs only and also remove the interface/expose the Gradle collections directly . This would be a breaking change but adds the overloads for free (and also allows more use-cases for other users).Adding all overloads manually would keep source compatibility but is annoying.
The text was updated successfully, but these errors were encountered: