1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
|
description = 'Kotlin Standard Library JDK 8 extension'
apply plugin: 'kotlin'
apply plugin: 'pill-configurable'
configureJvm6Project(project)
configureDist(project)
configurePublishing(project)
ext.javaHome = JDK_18
ext.jvmTarget = "1.8"
pill {
importAsLibrary = true
}
dependencies {
compile project(':kotlin-stdlib')
compile project(':kotlin-stdlib-jdk7')
testCompile project(':kotlin-test:kotlin-test-junit')
}
sourceSets {
main {
kotlin {
srcDir 'src'
}
}
test {
kotlin {
srcDir 'test'
if(!System.properties.'idea.active') {
srcDir '../jvm/test'
srcDir '../common/test'
srcDir '../test'
srcDir '../jdk7/test'
}
}
}
java9 {
java {
srcDir 'java9'
}
}
}
jar {
manifestAttributes(manifest, project, 'Main' /*true*/)
// TODO: enable as soon as this doesn't cause D8/DX to crash
// from sourceSets.java9.output
}
task modularJar(type: Jar) {
dependsOn(jar)
manifestAttributes(manifest, project, 'Main', true)
classifier = 'modular'
from zipTree(jar.outputs.files.singleFile)
from sourceSets.java9.output
}
artifacts {
archives sourcesJar
archives modularJar
}
javadocJar()
dist {
from (jar, sourcesJar)
}
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", "-Xuse-experimental=kotlin.ExperimentalUnsignedTypes"]
}
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,
configurations.testCompile
)
}
}
[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())
}
}
|