119 lines
2.7 KiB
Groovy
119 lines
2.7 KiB
Groovy
description = 'Kotlin Standard Library JDK 8 extension'
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
configureJvm6Project(project)
|
|
configurePublishing(project)
|
|
configureSourcesJar()
|
|
configureJavadocJar()
|
|
|
|
ext.javaHome = JDK_18
|
|
ext.jvmTarget = "1.8"
|
|
|
|
dependencies {
|
|
compile project(':kotlin-stdlib')
|
|
compile project(':kotlin-stdlib-jdk7')
|
|
testCompile project(':kotlin-test:kotlin-test-junit')
|
|
testCompile project(':kotlin-coroutines-experimental-compat')
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
kotlin {
|
|
srcDir 'src'
|
|
}
|
|
}
|
|
test {
|
|
kotlin {
|
|
srcDir 'test'
|
|
if(!BuildPropertiesKt.getKotlinBuildProperties(project).inIdeaSync) {
|
|
srcDir '../jvm/test'
|
|
srcDir '../common/test'
|
|
srcDir '../test'
|
|
srcDir '../jdk7/test'
|
|
}
|
|
}
|
|
}
|
|
java9 {
|
|
java {
|
|
srcDir 'java9'
|
|
}
|
|
}
|
|
}
|
|
|
|
jar {
|
|
manifestAttributes(manifest, project, 'Main', true)
|
|
from sourceSets.java9.output
|
|
}
|
|
|
|
configureModularJar {
|
|
dependsOn(jar)
|
|
manifestAttributes(manifest, project, 'Main', true)
|
|
|
|
from zipTree(jar.outputs.files.singleFile)
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
sources sourcesJar
|
|
|
|
archives modularJar
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
kotlinOptions.jdkHome = JDK_18
|
|
kotlinOptions.jvmTarget = 1.8
|
|
}
|
|
|
|
compileKotlin {
|
|
kotlinOptions.freeCompilerArgs = [
|
|
"-Xallow-kotlin-package",
|
|
"-Xmultifile-parts-inherit",
|
|
"-Xnormalize-constructor-calls=enable",
|
|
"-module-name", project.name
|
|
]
|
|
}
|
|
|
|
compileTestKotlin {
|
|
kotlinOptions.freeCompilerArgs = [
|
|
"-Xallow-kotlin-package",
|
|
"-Xmulti-platform",
|
|
"-Xopt-in=kotlin.RequiresOptIn",
|
|
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
|
|
"-Xopt-in=kotlin.ExperimentalStdlibApi",
|
|
]
|
|
}
|
|
|
|
compileJava9Sources(project, 'kotlin.stdlib.jdk8')
|
|
|
|
test {
|
|
executable = "$JDK_18/bin/java"
|
|
}
|
|
|
|
task testJdk6Tests(type: Test) { thisTask ->
|
|
dependsOn(':kotlin-stdlib:testClasses')
|
|
check.dependsOn(thisTask)
|
|
group = "verification"
|
|
|
|
executable = "$JDK_18/bin/java"
|
|
|
|
doFirst {
|
|
testClassesDirs = project(':kotlin-stdlib').sourceSets.test.output
|
|
classpath = files(
|
|
testClassesDirs,
|
|
sourceSets.test.compileClasspath
|
|
)
|
|
}
|
|
}
|
|
|
|
|
|
[9, 10, 11].forEach { v ->
|
|
task(type: Test, "jdk${v}Test") { thisTask ->
|
|
check.dependsOn(thisTask)
|
|
group = "verification"
|
|
executable = "${project.property("JDK_$v")}/bin/java"
|
|
if (v > 9)
|
|
enabled(file(executable).parentFile.isDirectory())
|
|
}
|
|
}
|