Update tools & libraries projects to use JDK 8 when needed

This commit is contained in:
Alexander Udalov
2017-03-20 10:44:19 +03:00
parent 33a0ae0fcd
commit 7dfa3bea18
6 changed files with 22 additions and 33 deletions
+1 -4
View File
@@ -132,9 +132,6 @@ messages/**)
} }
-keep class com.intellij.openapi.util.text.StringHash { *; } -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 # for j2k
-keep class com.intellij.codeInsight.NullableNotNullManager { public protected *; } -keep class com.intellij.codeInsight.NullableNotNullManager { public protected *; }
@@ -202,4 +199,4 @@ messages/**)
-keep class com.intellij.openapi.module.ModuleServiceManager { public *; } -keep class com.intellij.openapi.module.ModuleServiceManager { public *; }
# for building kotlin-build-common-test # for building kotlin-build-common-test
-keep class org.jetbrains.kotlin.build.SerializationUtilsKt { *; } -keep class org.jetbrains.kotlin.build.SerializationUtilsKt { *; }
+4 -3
View File
@@ -9,8 +9,9 @@ setup environment variables as following:
JDK_17="path to JDK 1.7" JDK_17="path to JDK 1.7"
JDK_18="path to JDK 1.8" 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 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 which are compiled against JDK 1.7 and 1.8 respectively, so you need to have all these JDKs installed. 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: 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: 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 ## Gradle Plugin
+1 -1
View File
@@ -50,7 +50,7 @@
<kotlin-dist>${project-root}/dist</kotlin-dist> <kotlin-dist>${project-root}/dist</kotlin-dist>
<kotlin-sdk>${kotlin-dist}/kotlinc</kotlin-sdk> <kotlin-sdk>${kotlin-dist}/kotlinc</kotlin-sdk>
<kotlin.compiler.jdkHome>${env.JDK_16}</kotlin.compiler.jdkHome> <kotlin.compiler.jdkHome>${env.JDK_18}</kotlin.compiler.jdkHome>
<kotlin.language.version>1.1</kotlin.language.version> <kotlin.language.version>1.1</kotlin.language.version>
+4
View File
@@ -13,6 +13,10 @@
<artifactId>kotlin-stdlib</artifactId> <artifactId>kotlin-stdlib</artifactId>
<properties>
<kotlin.compiler.jdkHome>${env.JDK_16}</kotlin.compiler.jdkHome>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.jetbrains.kotlin</groupId> <groupId>org.jetbrains.kotlin</groupId>
@@ -22,10 +22,8 @@ import org.gradle.BuildResult
import org.gradle.api.invocation.Gradle import org.gradle.api.invocation.Gradle
import org.gradle.api.logging.Logging import org.gradle.api.logging.Logging
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment 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.ZipHandler
import org.jetbrains.kotlin.com.intellij.openapi.vfs.impl.jar.CoreJarFileSystem 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.gradle.tasks.AbstractKotlinCompile
import org.jetbrains.kotlin.incremental.BuildCacheStorage import org.jetbrains.kotlin.incremental.BuildCacheStorage
import org.jetbrains.kotlin.incremental.multiproject.ArtifactDifferenceRegistryProvider import org.jetbrains.kotlin.incremental.multiproject.ArtifactDifferenceRegistryProvider
@@ -138,29 +136,6 @@ internal class CompilerServicesCleanup() {
} }
(KotlinCoreEnvironment.applicationEnvironment?.jarFileSystem as? CoreJarFileSystem)?.clearHandlersCache() (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() { private fun cleanJarCache() {
@@ -67,6 +67,10 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
@@ -91,6 +95,14 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-version}</version>
<configuration>
<jvm>${env.JDK_18}/bin/java</jvm>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>