Fix CompileToExecutable CC issues

Required for KTI-1553
This commit is contained in:
cristiangarcia
2024-03-12 14:54:39 +01:00
committed by Space Team
parent 7693d9b9c4
commit 987f67e312
@@ -139,7 +139,8 @@ private abstract class CompileToExecutableJob : WorkAction<CompileToExecutableJo
*/ */
abstract class CompileToExecutable : DefaultTask() { abstract class CompileToExecutable : DefaultTask() {
private val platformManager = project.extensions.getByType<PlatformManager>() @get:Input
val platformManager = project.extensions.getByType<PlatformManager>()
/** /**
* Target for which to compile. * Target for which to compile.
@@ -212,23 +213,22 @@ abstract class CompileToExecutable : DefaultTask() {
@get:Input @get:Input
abstract val linkerArgs: ListProperty<String> abstract val linkerArgs: ListProperty<String>
@get:Input @Internal
protected val linkCommands: Provider<List<List<String>>> = project.provider { fun linkCommands(): List<List<String>> =
// Getting link commands requires presence of a target toolchain. // Getting link commands requires presence of a target toolchain.
// Thus we cannot get them at the configuration stage because the toolchain may be not downloaded yet. // Thus we cannot get them at the configuration stage because the toolchain may be not downloaded yet.
platformManager.platform(target.get()).linker.finalLinkCommands( platformManager.platform(target.get()).linker.finalLinkCommands(
listOf(compilerOutputFile.asFile.get().absolutePath), listOf(compilerOutputFile.asFile.get().absolutePath),
outputFile.asFile.get().absolutePath, outputFile.asFile.get().absolutePath,
listOf(), listOf(),
linkerArgs.get(), linkerArgs.get(),
optimize = false, optimize = false,
debug = true, debug = true,
kind = LinkerOutputKind.EXECUTABLE, kind = LinkerOutputKind.EXECUTABLE,
outputDsymBundle = outputFile.asFile.get().absolutePath + ".dSYM", outputDsymBundle = outputFile.asFile.get().absolutePath + ".dSYM",
mimallocEnabled = mimallocEnabled.get(), mimallocEnabled = mimallocEnabled.get(),
sanitizer = sanitizer.orNull sanitizer = sanitizer.orNull
).map { it.argsWithExecutable } ).map { it.argsWithExecutable }
}
@get:Inject @get:Inject
protected abstract val workerExecutor: WorkerExecutor protected abstract val workerExecutor: WorkerExecutor
@@ -253,7 +253,7 @@ abstract class CompileToExecutable : DefaultTask() {
outputFile.set(this@CompileToExecutable.outputFile) outputFile.set(this@CompileToExecutable.outputFile)
targetName.set(this@CompileToExecutable.target.get().name) targetName.set(this@CompileToExecutable.target.get().name)
clangFlags.addAll(defaultClangFlags + compilerArgs.get() + sanitizerFlags) clangFlags.addAll(defaultClangFlags + compilerArgs.get() + sanitizerFlags)
linkCommands.set(this@CompileToExecutable.linkCommands) linkCommands.set(this@CompileToExecutable.linkCommands())
platformManager.set(this@CompileToExecutable.platformManager) platformManager.set(this@CompileToExecutable.platformManager)
} }
} }