diff --git a/libraries/build.gradle b/libraries/build.gradle index 5f1a0013af2..0de298b52a0 100644 --- a/libraries/build.gradle +++ b/libraries/build.gradle @@ -1,7 +1,5 @@ buildscript { - ext.kotlin_version = findProperty("deployVersion") ?: "1.1-SNAPSHOT" - ext.kotlin_language_version = "1.1" - ext.kotlin_gradle_plugin_version = findProperty("kotlinGradlePluginVersion") ?: "1.1.2" + apply from: 'versions.gradle' repositories { mavenCentral() @@ -13,15 +11,6 @@ buildscript { apply from: 'commonConfiguration.gradle' -ext { - JDK_16 = jdkPath("1.6") - JDK_17 = jdkPath("1.7") - JDK_18 = jdkPath("1.8") - distDir = file("${rootDir}/../dist") - distLibDir = file("${rootDir}/../dist/kotlinc/lib") - bootstrapCompilerFile = file("$distDir/kotlin-compiler-for-maven.jar") -} - allprojects { group = 'org.jetbrains.kotlin' version = "$kotlin_version" diff --git a/libraries/commonConfiguration.gradle b/libraries/commonConfiguration.gradle index 8640e32edcb..b62e99ca72a 100644 --- a/libraries/commonConfiguration.gradle +++ b/libraries/commonConfiguration.gradle @@ -1,10 +1,19 @@ -ext.jdkPath = { String version -> +String jdkPath(String version) { String varName = "JDK_${version.replace('.', '')}" String path = System.getenv(varName) if (path == null) throw new GradleException("Please set environment variable $varName to point to JDK $version installation") return path } +ext { + JDK_16 = jdkPath("1.6") + JDK_17 = jdkPath("1.7") + JDK_18 = jdkPath("1.8") + distDir = file("${rootDir}/../dist") + distLibDir = file("${rootDir}/../dist/kotlinc/lib") + bootstrapCompilerFile = file("$distDir/kotlin-compiler-for-maven.jar") +} + ext.configureJvmProject = { Project project -> project.configure(project) { task sourcesJar(type: Jar, dependsOn: classes) { @@ -16,7 +25,7 @@ ext.configureJvmProject = { Project project -> sourceCompatibility = 1.6 targetCompatibility = 1.6 options.fork = true - options.forkOptions.executable = "${JDK_16}/bin/javac" + options.forkOptions.javaHome = file(JDK_16) } tasks.withType(project.compileKotlin.class) { diff --git a/libraries/examples/kotlin-gradle-subplugin-example/build.gradle b/libraries/examples/kotlin-gradle-subplugin-example/build.gradle index d2efa97b19c..f7beee73e19 100644 --- a/libraries/examples/kotlin-gradle-subplugin-example/build.gradle +++ b/libraries/examples/kotlin-gradle-subplugin-example/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'kotlin' +apply plugin: 'maven' repositories { mavenLocal() diff --git a/libraries/tools/gradle-tools/build.gradle b/libraries/tools/gradle-tools/build.gradle index c56250234d0..f1447b3649a 100644 --- a/libraries/tools/gradle-tools/build.gradle +++ b/libraries/tools/gradle-tools/build.gradle @@ -1,7 +1,6 @@ buildscript { - ext.kotlin_version = findProperty("deployVersion") ?: "1.1-SNAPSHOT" - ext.kotlin_language_version = "1.1" - ext.kotlin_gradle_plugin_version = findProperty("kotlinGradlePluginVersion") ?: "1.1.1" + ext.kotlin_root = findProperty("kotlinRoot") ?: "${rootProject.projectDir}/../../.." + apply from: "${kotlin_root}/libraries/versions.gradle" repositories { mavenCentral() @@ -11,19 +10,8 @@ buildscript { } } -ext.kotlin_root = findProperty("kotlinRoot") ?: "${rootProject.projectDir}/../../.." - apply from: "${kotlin_root}/libraries/commonConfiguration.gradle" -ext { - JDK_16 = jdkPath("1.6") - JDK_17 = jdkPath("1.7") - JDK_18 = jdkPath("1.8") - distDir = file("${kotlin_root}/dist") - distLibDir = file("${kotlin_root}/dist/kotlinc/lib") - bootstrapCompilerFile = file("$distDir/kotlin-compiler-for-maven.jar") -} - allprojects { group = 'org.jetbrains.kotlin' version = "$kotlin_version" diff --git a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle index 81c13e15317..ccabb0c90e3 100644 --- a/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin-integration-tests/build.gradle @@ -8,8 +8,6 @@ repositories { maven { url 'http://repository.jetbrains.com/utils/' } } -def kotlinVersion = project.version - dependencies { testCompile project(':kotlin-gradle-plugin') testCompile project(':kotlin-gradle-plugin').sourceSets.test.output @@ -30,7 +28,11 @@ processResources { tasks.withType(Test) { onlyIf { !project.hasProperty("noTest") } - exclude '**/KotlinAndroid*' + if (!project.hasProperty("android")) { + exclude '**/KotlinAndroid*' + } + + executable = "${JDK_18}/bin/java" testLogging { // set options for log level LIFECYCLE diff --git a/libraries/tools/kotlin-gradle-plugin/build.gradle b/libraries/tools/kotlin-gradle-plugin/build.gradle index 405c5fabf39..a21f0692e64 100644 --- a/libraries/tools/kotlin-gradle-plugin/build.gradle +++ b/libraries/tools/kotlin-gradle-plugin/build.gradle @@ -41,6 +41,10 @@ dependencies { testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version" } +tasks.withType(project.compileKotlin.class) { + kotlinOptions.jdkHome = JDK_18 +} + compileKotlin.dependsOn compileGroovy compileGroovy.dependsOn.remove("compileJava") @@ -48,6 +52,7 @@ def groovyClassesDir = file("${buildDir}/mainGroovyClasses") compileGroovy.destinationDir = groovyClassesDir sourceSets.main.compileClasspath += files(groovyClassesDir) compileGroovy.classpath = sourceSets.main.compileClasspath - files(groovyClassesDir) +sourceSets.main.java.srcDirs += sourceSets.main.kotlin.srcDirs processResources { expand(project.properties) diff --git a/libraries/versions.gradle b/libraries/versions.gradle new file mode 100644 index 00000000000..bebaaad04f1 --- /dev/null +++ b/libraries/versions.gradle @@ -0,0 +1,3 @@ +ext.kotlin_version = findProperty("deployVersion") ?: "1.1-SNAPSHOT" +ext.kotlin_language_version = "1.1" +ext.kotlin_gradle_plugin_version = "1.1.2" \ No newline at end of file