Stefano Zanella
08/16/2024, 8:36 PM// plugin
val declarable = project.configurations.dependencyScope("pythonScope") {
it.attributes {
it.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "python"))
}
}
val consumable = project.configurations.consumable("pythonConsumable") {
it.attributes {
it.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "python"))
}
}
val resolvable = project.configurations.resolvable("pythonResolvable") {
it.extendsFrom(declarable.get())
it.attributes {
it.attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, "python"))
}
}
// producer project
artifacts {
add("pythonConsumable", pythonPackage) {
builtBy(buildPythonPackage)
}
}
// consumer project
dependencies {
pythonScope(projects.grpc.stub.python)
}
...
// within the `testResolution` task
val res = project.configurations.getByName("pythonResolvable")
res2.resolvedConfiguration.resolvedArtifacts.forEach {
println(it.file.path)
println(it.file.isFile)
}
I can run buildPythonPackage and "testResolution" tasks and everything works, but from a clean build, if I only invoke "testResolution", buildPythonPackage is not invoked.
Am I missing something, or why is not the package being built since it's been explicitly declared which task generates the artifact?Philip W
08/16/2024, 8:52 PMJustin Van Dort
08/16/2024, 8:58 PMJustin Van Dort
08/16/2024, 8:59 PMStefano Zanella
08/16/2024, 9:04 PMPhilip W
08/16/2024, 9:07 PMStefano Zanella
08/16/2024, 9:08 PMStefano Zanella
08/16/2024, 9:09 PMPhilip W
08/16/2024, 10:06 PMStefano Zanella
08/17/2024, 11:05 AMPhilip W
08/17/2024, 12:13 PMStefano Zanella
08/17/2024, 12:20 PMPhilip W
08/17/2024, 12:23 PMval sapCIFlowEntrypoints = configurations.resolvable("sapCIFlowEntrypoints") {
extendsFrom(configurations.named("sapCIInfrastructure").get()) // dependencyScope
attributes {
attribute(SAPCI.attribute, objects.named(SAPCI.jsonEntrypoints))
}
}
val generateKtorServerApi by tasks.registering(GenerateKtorServerAPI::class) {
this.entrypoints.from(sapCIFlowEntrypoints)
this.apis.from(configurations.named("sapCIInfrastructureApi"))
workerClasspath.from(configurations.named("ktorClientWorkerClasspath"))
}
and:
@CacheableTask
abstract class GenerateKtorServerAPI : DefaultTask() {
init {
group = "sapci"
}
@get:InputFiles
@get:SkipWhenEmpty
@get:IgnoreEmptyDirectories
@get:NormalizeLineEndings
@get:PathSensitive(PathSensitivity.NONE)
public abstract val apis: ConfigurableFileCollectionStefano Zanella
08/17/2024, 12:25 PMStefano Zanella
08/17/2024, 8:55 PM