1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
description = 'Kotlin Common Standard Library'
apply plugin: 'kotlin-platform-common'
apply plugin: 'pill-configurable'
configureDist(project)
configurePublishing(project)
def commonSrcDir = "../src"
def commonTestSrcDir = "../test"
pill {
importAsLibrary = true
}
sourceSets {
main {
kotlin {
srcDir 'src'
srcDir commonSrcDir
srcDir '../unsigned/src'
}
}
test {
kotlin {
srcDir commonTestSrcDir
srcDir 'test'
}
}
coroutinesExperimental {
kotlin {
srcDir '../coroutines-experimental/src'
}
}
}
dependencies {
testCompile project(":kotlin-test:kotlin-test-common")
testCompile project(":kotlin-test:kotlin-test-annotations-common")
coroutinesExperimentalCompile sourceSets.main.output
}
compileKotlinCommon {
dependsOn(":prepare:build.version:writeStdlibVersion")
// dependsOn ":prepare:compiler:prepare-compiler-with-bootstrap-runtime"
// compilerJarFile = compilerJarWithBootstrapRuntime
}
compileKotlinCommon {
kotlinOptions {
freeCompilerArgs = [
"-module-name", project.name,
"-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-XXLanguage:+InlineClasses",
"-Xallow-kotlin-package",
"-Xallow-result-return-type"
]
}
}
compileCoroutinesExperimentalKotlinCommon {
kotlinOptions {
languageVersion = "1.3"
apiVersion = "1.3"
freeCompilerArgs = [
"-module-name", project.name+"-coroutines",
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
"-Xuse-experimental=kotlin.Experimental",
"-Xcoroutines=enable",
"-XXLanguage:-ReleaseCoroutines",
"-Xallow-kotlin-package",
"-Xallow-result-return-type"
]
}
}
compileTestKotlinCommon {
kotlinOptions {
freeCompilerArgs += [
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes"
]
}
}
jar {
manifestAttributes(manifest, project, 'Main')
from sourceSets.coroutinesExperimental.output
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.kotlin
from sourceSets.coroutinesExperimental.kotlin
}
configurations {
sources
}
artifacts {
archives sourcesJar
sources sourcesJar
}
javadocJar()
// TODO: call the "dist" task instead, once we need to publish kotlin-stdlib-common.jar with the compiler distribution
task distCommon(type: Copy) {
from(jar)
from(sourcesJar)
into "$distDir/common"
rename "-${java.util.regex.Pattern.quote(version)}", ''
}
dist.dependsOn distCommon
classes.setDependsOn(classes.dependsOn.findAll { it != "compileJava" })
|