Files
kotlin-fork/libraries/stdlib/common/build.gradle
T
2018-11-21 03:42:27 +03:00

123 lines
3.0 KiB
Groovy

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'
srcDir '../coroutines/common/src'
srcDir '../coroutines/src'
}
}
test {
kotlin {
srcDir commonTestSrcDir
srcDir 'test'
}
}
coroutines {
kotlin {
srcDir '../coroutines-experimental/src'
}
}
}
dependencies {
testCompile project(":kotlin-test:kotlin-test-common")
testCompile project(":kotlin-test:kotlin-test-annotations-common")
coroutinesCompile 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"
]
}
}
compileCoroutinesKotlinCommon {
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.coroutines.output
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.kotlin
from sourceSets.coroutines.kotlin
}
configurations {
sources
}
artifacts {
archives sourcesJar
sources sourcesJar
archives 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" })