From 7dfa3bea1840478ab6a04597b83269cc7873339c Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 20 Mar 2017 10:44:19 +0300 Subject: [PATCH] Update tools & libraries projects to use JDK 8 when needed --- compiler/compiler.pro | 5 +--- libraries/ReadMe.md | 7 +++--- libraries/pom.xml | 2 +- libraries/stdlib/pom.xml | 4 +++ .../plugin/KotlinGradleBuildServices.kt | 25 ------------------- libraries/tools/kotlin-maven-plugin/pom.xml | 12 +++++++++ 6 files changed, 22 insertions(+), 33 deletions(-) diff --git a/compiler/compiler.pro b/compiler/compiler.pro index 8bc9290f823..6098c12103a 100644 --- a/compiler/compiler.pro +++ b/compiler/compiler.pro @@ -132,9 +132,6 @@ messages/**) } -keep class com.intellij.openapi.util.text.StringHash { *; } -# for gradle plugin and other server tools --keep class com.intellij.openapi.util.io.ZipFileCache { public *; } - # for j2k -keep class com.intellij.codeInsight.NullableNotNullManager { public protected *; } @@ -202,4 +199,4 @@ messages/**) -keep class com.intellij.openapi.module.ModuleServiceManager { public *; } # for building kotlin-build-common-test --keep class org.jetbrains.kotlin.build.SerializationUtilsKt { *; } \ No newline at end of file +-keep class org.jetbrains.kotlin.build.SerializationUtilsKt { *; } diff --git a/libraries/ReadMe.md b/libraries/ReadMe.md index d6136c41847..6a9c6a6323e 100644 --- a/libraries/ReadMe.md +++ b/libraries/ReadMe.md @@ -9,8 +9,9 @@ setup environment variables as following: JDK_17="path to JDK 1.7" JDK_18="path to JDK 1.8" -The main part of kotlin runtime and all tools are compiled against JDK 1.6 and also there are two extensions -for the standard library which are compiled against JDK 1.7 and 1.8 respectively, so you need to have all these JDKs installed. +The main part of the Kotlin standard library, `kotlin-stdlib`, is compiled against JDK 1.6 and also there are two extensions +for the standard library, `kotlin-stdlib-jre7` and `kotlin-stdlib-jre8`, which are compiled against JDK 1.7 and 1.8 respectively, +so you need to have all these JDKs installed. Then you'll be able to build tools and libraries with: @@ -22,7 +23,7 @@ Be sure to build Kotlin compiler distribution before launching Maven: see ReadMe If your maven build is failing with Out-Of-Memory errors, set JVM options for maven in MAVEN_OPTS environment variable like this: - MAVEN_OPTS="-Xms512m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=512m" + MAVEN_OPTS="-Xmx2G" ## Gradle Plugin diff --git a/libraries/pom.xml b/libraries/pom.xml index 5720f870925..ba346994c2e 100644 --- a/libraries/pom.xml +++ b/libraries/pom.xml @@ -50,7 +50,7 @@ ${project-root}/dist ${kotlin-dist}/kotlinc - ${env.JDK_16} + ${env.JDK_18} 1.1 diff --git a/libraries/stdlib/pom.xml b/libraries/stdlib/pom.xml index 83a2b7fe627..c9945494d39 100644 --- a/libraries/stdlib/pom.xml +++ b/libraries/stdlib/pom.xml @@ -13,6 +13,10 @@ kotlin-stdlib + + ${env.JDK_16} + + org.jetbrains.kotlin diff --git a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinGradleBuildServices.kt b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinGradleBuildServices.kt index f8fbf4c8c8d..779a7420ee9 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinGradleBuildServices.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinGradleBuildServices.kt @@ -22,10 +22,8 @@ import org.gradle.BuildResult import org.gradle.api.invocation.Gradle import org.gradle.api.logging.Logging import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment -import org.jetbrains.kotlin.com.intellij.openapi.util.io.ZipFileCache import org.jetbrains.kotlin.com.intellij.openapi.vfs.impl.ZipHandler import org.jetbrains.kotlin.com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem -import org.jetbrains.kotlin.gradle.utils.ParsedGradleVersion import org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile import org.jetbrains.kotlin.incremental.BuildCacheStorage import org.jetbrains.kotlin.incremental.multiproject.ArtifactDifferenceRegistryProvider @@ -138,29 +136,6 @@ internal class CompilerServicesCleanup() { } (KotlinCoreEnvironment.applicationEnvironment?.jarFileSystem as? CoreJarFileSystem)?.clearHandlersCache() - - // making cleanup of static objects only on recognized versions of gradle and if version < 2.4 - // otherwise it may cause problems e.g. with JobScheduler on subsequent runs - // this strategy may lead to memory leaks, but prevent crashes due to destroyed JobScheduler - // the reason for the strategy is the following: - // gradle < 2.4 has problems with plugin reuse in the daemon: new calls to the plugin are made with a new classloader - // for every new build. With statically initialized daemons like JobScheduler that leads to big leaks of classloaders and classes, - // therefore to reduce leaks JobScheduler (and deprecated ZipFileCache for now) should be stopped) - // It should be noted that because of this behavior there are no benefits of using daemon in these versions. - // Starting from 2.4 gradle using cached classloaders, that leads to effective class reusing in the daemon, but - // in that case premature stopping of the static daemons may lead to crashes. - ParsedGradleVersion.parse(gradleVersion)?.let { - log.kotlinDebug("detected gradle version $it") - if (it < ParsedGradleVersion.parse("2.4")!!) { - // TODO: remove ZipFileCache cleanup after switching to recent idea libs - stopZipFileCache() - } - } - } - - private fun stopZipFileCache() { - ZipFileCache.stopBackgroundThread() - log.kotlinDebug("ZipFileCache finished successfully") } private fun cleanJarCache() { diff --git a/libraries/tools/kotlin-maven-plugin/pom.xml b/libraries/tools/kotlin-maven-plugin/pom.xml index 14297700b8b..6e6b3823b79 100644 --- a/libraries/tools/kotlin-maven-plugin/pom.xml +++ b/libraries/tools/kotlin-maven-plugin/pom.xml @@ -67,6 +67,10 @@ org.apache.maven.plugins maven-compiler-plugin + + 1.8 + 1.8 + @@ -91,6 +95,14 @@ + + + maven-surefire-plugin + ${surefire-version} + + ${env.JDK_18}/bin/java + +