250 lines
6.1 KiB
Groovy
250 lines
6.1 KiB
Groovy
description = 'Kotlin Standard Library for JVM'
|
|
|
|
apply plugin: 'kotlin-platform-jvm'
|
|
apply plugin: 'pill-configurable'
|
|
|
|
archivesBaseName = 'kotlin-stdlib'
|
|
|
|
configureJvm6Project(project)
|
|
configureDist(project)
|
|
configurePublishing(project)
|
|
|
|
pill {
|
|
importAsLibrary = true
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDir "${rootDir}/core/builtins/src"
|
|
srcDir 'runtime'
|
|
srcDir 'src'
|
|
srcDir '../coroutines/jvm/src'
|
|
}
|
|
}
|
|
experimental {
|
|
kotlin {
|
|
srcDir "../experimental"
|
|
}
|
|
}
|
|
coroutines {
|
|
kotlin {
|
|
srcDir '../coroutines-experimental/jvm/src'
|
|
}
|
|
}
|
|
coroutinesTest {
|
|
kotlin {
|
|
srcDir '../coroutines/jvm/test'
|
|
}
|
|
}
|
|
test {
|
|
kotlin {
|
|
srcDir 'test'
|
|
}
|
|
}
|
|
java9 {
|
|
java {
|
|
srcDir 'java9'
|
|
}
|
|
}
|
|
unsigned {
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
commonSources
|
|
}
|
|
|
|
dependencies {
|
|
expectedBy project(":kotlin-stdlib-common")
|
|
|
|
commonSources project(path: ":kotlin-stdlib-common", configuration: "sources")
|
|
|
|
compile group: 'org.jetbrains', name: 'annotations', version:'13.0'
|
|
|
|
testCompile project(':kotlin-test:kotlin-test-junit')
|
|
|
|
coroutinesCompile sourceSets.main.output
|
|
|
|
coroutinesTestCompile sourceSets.coroutines.output
|
|
coroutinesTestCompile project(':kotlin-test:kotlin-test-junit')
|
|
|
|
unsignedCompile sourceSets.main.output
|
|
}
|
|
|
|
jar {
|
|
manifestAttributes(manifest, project, 'Main', true)
|
|
from("${rootDir}/dist/builtins")
|
|
from sourceSets.experimental.output
|
|
from sourceSets.coroutines.output
|
|
from sourceSets.unsigned.output
|
|
// TODO: enable as soon as this doesn't cause D8/DX to crash
|
|
// from sourceSets.java9.output
|
|
}
|
|
|
|
task coroutinesJar(type: Jar) {
|
|
version = null
|
|
classifier = 'coroutines'
|
|
manifestAttributes(manifest, project, 'Main', true)
|
|
project.configure(manifest) { attributes 'Kotlin-Version': '1.3' }
|
|
}
|
|
|
|
task unsignedJar(type: Jar) {
|
|
version = null
|
|
classifier = 'unsigned'
|
|
manifestAttributes(manifest, project, 'Main', true)
|
|
project.configure(manifest) { attributes 'Kotlin-Version': '1.3' }
|
|
}
|
|
|
|
sourcesJar {
|
|
from "${rootDir}/core/builtins/native"
|
|
from sourceSets.coroutines.kotlin
|
|
}
|
|
|
|
task distSourcesJar(type: Jar) {
|
|
dependsOn(sourcesJar, configurations.commonSources)
|
|
baseName = 'dist-kotlin-stdlib'
|
|
version = null
|
|
classifier = 'sources'
|
|
duplicatesStrategy = DuplicatesStrategy.FAIL
|
|
from zipTree(sourcesJar.outputs.files.singleFile)
|
|
|
|
from(zipTree(configurations.commonSources.singleFile)) {
|
|
it.includeEmptyDirs = false
|
|
exclude 'META-INF/*'
|
|
into 'common'
|
|
}
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
archives javadocJar
|
|
}
|
|
|
|
dist {
|
|
[jar, distSourcesJar].forEach {
|
|
from(it) {
|
|
rename('dist-', '')
|
|
}
|
|
}
|
|
from (configurations.compile) {
|
|
include 'annotations*.jar'
|
|
}
|
|
}
|
|
|
|
task experimentalJarsDist(type: Copy) {
|
|
from coroutinesJar
|
|
from unsignedJar
|
|
into distDir
|
|
}
|
|
|
|
dist.dependsOn experimentalJarsDist
|
|
|
|
task dexMethodCount(type: DexMethodCount) {
|
|
from jar
|
|
ownPackages = ['kotlin']
|
|
}
|
|
check.dependsOn(dexMethodCount)
|
|
|
|
compileKotlin {
|
|
dependsOn(":core:builtins:serialize")
|
|
classpath += files("${rootDir}/dist/builtins")
|
|
kotlinOptions {
|
|
freeCompilerArgs = [
|
|
"-version",
|
|
"-Xallow-kotlin-package",
|
|
"-Xallow-result-return-type",
|
|
"-Xmultifile-parts-inherit",
|
|
"-Xnormalize-constructor-calls=enable",
|
|
"-module-name", "kotlin-stdlib",
|
|
"-Xuse-experimental=kotlin.Experimental",
|
|
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
|
|
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
|
|
"-XXLanguage:+ReleaseCoroutines",
|
|
"-XXLanguage:+InlineClasses"
|
|
]
|
|
}
|
|
}
|
|
|
|
|
|
compileExperimentalKotlin {
|
|
kotlinOptions {
|
|
languageVersion = "1.3"
|
|
apiVersion = "1.3"
|
|
freeCompilerArgs = [
|
|
"-version",
|
|
"-Xallow-kotlin-package",
|
|
"-Xmultifile-parts-inherit",
|
|
"-module-name", "kotlin-stdlib-experimental"
|
|
]
|
|
}
|
|
}
|
|
|
|
compileJava9Sources(project, 'kotlin.stdlib')
|
|
|
|
compileCoroutinesKotlin {
|
|
kotlinOptions {
|
|
languageVersion = "1.3"
|
|
apiVersion = "1.3"
|
|
freeCompilerArgs = [
|
|
"-version",
|
|
"-Xallow-kotlin-package",
|
|
"-Xallow-result-return-type",
|
|
"-Xmultifile-parts-inherit",
|
|
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
|
|
"-Xuse-experimental=kotlin.Experimental",
|
|
"-XXLanguage:-ReleaseCoroutines",
|
|
"-module-name", "kotlin-stdlib-coroutines"
|
|
]
|
|
}
|
|
}
|
|
|
|
compileCoroutinesTestKotlin {
|
|
kotlinOptions {
|
|
languageVersion = "1.3"
|
|
apiVersion = "1.3"
|
|
freeCompilerArgs = [
|
|
"-version",
|
|
"-Xallow-kotlin-package",
|
|
"-Xmultifile-parts-inherit",
|
|
"-module-name", "kotlin-stdlib-coroutines"
|
|
]
|
|
}
|
|
}
|
|
|
|
task coroutinesTest(type: Test, dependsOn: coroutinesTestClasses) {
|
|
testClassesDirs = sourceSets.coroutinesTest.output.classesDirs
|
|
classpath = sourceSets.coroutinesTest.runtimeClasspath
|
|
}
|
|
|
|
check.dependsOn(coroutinesTest)
|
|
|
|
compileUnsignedKotlin {
|
|
kotlinOptions {
|
|
languageVersion = "1.3"
|
|
apiVersion = "1.3"
|
|
freeCompilerArgs += [
|
|
"-Xuse-experimental=kotlin.Experimental",
|
|
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
|
|
"-XXLanguage:+InlineClasses"
|
|
]
|
|
}
|
|
}
|
|
|
|
compileTestKotlin {
|
|
kotlinOptions {
|
|
freeCompilerArgs += [
|
|
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes",
|
|
"-XXLanguage:+ReleaseCoroutines"
|
|
]
|
|
}
|
|
}
|
|
|
|
test {
|
|
if (project.hasProperty("kotlin.stdlib.test.long.sequences")) {
|
|
systemProperty("kotlin.stdlib.test.long.sequences", "true")
|
|
}
|
|
}
|
|
|
|
kotlin.experimental.coroutines 'enable'
|