| description = 'Kotlin Standard Library' |
| |
| apply plugin: 'kotlin' |
| |
| configureJvm6Project(project) |
| configureDist(project) |
| configurePublishing(project) |
| |
| project.ext["jpsLibraryPath"] = rootProject.distLibDir |
| |
| sourceSets { |
| annotations { |
| if(!System.properties.'idea.active') { |
| java { |
| srcDir "${rootDir}/core/runtime.jvm/src" |
| include 'org/jetbrains/annotations/**' |
| } |
| kotlin { |
| exclude '**/*' |
| } |
| } |
| } |
| builtins { |
| java { |
| srcDir "${rootDir}/core/builtins/src" |
| srcDir "jvm/runtime" |
| } |
| } |
| main { |
| java { |
| srcDir 'src' |
| } |
| } |
| experimental { |
| kotlin { |
| srcDir "experimental" |
| } |
| } |
| test { |
| kotlin { |
| srcDir 'test' |
| } |
| } |
| java9 { |
| java { |
| srcDir 'jvm/java9' |
| } |
| } |
| } |
| |
| dependencies { |
| builtinsCompile group: 'org.jetbrains', name: 'annotations', version:'13.0' |
| compile group: 'org.jetbrains', name: 'annotations', version:'13.0' |
| compile sourceSets.builtins.output |
| |
| testCompile project(':kotlin-test:kotlin-test-junit') |
| } |
| |
| configurations { |
| mainJar |
| builtins |
| } |
| |
| task originalStdlibJar(type: Jar) { |
| baseName = 'original-kotlin-stdlib' |
| from sourceSets.main.output |
| } |
| |
| jar { |
| manifestAttributes(manifest, project, 'Main', true) |
| from("${rootDir}/dist/builtins") |
| from sourceSets.builtins.output |
| from sourceSets.experimental.output |
| // TODO: enable as soon as this doesn't cause D8/DX to crash |
| // from sourceSets.java9.output |
| } |
| |
| task distJar(type: Jar) { |
| baseName = 'dist-kotlin-stdlib' |
| version = null |
| manifestAttributes(manifest, project, 'Main', true) |
| from("${rootDir}/dist/builtins") |
| from sourceSets.annotations.output |
| from sourceSets.builtins.output |
| from sourceSets.main.output |
| from sourceSets.experimental.output |
| // TODO: enable as soon as this doesn't cause D8/DX to crash |
| // from sourceSets.java9.output |
| } |
| |
| task builtinsJar(type: Jar) { |
| baseName = "builtins" |
| from("${rootDir}/dist/builtins") |
| from sourceSets.builtins.output |
| } |
| |
| sourcesJar { |
| from "${rootDir}/core/builtins/native" |
| from sourceSets.builtins.kotlin |
| } |
| |
| artifacts { |
| archives sourcesJar |
| archives javadocJar |
| mainJar jar |
| builtins builtinsJar |
| } |
| |
| dist { |
| [distJar, sourcesJar].forEach { |
| from(it) { |
| rename('dist-', '') |
| } |
| // legacy |
| from(it) { |
| rename('dist-', '') |
| rename('kotlin-stdlib', 'kotlin-runtime') |
| } |
| } |
| from (configurations.compile) { |
| include 'annotations*.jar' |
| } |
| } |
| |
| task dexMethodCount(type: DexMethodCount) { |
| from jar |
| ownPackages = ['kotlin'] |
| } |
| check.dependsOn(dexMethodCount) |
| |
| compileBuiltinsKotlin { |
| dependsOn ":core:builtins:serialize" |
| kotlinOptions { |
| freeCompilerArgs = [ |
| "-version", |
| "-Xallow-kotlin-package", |
| "-Xdump-declarations-to=${buildDir}/runtime-declarations.json", |
| "-cp", "${rootDir}/dist/builtins", |
| "-module-name", "kotlin-runtime" |
| ] |
| } |
| } |
| compileKotlin { |
| dependsOn(":prepare:build.version:writeStdlibVersion") |
| kotlinOptions { |
| freeCompilerArgs = [ |
| "-version", |
| "-Xallow-kotlin-package", |
| "-Xmultifile-parts-inherit", |
| "-Xnormalize-constructor-calls=enable", |
| "-Xdump-declarations-to=${buildDir}/stdlib-declarations.json", |
| "-module-name", project.name |
| ] |
| } |
| } |
| |
| compileExperimentalKotlin { |
| kotlinOptions { |
| languageVersion = "1.3" |
| apiVersion = "1.3" |
| freeCompilerArgs = [ |
| "-version", |
| "-Xallow-kotlin-package", |
| "-Xmultifile-parts-inherit", |
| "-Xdump-declarations-to=${buildDir}/stdlib-experimental-declarations.json", |
| "-module-name", "kotlin-stdlib-experimental" |
| ] |
| } |
| } |
| |
| compileJava9Sources(project, 'kotlin.stdlib', [sourceSets.builtins.output, sourceSets.main.output]) |
| |
| kotlin.experimental.coroutines 'enable' |