From 5755210498eced94a39c88ae685e9139831801f3 Mon Sep 17 00:00:00 2001 From: Ilya Gorbunov Date: Thu, 19 Jan 2017 05:15:53 +0300 Subject: [PATCH] Tune build options for kotlin-test, kotlin-runtime, kotlin-stdlib, kotlin-stdlib-jre7/8 --- libraries/build.gradle | 5 ++ libraries/kotlin.test/junit/build.gradle | 2 +- libraries/kotlin.test/shared/build.gradle | 2 +- libraries/stdlib/build.gradle | 68 ++++++++++----------- libraries/stdlib/jre7/build.gradle | 63 +++++++++----------- libraries/stdlib/jre8/build.gradle | 72 ++++++++++------------- libraries/tools/runtime/build.gradle | 18 +++--- 7 files changed, 108 insertions(+), 122 deletions(-) diff --git a/libraries/build.gradle b/libraries/build.gradle index 0c825ca338c..56be4ebb3cf 100644 --- a/libraries/build.gradle +++ b/libraries/build.gradle @@ -2,6 +2,7 @@ buildscript { ext.kotlin_version = "1.1-SNAPSHOT" ext.kotlin_language_version = "1.1" + repositories { mavenCentral() maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' } @@ -11,6 +12,10 @@ buildscript { } } +ext.JDK_16 = System.getenv("JDK_16") +ext.JDK_17 = System.getenv("JDK_17") +ext.JDK_18 = System.getenv("JDK_18") + allprojects { apply plugin: 'maven' diff --git a/libraries/kotlin.test/junit/build.gradle b/libraries/kotlin.test/junit/build.gradle index 41fe84522fb..5c0de1c1429 100644 --- a/libraries/kotlin.test/junit/build.gradle +++ b/libraries/kotlin.test/junit/build.gradle @@ -34,7 +34,7 @@ artifacts { } compileKotlin { - kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", "${project.name}".toString()] + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", project.name] } compileTestKotlin { diff --git a/libraries/kotlin.test/shared/build.gradle b/libraries/kotlin.test/shared/build.gradle index d7107f13e88..086206332f6 100644 --- a/libraries/kotlin.test/shared/build.gradle +++ b/libraries/kotlin.test/shared/build.gradle @@ -3,7 +3,7 @@ description = 'Kotlin Test' dependencies { compile project(':kotlin-runtime') - compile('junit:junit:4.12') + testCompile('junit:junit:4.12') } sourceSets { diff --git a/libraries/stdlib/build.gradle b/libraries/stdlib/build.gradle index e8b017e2e78..8c0dfaa8b56 100644 --- a/libraries/stdlib/build.gradle +++ b/libraries/stdlib/build.gradle @@ -1,58 +1,52 @@ - -description = 'Kotlin stdlib' +description = 'Kotlin Standard Library' dependencies { - compile project(':kotlin-runtime') - compile project(':kotlin-test-parent:kotlin-test') - compile('junit:junit:4.12') - testCompile project(':kotlin-test-parent:kotlin-test-junit') + compile project(':kotlin-runtime') + testCompile project(':kotlin-test-parent:kotlin-test-junit') } sourceSets { - main { - kotlin { - srcDir 'src' + main { + java { + srcDir 'src' + } } - java { - srcDir 'src' + test { + kotlin { + srcDir 'test' + } } - } - test { - kotlin { - srcDir 'test' - } - } } jar { - manifest { - attributes 'Kotlin-Runtime-Component': 'Core', + manifest { + attributes \ + 'Kotlin-Runtime-Component': 'Core', + 'Kotlin-Version': "$kotlin_language_version", 'Implementation-Title': "${project.description ?: project.name}" - } + } } artifacts { - archives sourcesJar - archives javadocJar + archives sourcesJar + archives javadocJar } compileJava { - sourceCompatibility = 1.6 - targetCompatibility = 1.6 -} - -compileTestJava { - sourceCompatibility = 1.6 - targetCompatibility = 1.6 + sourceCompatibility = 1.6 + targetCompatibility = 1.6 + options.fork = true + options.forkOptions.executable = "${JDK_16}/bin/javac" } compileKotlin { - kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", - "-Xmultifile-parts-inherit", - "-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json".toString(), - "-module-name", "${project.name}".toString()] -} - -compileTestKotlin { - kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] + kotlinOptions { + jdkHome = JDK_16 + freeCompilerArgs = [ + "-Xallow-kotlin-package", + "-Xmultifile-parts-inherit", + "-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json".toString(), + "-module-name", "${project.name}".toString() + ] + } } diff --git a/libraries/stdlib/jre7/build.gradle b/libraries/stdlib/jre7/build.gradle index e93d018413a..7f310d0d379 100644 --- a/libraries/stdlib/jre7/build.gradle +++ b/libraries/stdlib/jre7/build.gradle @@ -1,56 +1,49 @@ - -description = 'Kotlin stdlib JRE 7' +description = 'Kotlin Standard Library JRE 7 extension' dependencies { - compile project(':kotlin-stdlib') - testCompile project(':kotlin-test-parent:kotlin-test-junit') + compile project(':kotlin-stdlib') + testCompile project(':kotlin-test-parent:kotlin-test-junit') } sourceSets { - main { - kotlin { - srcDir 'src' + main { + kotlin { + srcDir 'src' + } } - } - test { - kotlin { - srcDir 'test' - srcDir '../test' + test { + kotlin { + srcDir 'test' + srcDir '../test' + } } - } } jar { - manifest { - attributes 'Kotlin-Runtime-Component': 'Core', + manifest { + attributes \ + 'Kotlin-Runtime-Component': 'Core', + 'Kotlin-Version': "$kotlin_language_version", 'Implementation-Title': "${project.description ?: project.name}" - } + } } artifacts { - archives sourcesJar - archives javadocJar -} - -compileJava { - sourceCompatibility = 1.7 - targetCompatibility = 1.7 -} - -compileTestJava { - sourceCompatibility = 1.7 - targetCompatibility = 1.7 + archives sourcesJar + archives javadocJar } compileKotlin { - kotlinOptions.jdkHome = System.getenv('JDK_17') - kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", - "-Xmultifile-parts-inherit", - "-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json".toString(), - "-module-name", "${project.name}".toString()] + kotlinOptions.jdkHome = JDK_17 + kotlinOptions.freeCompilerArgs = [ + "-Xallow-kotlin-package", + "-Xmultifile-parts-inherit", + "-Xdump-declarations-to", "${buildDir}/stdlib-jre7-declarations.json", + "-module-name", project.name + ] } compileTestKotlin { - kotlinOptions.jdkHome = System.getenv('JDK_17') - kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] + kotlinOptions.jdkHome = JDK_17 + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] } diff --git a/libraries/stdlib/jre8/build.gradle b/libraries/stdlib/jre8/build.gradle index 84c3e3515c2..d7b474436c9 100644 --- a/libraries/stdlib/jre8/build.gradle +++ b/libraries/stdlib/jre8/build.gradle @@ -1,61 +1,53 @@ - -description = 'Kotlin stdlib JRE 8' +description = 'Kotlin Standard Library JRE 8 extension' dependencies { - compile project(':kotlin-stdlib') - compile project(':kotlin-stdlib-jre7') - testCompile project(':kotlin-test-parent:kotlin-test-junit') - testCompile project(':kotlin-stdlib-jre7') + compile project(':kotlin-stdlib') + compile project(':kotlin-stdlib-jre7') + testCompile project(':kotlin-test-parent:kotlin-test-junit') } sourceSets { - main { - kotlin { - srcDir 'src' + main { + kotlin { + srcDir 'src' + } } - } - test { - kotlin { - srcDir 'test' - srcDir '../test' - srcDir '../jre7/test' + test { + kotlin { + srcDir 'test' + srcDir '../test' + srcDir '../jre7/test' + } } - } } jar { - manifest { - attributes 'Kotlin-Runtime-Component': 'Core', + manifest { + attributes \ + 'Kotlin-Runtime-Component': 'Core', + 'Kotlin-Version': "$kotlin_language_version", 'Implementation-Title': "${project.description ?: project.name}" - } + } } artifacts { - archives sourcesJar - archives javadocJar -} - -compileJava { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 -} - -compileTestJava { - sourceCompatibility = 1.8 - targetCompatibility = 1.8 + archives sourcesJar + archives javadocJar } compileKotlin { - kotlinOptions.jdkHome = System.getenv('JDK_18') - kotlinOptions.jvmTarget = 1.8 - kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", - "-Xmultifile-parts-inherit", - "-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json".toString(), - "-module-name", "${project.name}".toString()] + kotlinOptions.jdkHome = JDK_18 + kotlinOptions.jvmTarget = 1.8 + kotlinOptions.freeCompilerArgs = [ + "-Xallow-kotlin-package", + "-Xmultifile-parts-inherit", + "-Xdump-declarations-to", "${buildDir}/stdlib-jre8-declarations.json", + "-module-name", project.name + ] } compileTestKotlin { - kotlinOptions.jdkHome = System.getenv('JDK_18') - kotlinOptions.jvmTarget = 1.8 - kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] + kotlinOptions.jdkHome = JDK_18 + kotlinOptions.jvmTarget = 1.8 + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] } diff --git a/libraries/tools/runtime/build.gradle b/libraries/tools/runtime/build.gradle index 739468cb615..e332029a7f7 100644 --- a/libraries/tools/runtime/build.gradle +++ b/libraries/tools/runtime/build.gradle @@ -42,15 +42,17 @@ compileJava { sourceCompatibility = 1.6 targetCompatibility = 1.6 options.fork = true - // TODO: find how to fix on macos -// options.bootClasspath = "${System.getenv('JDK_16')}/jre/lib/rt.jar" + options.forkOptions.executable = "${JDK_16}/bin/javac" } compileKotlin { - kotlinOptions.freeCompilerArgs = [ - "-Xallow-kotlin-package", - "-Xdump-declarations-to", "${buildDir}/runtime-declarations.json", - "-cp", "${rootDir}/../dist/builtins", - "-module-name", project.name - ] + kotlinOptions { + jdkHome = JDK_16 + freeCompilerArgs = [ + "-Xallow-kotlin-package", + "-Xdump-declarations-to", "${buildDir}/runtime-declarations.json", + "-cp", "${rootDir}/../dist/builtins", + "-module-name", project.name + ] + } }