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() {
private val platformManager = project.extensions.getByType<PlatformManager>()
@get:Input
val platformManager = project.extensions.getByType<PlatformManager>()
/**
* Target for which to compile.
@@ -212,8 +213,8 @@ abstract class CompileToExecutable : DefaultTask() {
@get:Input
abstract val linkerArgs: ListProperty<String>
@get:Input
protected val linkCommands: Provider<List<List<String>>> = project.provider {
@Internal
fun linkCommands(): List<List<String>> =
// 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.
platformManager.platform(target.get()).linker.finalLinkCommands(
@@ -228,7 +229,6 @@ abstract class CompileToExecutable : DefaultTask() {
mimallocEnabled = mimallocEnabled.get(),
sanitizer = sanitizer.orNull
).map { it.argsWithExecutable }
}
@get:Inject
protected abstract val workerExecutor: WorkerExecutor
@@ -253,7 +253,7 @@ abstract class CompileToExecutable : DefaultTask() {
outputFile.set(this@CompileToExecutable.outputFile)
targetName.set(this@CompileToExecutable.target.get().name)
clangFlags.addAll(defaultClangFlags + compilerArgs.get() + sanitizerFlags)
linkCommands.set(this@CompileToExecutable.linkCommands)
linkCommands.set(this@CompileToExecutable.linkCommands())
platformManager.set(this@CompileToExecutable.platformManager)
}
}