tests: Support custom konan.home for platform lib tests
* Move testLibrary tasks from klib into backend.native/tests * Support konan.home property in them
This commit is contained in:
@@ -62,6 +62,36 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def konanHome = rootProject.file(project.findProperty("konan.home") ?: distDir).absolutePath
|
||||||
|
def suffix = isWindows() ? ".bat" : ""
|
||||||
|
|
||||||
|
// TODO: Ideally we want to write just konanArtifacts{} clause here,
|
||||||
|
// but we need to make Kotlin/Native Gradle Plugin a dependence
|
||||||
|
// of our buildScripts first.
|
||||||
|
task compileKonanTestLibrary(type: Exec) {
|
||||||
|
if (!project.hasProperty("konan.home")) {
|
||||||
|
dependsOn ':dist'
|
||||||
|
}
|
||||||
|
|
||||||
|
def compiler = "$konanHome/bin/konanc$suffix"
|
||||||
|
def source = 'testLibrary'
|
||||||
|
def artifact = 'build/konan/bin/testLibrary'
|
||||||
|
|
||||||
|
executable compiler
|
||||||
|
args source, '-o', artifact, '-p', 'library'
|
||||||
|
}
|
||||||
|
|
||||||
|
task installTestLibrary(type: Exec) {
|
||||||
|
dependsOn 'compileKonanTestLibrary'
|
||||||
|
|
||||||
|
def tool = "$konanHome/bin/klib$suffix"
|
||||||
|
def repo = "$konanHome/klib/common"
|
||||||
|
def library = 'build/konan/bin/testLibrary.klib'
|
||||||
|
|
||||||
|
executable tool
|
||||||
|
args 'install', library, '-repository', repo
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: use lastSuccessful teamcity build.
|
// TODO: use lastSuccessful teamcity build.
|
||||||
task update_external_tests() {
|
task update_external_tests() {
|
||||||
doLast {
|
doLast {
|
||||||
@@ -1247,7 +1277,7 @@ task link_testLib_explicitly(type: RunStandaloneKonanTest) {
|
|||||||
// there are no testLibrary for cross targets yet.
|
// there are no testLibrary for cross targets yet.
|
||||||
disabled = (project.testTarget != null && project.testTarget != project.hostName)
|
disabled = (project.testTarget != null && project.testTarget != project.hostName)
|
||||||
|
|
||||||
dependsOn ':klib:installTestLibrary'
|
dependsOn 'installTestLibrary'
|
||||||
goldValue = "This is a side effect of a test library linked into the binary.\nYou should not be seeing this.\n\nHello\n"
|
goldValue = "This is a side effect of a test library linked into the binary.\nYou should not be seeing this.\n\nHello\n"
|
||||||
source = "link/omit/hello.kt"
|
source = "link/omit/hello.kt"
|
||||||
// We force library inclusion, so need to see the warning banner.
|
// We force library inclusion, so need to see the warning banner.
|
||||||
|
|||||||
+1
-30
@@ -23,33 +23,4 @@ apply plugin: 'kotlin'
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
compile project(path: ':backend.native', configuration: 'cli_bc')
|
compile project(path: ':backend.native', configuration: 'cli_bc')
|
||||||
}
|
}
|
||||||
|
|
||||||
def dist = distDir.absolutePath
|
|
||||||
def suffix = isWindows() ? ".bat" : ""
|
|
||||||
|
|
||||||
// TODO: Ideally we want to write just konanArtifacts{} clause here,
|
|
||||||
// but we need to make Kotlin/Native Gradle Plugin a dependence
|
|
||||||
// of our buildScripts first.
|
|
||||||
task compileKonanTestLibrary(type: Exec) {
|
|
||||||
dependsOn ':dist'
|
|
||||||
|
|
||||||
def compiler = "$dist/bin/konanc$suffix"
|
|
||||||
def source = 'src/testLibrary'
|
|
||||||
def artifact = 'build/konan/bin/testLibrary'
|
|
||||||
|
|
||||||
executable compiler
|
|
||||||
args source, '-o', artifact, '-p', 'library'
|
|
||||||
}
|
|
||||||
|
|
||||||
task installTestLibrary(type: Exec) {
|
|
||||||
dependsOn 'compileKonanTestLibrary'
|
|
||||||
|
|
||||||
def tool = "$dist/bin/klib$suffix"
|
|
||||||
def repo = "$dist/klib/common"
|
|
||||||
def library = 'build/konan/bin/testLibrary.klib'
|
|
||||||
|
|
||||||
executable tool
|
|
||||||
args 'install', library, '-repository', repo
|
|
||||||
}
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user