| description = 'Kotlin Standard Library JDK 7 extension' |
| |
| apply plugin: 'kotlin' |
| |
| configureJvm6Project(project) |
| configurePublishing(project) |
| ext.javaHome = JDK_17 |
| |
| sourceSets { |
| main { |
| kotlin { |
| srcDir 'src' |
| } |
| } |
| test { |
| kotlin { |
| srcDir 'test' |
| if(!BuildPropertiesKt.getKotlinBuildProperties(project).inIdeaSync) { |
| srcDir '../jvm/test' |
| srcDir '../common/test' |
| srcDir '../test' |
| } |
| } |
| } |
| noJdk7Test { |
| kotlin { |
| srcDir 'testNoJdk7' |
| } |
| } |
| java9 { |
| java { |
| srcDir 'java9' |
| } |
| } |
| } |
| |
| configurations { |
| noJdk7TestCompile.extendsFrom(testCompile) |
| } |
| |
| dependencies { |
| compile project(':kotlin-stdlib') |
| testCompile project(':kotlin-test:kotlin-test-junit') |
| testCompile project(':kotlin-coroutines-experimental-compat') |
| } |
| |
| 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 |
| sources sourcesJar |
| |
| archives modularJar |
| } |
| |
| javadocJar() |
| |
| tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) { |
| kotlinOptions.jdkHome = JDK_17 |
| } |
| |
| compileKotlin { |
| kotlinOptions.freeCompilerArgs = [ |
| "-Xallow-kotlin-package", |
| "-Xmultifile-parts-inherit", |
| "-Xnormalize-constructor-calls=enable", |
| "-module-name", project.name, |
| "-Xuse-experimental=kotlin.contracts.ExperimentalContracts", |
| ] |
| } |
| |
| compileTestKotlin { |
| kotlinOptions.freeCompilerArgs = [ |
| "-Xallow-kotlin-package", |
| "-Xmulti-platform", |
| "-Xuse-experimental=kotlin.Experimental", |
| "-Xuse-experimental=kotlin.ExperimentalUnsignedTypes", |
| "-Xuse-experimental=kotlin.ExperimentalStdlibApi" |
| ] |
| } |
| |
| compileJava9Sources(project, 'kotlin.stdlib.jdk7') |
| |
| test { |
| executable = "$JDK_17/bin/java" |
| } |
| |
| task testJdk6Tests(type: Test) { |
| dependsOn(':kotlin-stdlib:testClasses') |
| group = "verification" |
| |
| executable = "$JDK_17/bin/java" |
| |
| doFirst { |
| testClassesDirs = project(':kotlin-stdlib').sourceSets.test.output |
| classpath = files( |
| testClassesDirs, |
| sourceSets.test.compileClasspath |
| ) |
| } |
| } |
| |
| task testNoJdk7(type: Test, dependsOn: noJdk7TestClasses) { |
| group = "verification" |
| |
| executable = "$JDK_17/bin/java" |
| |
| testClassesDirs = sourceSets.noJdk7Test.output.classesDirs |
| classpath = sourceSets.noJdk7Test.runtimeClasspath |
| } |
| |
| |
| check.dependsOn testJdk6Tests, testNoJdk7 |
| |