Only llvm-link generated files in CompileToBitcode (#4536)
This commit is contained in:
committed by
Stanislav Erokhin
parent
f9810d86dd
commit
6cb8b0c18a
+10
-12
@@ -43,9 +43,6 @@ open class CompileToBitcode @Inject constructor(
|
||||
var srcDirs: FileCollection = project.files(srcRoot.resolve("cpp"))
|
||||
var headersDirs: FileCollection = project.files(srcRoot.resolve("headers"))
|
||||
|
||||
@Input
|
||||
var skipLinkagePhase = false
|
||||
|
||||
@Input
|
||||
var language = Language.CPP
|
||||
|
||||
@@ -92,6 +89,9 @@ open class CompileToBitcode @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun outputFileForInputFile(file: File, extension: String) = objDir.resolve("${file.nameWithoutExtension}.${extension}")
|
||||
private fun bitcodeFileForInputFile(file: File) = outputFileForInputFile(file, "bc")
|
||||
|
||||
@get:InputFiles
|
||||
protected val headers: Iterable<File>
|
||||
get() {
|
||||
@@ -142,15 +142,13 @@ open class CompileToBitcode @Inject constructor(
|
||||
it.args = compilerFlags + inputFiles.map { it.absolutePath }
|
||||
}
|
||||
|
||||
if (!skipLinkagePhase) {
|
||||
project.exec {
|
||||
val llvmDir = project.findProperty("llvmDir")
|
||||
it.executable = "$llvmDir/bin/llvm-link"
|
||||
it.args = listOf("-o", outFile.absolutePath) + linkerArgs +
|
||||
project.fileTree(objDir) {
|
||||
it.include("**/*.bc")
|
||||
}.files.map { it.absolutePath }
|
||||
}
|
||||
project.exec {
|
||||
val llvmDir = project.findProperty("llvmDir")
|
||||
it.executable = "$llvmDir/bin/llvm-link"
|
||||
it.args = listOf("-o", outFile.absolutePath) + linkerArgs +
|
||||
inputFiles.map {
|
||||
bitcodeFileForInputFile(it).absolutePath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user