Filter duplicated dependency link options
This commit is contained in:
committed by
Pavel Punegov
parent
d5a6c33b20
commit
aa659475f1
@@ -505,13 +505,14 @@ fun runTest() {
|
|||||||
List<TestModule> orderedModules = DFS.INSTANCE.topologicalOrder(modules.values()) { module ->
|
List<TestModule> orderedModules = DFS.INSTANCE.topologicalOrder(modules.values()) { module ->
|
||||||
module.dependencies.collect { modules[it] }.findAll { it != null }
|
module.dependencies.collect { modules[it] }.findAll { it != null }
|
||||||
}
|
}
|
||||||
def libsFlags = []
|
Set<String> libs = new HashSet<String>()
|
||||||
orderedModules.reverse().each { module ->
|
orderedModules.reverse().each { module ->
|
||||||
if (!module.isDefaultModule()) {
|
if (!module.isDefaultModule()) {
|
||||||
def klibModulePath = "${executablePath()}.${module.name}.klib"
|
def klibModulePath = "${executablePath()}.${module.name}.klib"
|
||||||
libsFlags += module.linkDependencies(executablePath())
|
libs.addAll(module.dependencies)
|
||||||
runCompiler(compileList.findAll { it.module == module }.collect { it.path },
|
runCompiler(compileList.findAll { it.module == module }.collect { it.path },
|
||||||
klibModulePath, flags + ["-p", "library"] + libsFlags)
|
klibModulePath, flags + ["-p", "library"] +
|
||||||
|
libs.collectMany { ["-l", "${executablePath()}.${it}.klib"] }.toList())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,9 +520,10 @@ fun runTest() {
|
|||||||
it.module.isDefaultModule() || it.module == TestModule.support
|
it.module.isDefaultModule() || it.module == TestModule.support
|
||||||
}
|
}
|
||||||
compileMain.forEach { f ->
|
compileMain.forEach { f ->
|
||||||
libsFlags.addAll(f.module.linkDependencies(executablePath()))
|
libs.addAll(f.module.dependencies)
|
||||||
}
|
}
|
||||||
if (!compileMain.empty) runCompiler(compileMain.collect { it.path }, executablePath(), flags + libsFlags)
|
if (!compileMain.empty) runCompiler(compileMain.collect { it.path }, executablePath(),
|
||||||
|
flags + libs.collectMany { ["-l", "${executablePath()}.${it}.klib"] }.toList())
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
project.logger.quiet("ERROR: Compilation failed for test suite: $name with exception", ex)
|
project.logger.quiet("ERROR: Compilation failed for test suite: $name with exception", ex)
|
||||||
|
|||||||
@@ -88,9 +88,6 @@ data class TestModule(
|
|||||||
) {
|
) {
|
||||||
fun isDefaultModule() = this == default || name.endsWith(".main")
|
fun isDefaultModule() = this == default || name.endsWith(".main")
|
||||||
|
|
||||||
fun linkDependencies(outputPath: String): List<String> =
|
|
||||||
dependencies.flatMap { listOf("-l", "$outputPath.$it.klib") }
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
val default = TestModule("default", emptyList(), emptyList())
|
val default = TestModule("default", emptyList(), emptyList())
|
||||||
val support = TestModule("support", emptyList(), emptyList())
|
val support = TestModule("support", emptyList(), emptyList())
|
||||||
|
|||||||
Reference in New Issue
Block a user