Introduced testLibrary and a test utilizing it.

This commit is contained in:
Alexander Gorshenev
2017-10-19 20:24:31 +03:00
committed by alexander-gorshenev
parent 7ade68452e
commit e2e883ee08
3 changed files with 38 additions and 0 deletions
+9
View File
@@ -1243,6 +1243,15 @@ task link_default_libs(type: RunStandaloneKonanTest) {
source = "link/default/default.kt"
}
task link_testLib_explicitly(type: RunKonanTest) {
dependsOn ':klib:installTestLibrary'
goldValue = "Hello\n"
source = "link/omit/hello.kt"
// We force library inclusion, so need to see the warning banner.
flags = ['-l', 'testLibrary']
}
task no_purge_for_dependencies(type: LinkKonanTest) {
disabled = (project.testTarget == 'wasm32') // there will be no posix.klib for wasm
goldValue = "linked library\nand symbols from posix available: 17; 1.0\n"
+1
View File
@@ -353,6 +353,7 @@ task bundle(type: (isWindows()) ? Zip : Tar) {
from("$project.rootDir/dist") {
include '**'
exclude 'dependencies'
exclude 'klib/testLibrary'
into baseName
}
from(project.rootDir) {
+28
View File
@@ -24,3 +24,31 @@ dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile project(path: ':backend.native', configuration: 'cli_bc')
}
def dist = rootProject.file('dist').absolutePath
// TODO: Ideally we want to write just konanArtifacts{} clouse 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"
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 repo = "$dist/klib/common"
def tool = "$dist/bin/klib"
def library = 'build/konan/bin/testLibrary.klib'
executable tool
args 'install', library, '-repository', repo
}