[K/N][build] Drop srcRoot from CompileToBitcode
This commit is contained in:
+2
-4
@@ -62,9 +62,7 @@ abstract class CompileToBitcodeJob : WorkAction<CompileToBitcodeParameters> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Get rid of storing srcRoot in the task.
|
|
||||||
abstract class CompileToBitcode @Inject constructor(
|
abstract class CompileToBitcode @Inject constructor(
|
||||||
@Internal val srcRoot: File,
|
|
||||||
@Input val folderName: String,
|
@Input val folderName: String,
|
||||||
@Input val target: String,
|
@Input val target: String,
|
||||||
@Input val outputGroup: String
|
@Input val outputGroup: String
|
||||||
@@ -94,9 +92,9 @@ abstract class CompileToBitcode @Inject constructor(
|
|||||||
|
|
||||||
// Source files and headers are registered as inputs by the `inputFiles` and `headers` properties.
|
// Source files and headers are registered as inputs by the `inputFiles` and `headers` properties.
|
||||||
@Internal
|
@Internal
|
||||||
var srcDirs: FileCollection = project.files(srcRoot.resolve("cpp"))
|
var srcDirs: FileCollection = project.files()
|
||||||
@Internal
|
@Internal
|
||||||
var headersDirs: FileCollection = srcDirs + project.files(srcRoot.resolve("headers"))
|
var headersDirs: FileCollection = project.files()
|
||||||
|
|
||||||
@Input
|
@Input
|
||||||
var language = Language.CPP
|
var language = Language.CPP
|
||||||
|
|||||||
+4
-1
@@ -55,8 +55,11 @@ open class CompileToBitcodeExtension @Inject constructor(val project: Project) {
|
|||||||
project.tasks.register(
|
project.tasks.register(
|
||||||
"${targetName}${name.snakeCaseToCamelCase().capitalize()}${suffixForSanitizer(sanitizer)}",
|
"${targetName}${name.snakeCaseToCamelCase().capitalize()}${suffixForSanitizer(sanitizer)}",
|
||||||
CompileToBitcode::class.java,
|
CompileToBitcode::class.java,
|
||||||
srcRoot, name, targetName, outputGroup
|
name, targetName, outputGroup
|
||||||
).configure {
|
).configure {
|
||||||
|
srcDirs = project.files(srcRoot.resolve("cpp"))
|
||||||
|
headersDirs = srcDirs + project.files(srcRoot.resolve("headers"))
|
||||||
|
|
||||||
this.sanitizer = sanitizer
|
this.sanitizer = sanitizer
|
||||||
group = BasePlugin.BUILD_GROUP
|
group = BasePlugin.BUILD_GROUP
|
||||||
val sanitizerDescription = when (sanitizer) {
|
val sanitizerDescription = when (sanitizer) {
|
||||||
|
|||||||
+3
-2
@@ -241,17 +241,18 @@ private fun createTestTask(
|
|||||||
val task = project.tasks.findByName(name) as? CompileToBitcode ?:
|
val task = project.tasks.findByName(name) as? CompileToBitcode ?:
|
||||||
project.tasks.create(name,
|
project.tasks.create(name,
|
||||||
CompileToBitcode::class.java,
|
CompileToBitcode::class.java,
|
||||||
it.srcRoot,
|
|
||||||
"${it.folderName}Tests",
|
"${it.folderName}Tests",
|
||||||
target, "test"
|
target, "test"
|
||||||
).apply {
|
).apply {
|
||||||
|
srcDirs = it.srcDirs
|
||||||
|
headersDirs = it.headersDirs + googleTestExtension.headersDirs
|
||||||
|
|
||||||
this.sanitizer = sanitizer
|
this.sanitizer = sanitizer
|
||||||
excludeFiles = emptyList()
|
excludeFiles = emptyList()
|
||||||
includeFiles = listOf("**/*Test.cpp", "**/*TestSupport.cpp", "**/*Test.mm", "**/*TestSupport.mm")
|
includeFiles = listOf("**/*Test.cpp", "**/*TestSupport.cpp", "**/*Test.mm", "**/*TestSupport.mm")
|
||||||
dependsOn(it)
|
dependsOn(it)
|
||||||
dependsOn("downloadGoogleTest")
|
dependsOn("downloadGoogleTest")
|
||||||
compilerArgs.addAll(it.compilerArgs)
|
compilerArgs.addAll(it.compilerArgs)
|
||||||
headersDirs += googleTestExtension.headersDirs
|
|
||||||
this.configureCompileToBitcode()
|
this.configureCompileToBitcode()
|
||||||
}
|
}
|
||||||
if (task.inputFiles.count() == 0)
|
if (task.inputFiles.count() == 0)
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ bitcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create("mimalloc") {
|
create("mimalloc") {
|
||||||
|
val srcRoot = file("src/mimalloc")
|
||||||
language = CompileToBitcode.Language.C
|
language = CompileToBitcode.Language.C
|
||||||
includeFiles = listOf("**/*.c")
|
includeFiles = listOf("**/*.c")
|
||||||
excludeFiles += listOf("**/alloc-override*.c", "**/page-queue.c", "**/static.c", "**/bitmap.inc.c")
|
excludeFiles += listOf("**/alloc-override*.c", "**/page-queue.c", "**/static.c", "**/bitmap.inc.c")
|
||||||
@@ -82,6 +83,7 @@ bitcode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
create("libbacktrace") {
|
create("libbacktrace") {
|
||||||
|
val srcRoot = file("src/libbacktrace")
|
||||||
val targetInfo = HostManager().targetByName(target)
|
val targetInfo = HostManager().targetByName(target)
|
||||||
language = CompileToBitcode.Language.C
|
language = CompileToBitcode.Language.C
|
||||||
val useMachO = targetInfo.family.isAppleFamily
|
val useMachO = targetInfo.family.isAppleFamily
|
||||||
|
|||||||
Reference in New Issue
Block a user