Extract dependency setting into a separate method
This commit is contained in:
committed by
Pavel Punegov
parent
f68a0bfd69
commit
98d7877297
@@ -362,10 +362,7 @@ Task linkTest(String name, Closure<KonanLinkTest> configureClosure) {
|
|||||||
extraOpts task.flags
|
extraOpts task.flags
|
||||||
extraOpts project.globalTestArgs
|
extraOpts project.globalTestArgs
|
||||||
}
|
}
|
||||||
String libTaskName = "compileKonan${lib.capitalize()}${targetName.capitalize()}"
|
UtilsKt.dependOnKonanBuildingTask(project, lib, target, task)
|
||||||
UtilsKt.dependsOnDist(project, libTaskName)
|
|
||||||
UtilsKt.sameDependenciesAs(libTaskName, task as KonanLinkTest)
|
|
||||||
task.dependsOn(libTaskName)
|
|
||||||
|
|
||||||
// Build an executable with library
|
// Build an executable with library
|
||||||
program(name, targets: [targetName]) {
|
program(name, targets: [targetName]) {
|
||||||
@@ -376,8 +373,6 @@ Task linkTest(String name, Closure<KonanLinkTest> configureClosure) {
|
|||||||
srcFiles task.getSources()
|
srcFiles task.getSources()
|
||||||
extraOpts task.flags
|
extraOpts task.flags
|
||||||
extraOpts project.globalTestArgs
|
extraOpts project.globalTestArgs
|
||||||
// depend on library build task
|
|
||||||
dependsOn libTaskName
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3394,10 +3389,7 @@ Task interopTest(String name, Closure<KonanInteropTest> configureClosure) {
|
|||||||
if (task.enabled) {
|
if (task.enabled) {
|
||||||
konanArtifacts {
|
konanArtifacts {
|
||||||
def lib = task.interop
|
def lib = task.interop
|
||||||
def libTask = "compileKonan${lib.capitalize()}${target.name.capitalize()}"
|
UtilsKt.dependOnKonanBuildingTask(project, lib, target, task)
|
||||||
UtilsKt.dependsOnDist(project, libTask)
|
|
||||||
UtilsKt.sameDependenciesAs(libTask, task as KonanInteropTest)
|
|
||||||
task.dependsOn(libTask)
|
|
||||||
|
|
||||||
program(name, targets: [target.name]) {
|
program(name, targets: [target.name]) {
|
||||||
libraries {
|
libraries {
|
||||||
@@ -3901,12 +3893,7 @@ if (isAppleTarget(project)) {
|
|||||||
|
|
||||||
konanArtifacts {
|
konanArtifacts {
|
||||||
def lib = "objcGh3343"
|
def lib = "objcGh3343"
|
||||||
def libTask = "compileKonan${lib.capitalize()}${target.name.capitalize()}"
|
UtilsKt.dependOnKonanBuildingTask(project, lib, target, mainTask)
|
||||||
UtilsKt.dependsOnDist(project, libTask)
|
|
||||||
UtilsKt.sameDependenciesAs(libTask, mainTask)
|
|
||||||
mainTask.dependsOn(libTask)
|
|
||||||
|
|
||||||
def lnOpts = (project.tasks.getByName(libTask)).linkerOpts
|
|
||||||
|
|
||||||
framework(frameworkName, targets: [ target ]) {
|
framework(frameworkName, targets: [ target ]) {
|
||||||
libraries {
|
libraries {
|
||||||
@@ -3919,7 +3906,7 @@ if (isAppleTarget(project)) {
|
|||||||
dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler'
|
dependsOn ":${target}CrossDistRuntime", ':commonDistRuntime', ':distCompiler'
|
||||||
}
|
}
|
||||||
|
|
||||||
linkerOpts lnOpts
|
linkerOpts "-L$buildDir"
|
||||||
extraOpts "-Xembed-bitcode-marker"
|
extraOpts "-Xembed-bitcode-marker"
|
||||||
extraOpts project.globalTestArgs
|
extraOpts project.globalTestArgs
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,6 +125,17 @@ fun Task.sameDependenciesAs(task: Task) {
|
|||||||
this.dependsOn(dependencies)
|
this.dependsOn(dependencies)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set dependency on [lib] built by the Konan Plugin for the [task],
|
||||||
|
* also make [lib] depend on `dist` and all dependencies of the [task] to make [lib] execute before the [task].
|
||||||
|
*/
|
||||||
|
fun Project.dependOnKonanBuildingTask(lib: String, target: KonanTarget, task: Task) {
|
||||||
|
val libTask = "compileKonan${lib.capitalize()}${target.name.capitalize()}"
|
||||||
|
this.dependsOnDist(libTask)
|
||||||
|
libTask.sameDependenciesAs(task)
|
||||||
|
task.dependsOn(libTask)
|
||||||
|
}
|
||||||
|
|
||||||
//endregion
|
//endregion
|
||||||
// Run command line from string.
|
// Run command line from string.
|
||||||
fun Array<String>.runCommand(workingDir: File = File("."),
|
fun Array<String>.runCommand(workingDir: File = File("."),
|
||||||
|
|||||||
Reference in New Issue
Block a user