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", "-Xuse-experimental=kotlin.ExperimentalStdlibApi" ] } } 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" })