ClangFrontend: notCompatibleWithConfigurationCache because GoogleTests are downloaded later

Required for KTI-1553
This commit is contained in:
cristiangarcia
2024-03-11 16:17:03 +01:00
committed by Space Team
parent 8f1f6ca9c9
commit bfbdf79207
@@ -240,13 +240,12 @@ open class CompileToBitcodeExtension @Inject constructor(val project: Project) :
} }
compilationDatabase.target(_target) { compilationDatabase.target(_target) {
entry { entry {
val compileTask = this@apply.get() val compileTask: TaskProvider<ClangFrontend> = this@apply
val args = listOf(execClang.resolveExecutable(compileTask.compiler.get())) + compileTask.compilerFlags.get() + execClang.clangArgsForCppRuntime(target.name) directory.set(compileTask.flatMap { it.workingDirectory })
directory.set(compileTask.workingDirectory) files.setFrom(compileTask.map { it.inputFiles })
files.setFrom(compileTask.inputFiles) arguments.set(compileTask.map { listOf(execClang.resolveExecutable(it.compiler.get())) + it.compilerFlags.get() + execClang.clangArgsForCppRuntime(target.name) })
arguments.set(args)
// Only the location of output file matters, compdb does not depend on the compilation result. // Only the location of output file matters, compdb does not depend on the compilation result.
output.set(compileTask.outputDirectory.locationOnly.map { it.asFile.absolutePath }) output.set(compileTask.flatMap { it.outputDirectory.locationOnly.map { it.asFile.absolutePath }})
} }
task.configure { task.configure {
// Compile task depends on the toolchain (including headers) and on the source code (e.g. googletest). // Compile task depends on the toolchain (including headers) and on the source code (e.g. googletest).
@@ -264,6 +263,7 @@ open class CompileToBitcodeExtension @Inject constructor(val project: Project) :
*/ */
val task = project.tasks.register<LlvmLink>("llvmLink${module.name.capitalized}${name.capitalized}${_target.toString().capitalized}").apply { val task = project.tasks.register<LlvmLink>("llvmLink${module.name.capitalized}${name.capitalized}${_target.toString().capitalized}").apply {
configure { configure {
notCompatibleWithConfigurationCache("When GoogleTest are not downloaded llvm-link is missing arguments")
this.description = "Link '${module.name}' bitcode files (${this@SourceSet.name} sources) into a single bitcode file for $_target" this.description = "Link '${module.name}' bitcode files (${this@SourceSet.name} sources) into a single bitcode file for $_target"
this.inputFiles.from(compileTask) this.inputFiles.from(compileTask)
this.outputFile.set(this@SourceSet.outputFile) this.outputFile.set(this@SourceSet.outputFile)