Vaios Tsitsonis
11/01/2021, 5:44 PMevant
11/01/2021, 5:51 PMval otherTask = ...
tasks.withType<com.google.devtools.ksp.gradle.KspTask>().all {
apOptions.put("myKey", otherTask.output)
}
Vaios Tsitsonis
11/01/2021, 6:04 PMenvironment.options
returns an empty map, so SymbolProcessor
does not get this option :Sevant
11/01/2021, 6:10 PMProperty
? If not you'll need to explicitly add the task dependency tooVaios Tsitsonis
11/01/2021, 6:22 PMtasks.withType<com.google.devtools.ksp.gradle.KspTask>().all {
apOptions.put("myKey", "someDummyValue")
}
evant
11/01/2021, 7:05 PMfun configureAsKspTask(kspTask: KspTask, isIncremental: Boolean) {
// depends on the processor; if the processor changes, it needs to be reprocessed.
val processorClasspath = project.configurations.maybeCreate("${kspTaskName}ProcessorClasspath")
.extendsFrom(*nonEmptyKspConfigurations.toTypedArray())
kspTask.processorClasspath.from(processorClasspath)
kspTask.dependsOn(processorClasspath.buildDependencies)
kspTask.options.addAll(
kspTask.project.provider {
getSubpluginOptions(
project,
kspExtension,
processorClasspath,
sourceSetName,
isIncremental,
kspExtension.allWarningsAsErrors
)
}
)
kspTask.destination = kspOutputDir
kspTask.blockOtherCompilerPlugins = kspExtension.blockOtherCompilerPlugins
kspTask.apOptions.value(kspExtension.arguments).disallowChanges()
kspTask.kspCacheDir.fileValue(getKspCachesDir(project, sourceSetName)).disallowChanges()
if (kspExtension.blockOtherCompilerPlugins) {
// FIXME: ask upstream to provide an API to make this not implementation-dependent.
val cfg = project.configurations.getByName(kotlinCompilation.pluginConfigurationName)
kspTask.overridePluginClasspath.value(
kspTask.project.provider {
val dep = cfg.dependencies.single { it.name == KSP_ARTIFACT_NAME }
cfg.fileCollection(dep)
}
)
}
kspTask.isKspIncremental = isIncremental
}
may be worth opening an issue about thisevant
11/01/2021, 7:08 PMMapProperty
and then you could configure it like
ksp {
arg("myKey", myTask.output)
}
Vaios Tsitsonis
11/01/2021, 7:28 PMproject.extra
I do not know if it is the best/recommended way though...