Charlie Tapping
04/19/2023, 4:29 PMafterEvaluate {
tasks.named("kspKotlin") {
finalizedBy(copyFeatures)
}
}
I read somewhere whilst learning that finalizedBy happens irrespective of kspKotlin being successful or not, is there an alternative that works only on success? Also is there anyway to avoid the afterEvaluate because I can’t seem to find that task without that block?Adam S
04/19/2023, 4:51 PMkspKotlin
be finaized by copyFeatures
, instead
1. make copyFeatures { dependOn(tasks.kspKotlin) }
2. make a lifecycle task, like assemble
, depend on copyFeatures
That way every time assemble
runs, it will run kspKotlin
and copyFeatures
in the right order.
But… what does copyFeatures
do? Does it copy generated source code into a src dir?Charlie Tapping
04/19/2023, 4:55 PMval copyFeatures by tasks.registering(Copy::class) {
from(file("$rootDir/xxx/build/generated/ksp/main/resources/features-gen.yml"))
rename { "features.yml" }
into(file("$rootDir/.xxx/"))
}
Charlie Tapping
04/19/2023, 4:55 PMAdam S
04/19/2023, 4:56 PMcopyFeatures
task into a ‘file provider’ and use it as a srcDir in a source set, or something, and that makes sorting out task ordering easierCharlie Tapping
04/19/2023, 4:57 PMAdam S
04/19/2023, 4:57 PMCharlie Tapping
04/19/2023, 5:12 PMtasks.named(LifecycleBasePlugin.BUILD_TASK_NAME) {
dependsOn(copyFeatures)
}
Charlie Tapping
04/19/2023, 5:12 PMAdam S
04/19/2023, 5:13 PMCharlie Tapping
04/19/2023, 5:13 PMAdam S
04/19/2023, 5:13 PMVampire
04/19/2023, 5:20 PMCharlie Tapping
04/19/2023, 5:32 PMCharlie Tapping
04/19/2023, 5:32 PMCharlie Tapping
04/19/2023, 5:32 PMVampire
04/19/2023, 5:39 PM-m
and you will see which tasks would get executed.Charlie Tapping
04/19/2023, 6:02 PMCharlie Tapping
04/19/2023, 6:02 PMVampire
04/19/2023, 6:04 PMafterEvaluate
to register the task?
...?
Many possibilites.Vampire
04/19/2023, 6:04 PMtasks.configureEach {
if (name == "kspKotlin") {
finalizedBy(copyFeatures)
}
}
Charlie Tapping
04/19/2023, 6:07 PMVampire
04/19/2023, 6:14 PM