Files
kotlin-fork/libraries/stdlib/jvm/build.gradle
T
Ilya Gorbunov fa2f1311d7 Add tests for UInt, ULong
Opt-in to use unsigned types in tests
2018-08-30 14:55:41 +03:00

265 lines
6.3 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 {
annotations {
if(!System.properties.'idea.active') {
java {
srcDir "${rootDir}/core/runtime.jvm/src"
include 'org/jetbrains/annotations/**'
}
kotlin {
exclude '**/*'
}
}
}
main {
java {
srcDir "${rootDir}/core/builtins/src"
srcDir 'runtime'
srcDir 'src'
}
}
experimental {
kotlin {
srcDir "../experimental"
}
}
coroutines {
kotlin {
srcDir '../coroutines/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 distJar(type: Jar) {
baseName = 'dist-kotlin-stdlib'
version = null
manifestAttributes(manifest, project, 'Main', true)
from("${rootDir}/dist/builtins")
from sourceSets.annotations.output
from sourceSets.main.output
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 {
[distJar, distSourcesJar].forEach {
from(it) {
rename('dist-', '')
}
// legacy
from(it) {
rename('dist-', '')
rename('kotlin-stdlib', 'kotlin-runtime')
}
}
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",
"-Xmultifile-parts-inherit",
"-Xnormalize-constructor-calls=enable",
"-module-name", "kotlin-stdlib",
"-Xuse-experimental=kotlin.Experimental",
"-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",
"-Xmultifile-parts-inherit",
"-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
}
test.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"
]
}
}
kotlin.experimental.coroutines 'enable'