Migrate repo to use JVM toolchains Gradle feature.
^KT-46972 Fixed
This commit is contained in:
@@ -41,20 +41,20 @@ Support for multiplatform programming is one of Kotlin’s key benefits. It redu
|
|||||||
|
|
||||||
## Build environment requirements
|
## Build environment requirements
|
||||||
|
|
||||||
In order to build Kotlin distribution you need to have:
|
This repository is using [Gradle toolchains](https://docs.gradle.org/current/userguide/toolchains.html) feature
|
||||||
|
to select and auto-provision required JDKs from [AdoptOpenJdk](https://adoptopenjdk.net) project.
|
||||||
|
|
||||||
- JDK 1.6, 1.7, 1.8 and 9
|
Unfortunately [AdoptOpenJdk](https://adoptopenjdk.net) project does not provide required JDK 1.6 and 1.7 images,
|
||||||
- Setup environment variables as following:
|
so you could either download them manually and provide path to installation via `JDK_16` and `JDK_17` environment variables or
|
||||||
|
use following SDK managers:
|
||||||
|
- [Asdf-vm](https://asdf-vm.com/)
|
||||||
|
- [Jabba](https://github.com/shyiko/jabba)
|
||||||
|
- [SDKMAN!](https://sdkman.io/)
|
||||||
|
|
||||||
JAVA_HOME="path to JDK 1.8"
|
Alternatively, it is still possible to only provide required JDKs via environment variables
|
||||||
JDK_16="path to JDK 1.6"
|
(see [gradle.properties](./gradle.properties#L5) for supported variable names). To ensure Gradle uses only JDKs
|
||||||
JDK_17="path to JDK 1.7"
|
from environmental variables - disable Gradle toolchain auto-detection by passing `-Porg.gradle.java.installations.auto-detect=false` option
|
||||||
JDK_18="path to JDK 1.8"
|
(or put it into `$GRADLE_USER_HOME/gradle.properties`).
|
||||||
JDK_9="path to JDK 9"
|
|
||||||
|
|
||||||
For local development, if you're not working on bytecode generation or the standard library, it's OK to have only JDK 1.8 and JDK 9 installed, and to point `JDK_16` and `JDK_17` environment variables to your JDK 1.8 installation.
|
|
||||||
|
|
||||||
You also can use [Gradle properties](https://docs.gradle.org/current/userguide/build_environment.html#sec:gradle_configuration_properties) to setup `JDK_*` variables.
|
|
||||||
|
|
||||||
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
|
Note: The JDK 6 for MacOS is not available on Oracle's site. You can install it by
|
||||||
|
|
||||||
|
|||||||
+4
-111
@@ -1,7 +1,6 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import org.gradle.crypto.checksum.Checksum
|
import org.gradle.crypto.checksum.Checksum
|
||||||
import org.gradle.plugins.ide.idea.model.IdeaModel
|
import org.gradle.plugins.ide.idea.model.IdeaModel
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
import proguard.gradle.ProGuardTask
|
import proguard.gradle.ProGuardTask
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
@@ -56,13 +55,6 @@ pill {
|
|||||||
|
|
||||||
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
|
val isTeamcityBuild = project.kotlinBuildProperties.isTeamcityBuild
|
||||||
|
|
||||||
val configuredJdks: List<JdkId> =
|
|
||||||
getConfiguredJdks().also {
|
|
||||||
it.forEach { jdkId ->
|
|
||||||
logger.info("Using ${jdkId.majorVersion} home: ${jdkId.homeDir}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val defaultSnapshotVersion: String by extra
|
val defaultSnapshotVersion: String by extra
|
||||||
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
|
val buildNumber by extra(findProperty("build.number")?.toString() ?: defaultSnapshotVersion)
|
||||||
val kotlinVersion by extra(
|
val kotlinVersion by extra(
|
||||||
@@ -114,37 +106,6 @@ subprojects {
|
|||||||
extra["kotlinNativeVersion"] = kotlinNativeVersionObject
|
extra["kotlinNativeVersion"] = kotlinNativeVersionObject
|
||||||
}
|
}
|
||||||
|
|
||||||
// Work-around necessary to avoid setting null javaHome. Will be removed after support of lazy task configuration
|
|
||||||
val jdkNotFoundConst = "JDK NOT FOUND"
|
|
||||||
|
|
||||||
if (isTeamcityBuild) {
|
|
||||||
extra["JDK_16"] = jdkPath("1.6")
|
|
||||||
extra["JDK_17"] = jdkPath("1.7")
|
|
||||||
} else {
|
|
||||||
extra["JDK_16"] = jdkPath("1.6", "1.8")
|
|
||||||
extra["JDK_17"] = jdkPath("1.7", "1.8")
|
|
||||||
}
|
|
||||||
extra["JDK_18"] = jdkPath("1.8")
|
|
||||||
extra["JDK_9"] = jdkPath("9")
|
|
||||||
extra["JDK_10"] = jdkPath("10")
|
|
||||||
extra["JDK_11"] = jdkPath("11")
|
|
||||||
extra["JDK_15"] = jdkPath("15")
|
|
||||||
|
|
||||||
// allow opening the project without setting up all env variables (see KT-26413)
|
|
||||||
if (!kotlinBuildProperties.isInIdeaSync) {
|
|
||||||
checkJDK()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun checkJDK() {
|
|
||||||
val missingEnvVars = JdkMajorVersion.values()
|
|
||||||
.filter { it.isMandatory() && extra[it.name] == jdkNotFoundConst }
|
|
||||||
.mapTo(ArrayList()) { it.name }
|
|
||||||
|
|
||||||
if (missingEnvVars.isNotEmpty()) {
|
|
||||||
throw GradleException("Required environment variables are missing: ${missingEnvVars.joinToString()}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
rootProject.apply {
|
rootProject.apply {
|
||||||
from(rootProject.file("gradle/versions.gradle.kts"))
|
from(rootProject.file("gradle/versions.gradle.kts"))
|
||||||
from(rootProject.file("gradle/report.gradle.kts"))
|
from(rootProject.file("gradle/report.gradle.kts"))
|
||||||
@@ -423,8 +384,6 @@ fun Task.listConfigurationContents(configName: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val defaultJvmTarget = "1.8"
|
|
||||||
val defaultJavaHome = jdkPath(if (Platform[203].orHigher()) "11" else defaultJvmTarget)
|
|
||||||
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
|
val ignoreTestFailures by extra(project.kotlinBuildProperties.ignoreTestFailures)
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
@@ -470,17 +429,16 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = defaultJvmTarget
|
|
||||||
javaHome = defaultJavaHome
|
|
||||||
|
|
||||||
// There are problems with common build dir:
|
// There are problems with common build dir:
|
||||||
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
|
// - some tests (in particular js and binary-compatibility-validator depend on the fixed (default) location
|
||||||
// - idea seems unable to exclude common buildDir from indexing
|
// - idea seems unable to exclude common buildDir from indexing
|
||||||
// therefore it is disabled by default
|
// therefore it is disabled by default
|
||||||
// buildDir = File(commonBuildDir, project.name)
|
// buildDir = File(commonBuildDir, project.name)
|
||||||
|
|
||||||
|
project.configureJvmDefaultToolchain()
|
||||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
plugins.withId("java-base") {
|
||||||
|
project.configureShadowJarSubstitutionInCompileClasspath()
|
||||||
|
}
|
||||||
|
|
||||||
val commonCompilerArgs = listOfNotNull(
|
val commonCompilerArgs = listOfNotNull(
|
||||||
"-Xopt-in=kotlin.RequiresOptIn",
|
"-Xopt-in=kotlin.RequiresOptIn",
|
||||||
@@ -581,11 +539,6 @@ allprojects {
|
|||||||
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
|
apply(from = "$rootDir/gradle/cacheRedirector.gradle.kts")
|
||||||
|
|
||||||
afterEvaluate {
|
afterEvaluate {
|
||||||
if (javaHome != defaultJavaHome || jvmTarget != defaultJvmTarget) {
|
|
||||||
logger.info("configuring project $name to compile to the target jvm version $jvmTarget using jdk: $javaHome")
|
|
||||||
configureJvmProject(javaHome!!, jvmTarget!!)
|
|
||||||
} // else we will actually fail during the first task execution. We could not fail before configuration is done due to impact on import in IDE
|
|
||||||
|
|
||||||
fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path
|
fun File.toProjectRootRelativePathOrSelf() = (relativeToOrNull(rootDir)?.takeUnless { it.startsWith("..") } ?: this).path
|
||||||
|
|
||||||
fun FileCollection.printClassPath(role: String) =
|
fun FileCollection.printClassPath(role: String) =
|
||||||
@@ -1105,66 +1058,6 @@ configure<IdeaModel> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun jdkPathOrNull(version: String): String? {
|
|
||||||
val jdkName = "JDK_${version.replace(".", "")}"
|
|
||||||
val jdkMajorVersion = JdkMajorVersion.valueOf(jdkName)
|
|
||||||
return configuredJdks.find { it.majorVersion == jdkMajorVersion }?.homeDir?.canonicalPath
|
|
||||||
}
|
|
||||||
|
|
||||||
fun jdkPath(version: String, vararg replacementVersions: String): String {
|
|
||||||
return jdkPathOrNull(version) ?: run {
|
|
||||||
replacementVersions.asSequence().map { jdkPathOrNull(it) }.find { it != null }
|
|
||||||
} ?: jdkNotFoundConst
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.configureJvmProject(javaHome: String, javaVersion: String) {
|
|
||||||
val currentJavaHome = File(System.getProperty("java.home")!!).canonicalPath
|
|
||||||
val shouldFork = !currentJavaHome.startsWith(File(javaHome).canonicalPath)
|
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
if (name != "compileJava9Java") {
|
|
||||||
sourceCompatibility = javaVersion
|
|
||||||
targetCompatibility = javaVersion
|
|
||||||
options.isFork = shouldFork
|
|
||||||
options.forkOptions.javaHome = file(javaHome)
|
|
||||||
options.compilerArgs.add("-proc:none")
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions.jdkHome = javaHome
|
|
||||||
kotlinOptions.jvmTarget = javaVersion
|
|
||||||
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<Test> {
|
|
||||||
executable = File(javaHome, "bin/java").canonicalPath
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins.withId("java-base") {
|
|
||||||
configureShadowJarSubstitutionInCompileClasspath()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.configureShadowJarSubstitutionInCompileClasspath() {
|
|
||||||
val substitutionMap = mapOf(":kotlin-reflect" to ":kotlin-reflect-api")
|
|
||||||
|
|
||||||
fun configureSubstitution(substitution: DependencySubstitution) {
|
|
||||||
val requestedProject = (substitution.requested as? ProjectComponentSelector)?.projectPath ?: return
|
|
||||||
val replacementProject = substitutionMap[requestedProject] ?: return
|
|
||||||
substitution.useTarget(project(replacementProject), "Non-default shadow jars should not be used in compile classpath")
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets.all {
|
|
||||||
for (configName in listOf(compileOnlyConfigurationName, compileClasspathConfigurationName)) {
|
|
||||||
configurations.getByName(configName).resolutionStrategy.dependencySubstitution {
|
|
||||||
all(::configureSubstitution)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.register("findShadowJarsInClasspath") {
|
tasks.register("findShadowJarsInClasspath") {
|
||||||
doLast {
|
doLast {
|
||||||
fun Collection<File>.printSorted(indent: String = " ") {
|
fun Collection<File>.printSorted(indent: String = " ") {
|
||||||
|
|||||||
@@ -4,32 +4,36 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import groovy.lang.Closure
|
import groovy.lang.Closure
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
|
import org.gradle.api.provider.Property
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
import org.gradle.api.tasks.*
|
import org.gradle.api.tasks.*
|
||||||
import org.gradle.internal.jvm.Jvm
|
import org.gradle.jvm.toolchain.JavaLauncher
|
||||||
import org.gradle.internal.jvm.inspection.JvmVersionDetector
|
import org.gradle.kotlin.dsl.property
|
||||||
import proguard.ClassSpecification
|
import proguard.ClassSpecification
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
|
|
||||||
@CacheableTask
|
@CacheableTask
|
||||||
open class CacheableProguardTask @Inject constructor(
|
open class CacheableProguardTask : proguard.gradle.ProGuardTask() {
|
||||||
private val jvmVersionDetector: JvmVersionDetector
|
|
||||||
) : proguard.gradle.ProGuardTask() {
|
|
||||||
|
|
||||||
@Internal
|
@get:Internal
|
||||||
var jdkHome: File? = null
|
val javaLauncher: Property<JavaLauncher> = project.objects.property()
|
||||||
|
|
||||||
|
@get:Internal
|
||||||
|
val jdkHomePath: Provider<File> = javaLauncher.map { it.metadata.installationPath.asFile }
|
||||||
|
|
||||||
@get:Optional
|
@get:Optional
|
||||||
@get:Input
|
@get:Input
|
||||||
internal val jdkMajorVersion: String?
|
internal val jdkMajorVersion: Provider<JavaVersion> = javaLauncher.map {
|
||||||
get() = jdkHome?.let { jvmVersionDetector.getJavaVersion(Jvm.forHome(jdkHome)) }?.majorVersion
|
JavaVersion.toVersion(it.metadata.languageVersion.toString())
|
||||||
|
}
|
||||||
|
|
||||||
@CompileClasspath
|
@CompileClasspath
|
||||||
override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection().filter { libraryFile ->
|
override fun getLibraryJarFileCollection(): FileCollection = super.getLibraryJarFileCollection()
|
||||||
jdkHome?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true
|
.filter { libraryFile ->
|
||||||
}
|
jdkHomePath.orNull?.let { !libraryFile.absoluteFile.startsWith(it.absoluteFile) } ?: true
|
||||||
|
}
|
||||||
|
|
||||||
@InputFiles
|
@InputFiles
|
||||||
@PathSensitive(PathSensitivity.RELATIVE)
|
@PathSensitive(PathSensitivity.RELATIVE)
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
@file:JvmName("JvmToolchain")
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.provider.Provider
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
|
import org.gradle.jvm.toolchain.*
|
||||||
|
import org.gradle.kotlin.dsl.getByType
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinTopLevelExtension
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
enum class JdkMajorVersion(
|
||||||
|
val majorVersion: Int,
|
||||||
|
private val mandatory: Boolean = true
|
||||||
|
) {
|
||||||
|
JDK_1_6(6),
|
||||||
|
JDK_1_7(7),
|
||||||
|
JDK_1_8(8),
|
||||||
|
JDK_9(9),
|
||||||
|
JDK_10(10, false),
|
||||||
|
JDK_11(11, false),
|
||||||
|
JDK_15(15, false),
|
||||||
|
JDK_16(16, false);
|
||||||
|
|
||||||
|
fun isMandatory(): Boolean = mandatory
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.configureJvmDefaultToolchain() {
|
||||||
|
configureJvmToolchain(JdkMajorVersion.JDK_1_8)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.configureJvmToolchain(
|
||||||
|
jdkVersion: JdkMajorVersion
|
||||||
|
) {
|
||||||
|
plugins.withId("org.jetbrains.kotlin.jvm") {
|
||||||
|
val kotlinExtension = extensions.getByType<KotlinTopLevelExtension>()
|
||||||
|
|
||||||
|
kotlinExtension.jvmToolchain {
|
||||||
|
(this as JavaToolchainSpec).languageVersion
|
||||||
|
.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks
|
||||||
|
.matching { it.name != "compileJava9Java" && it is JavaCompile }
|
||||||
|
.configureEach {
|
||||||
|
with(this as JavaCompile) {
|
||||||
|
options.compilerArgs.add("-proc:none")
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<KotlinCompile>().configureEach {
|
||||||
|
kotlinOptions.freeCompilerArgs += "-Xjvm-default=compatibility"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.updateJvmTarget(
|
||||||
|
jvmTarget: String
|
||||||
|
) {
|
||||||
|
tasks.withType<KotlinCompile>().configureEach {
|
||||||
|
kotlinOptions.jvmTarget = jvmTarget
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile>().configureEach {
|
||||||
|
sourceCompatibility = jvmTarget
|
||||||
|
targetCompatibility = jvmTarget
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.getToolchainCompilerFor(
|
||||||
|
jdkVersion: JdkMajorVersion
|
||||||
|
): Provider<JavaCompiler> {
|
||||||
|
val service = project.extensions.getByType<JavaToolchainService>()
|
||||||
|
return service.compilerFor {
|
||||||
|
this.languageVersion.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.getToolchainLauncherFor(
|
||||||
|
jdkVersion: JdkMajorVersion
|
||||||
|
): Provider<JavaLauncher> {
|
||||||
|
val service = project.extensions.getByType<JavaToolchainService>()
|
||||||
|
return service.launcherFor {
|
||||||
|
this.languageVersion.set(JavaLanguageVersion.of(jdkVersion.majorVersion))
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
@file:JvmName("LibrariesCommon")
|
||||||
|
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.file.FileCollection
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
|
import org.gradle.kotlin.dsl.extra
|
||||||
|
import org.gradle.kotlin.dsl.get
|
||||||
|
import org.gradle.kotlin.dsl.provideDelegate
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import org.gradle.process.CommandLineArgumentProvider
|
||||||
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
|
@JvmOverloads
|
||||||
|
fun Project.configureJava9Compilation(
|
||||||
|
moduleName: String,
|
||||||
|
moduleOutputs: Collection<FileCollection> = setOf(sourceSets["main"].output)
|
||||||
|
) {
|
||||||
|
configurations["java9CompileClasspath"].extendsFrom(configurations["compileClasspath"])
|
||||||
|
|
||||||
|
tasks.named("compileJava9Java", JavaCompile::class.java) {
|
||||||
|
dependsOn(moduleOutputs)
|
||||||
|
|
||||||
|
javaCompiler.set(getToolchainCompilerFor(JdkMajorVersion.JDK_9))
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_9.toString()
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_9.toString()
|
||||||
|
|
||||||
|
// module-info.java should be in java9 source set by convention
|
||||||
|
val java9SourceSet = sourceSets["java9"].java
|
||||||
|
destinationDir = file("${java9SourceSet.outputDir}/META-INF/versions/9")
|
||||||
|
options.sourcepath = files(java9SourceSet.srcDirs)
|
||||||
|
val compileClasspath = configurations["java9CompileClasspath"]
|
||||||
|
val moduleFiles = objects.fileCollection().from(moduleOutputs)
|
||||||
|
val modulePath = compileClasspath.filter { it !in moduleFiles.files }
|
||||||
|
classpath = objects.fileCollection().from()
|
||||||
|
options.compilerArgumentProviders.add(
|
||||||
|
Java9AdditionalArgumentsProvider(
|
||||||
|
moduleName,
|
||||||
|
moduleFiles,
|
||||||
|
modulePath
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Java9AdditionalArgumentsProvider(
|
||||||
|
private val moduleName: String,
|
||||||
|
private val moduleFiles: FileCollection,
|
||||||
|
private val modulePath: FileCollection
|
||||||
|
) : CommandLineArgumentProvider {
|
||||||
|
override fun asArguments(): Iterable<String> = listOf(
|
||||||
|
"--module-path", modulePath.asPath,
|
||||||
|
"--patch-module", "$moduleName=${moduleFiles.asPath}",
|
||||||
|
"-Xlint:-requires-transitive-automatic" // suppress automatic module transitive dependencies in kotlin.test
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.disableDeprecatedJvmTargetWarning() {
|
||||||
|
if (!kotlinBuildProperties.disableWerror) {
|
||||||
|
val tasksWithWarnings: List<String> by rootProject.extra
|
||||||
|
tasks.withType<KotlinCompile>().configureEach {
|
||||||
|
if (!tasksWithWarnings.contains(path)) {
|
||||||
|
kotlinOptions {
|
||||||
|
allWarningsAsErrors = true
|
||||||
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,6 +13,8 @@ import org.gradle.api.artifacts.*
|
|||||||
import org.gradle.api.artifacts.dsl.DependencyHandler
|
import org.gradle.api.artifacts.dsl.DependencyHandler
|
||||||
import org.gradle.api.file.ConfigurableFileCollection
|
import org.gradle.api.file.ConfigurableFileCollection
|
||||||
import org.gradle.api.file.FileCollection
|
import org.gradle.api.file.FileCollection
|
||||||
|
import org.gradle.internal.jvm.Jvm
|
||||||
|
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||||
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
|
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
|
||||||
import org.gradle.kotlin.dsl.closureOf
|
import org.gradle.kotlin.dsl.closureOf
|
||||||
import org.gradle.kotlin.dsl.exclude
|
import org.gradle.kotlin.dsl.exclude
|
||||||
@@ -287,14 +289,16 @@ fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = Fi
|
|||||||
|
|
||||||
fun Project.toolsJarApi(): Any =
|
fun Project.toolsJarApi(): Any =
|
||||||
if (kotlinBuildProperties.isInJpsBuildIdeaSync)
|
if (kotlinBuildProperties.isInJpsBuildIdeaSync)
|
||||||
files(toolsJarFile() ?: error("tools.jar is not found!"))
|
toolsJar()
|
||||||
else
|
else
|
||||||
dependencies.project(":dependencies:tools-jar-api")
|
dependencies.project(":dependencies:tools-jar-api")
|
||||||
|
|
||||||
fun Project.toolsJar(): FileCollection = files(toolsJarFile() ?: error("tools.jar is not found!"))
|
fun Project.toolsJar(): FileCollection = files(
|
||||||
|
getToolchainLauncherFor(JdkMajorVersion.JDK_1_8)
|
||||||
fun Project.toolsJarFile(jdkHome: File = File(this.property("JDK_18") as String)): File? =
|
.map {
|
||||||
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
|
Jvm.forHome(it.metadata.installationPath.asFile).toolsJar ?: throw GradleException("tools.jar not found!")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
val compilerManifestClassPath
|
val compilerManifestClassPath
|
||||||
get() = "annotations-13.0.jar kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar trove4j.jar"
|
get() = "annotations-13.0.jar kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar trove4j.jar"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.artifacts.DependencySubstitution
|
||||||
|
import org.gradle.api.artifacts.component.ProjectComponentSelector
|
||||||
import org.gradle.api.file.DuplicatesStrategy
|
import org.gradle.api.file.DuplicatesStrategy
|
||||||
import org.gradle.api.tasks.TaskProvider
|
import org.gradle.api.tasks.TaskProvider
|
||||||
import org.gradle.jvm.tasks.Jar
|
import org.gradle.jvm.tasks.Jar
|
||||||
@@ -80,6 +82,24 @@ private fun Project.compilerShadowJar(taskName: String, body: ShadowJar.() -> Un
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Project.configureShadowJarSubstitutionInCompileClasspath() {
|
||||||
|
val substitutionMap = mapOf(":kotlin-reflect" to ":kotlin-reflect-api")
|
||||||
|
|
||||||
|
fun configureSubstitution(substitution: DependencySubstitution) {
|
||||||
|
val requestedProject = (substitution.requested as? ProjectComponentSelector)?.projectPath ?: return
|
||||||
|
val replacementProject = substitutionMap[requestedProject] ?: return
|
||||||
|
substitution.useTarget(project(replacementProject), "Non-default shadow jars should not be used in compile classpath")
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets.all {
|
||||||
|
for (configName in listOf(compileOnlyConfigurationName, compileClasspathConfigurationName)) {
|
||||||
|
configurations.getByName(configName).resolutionStrategy.dependencySubstitution {
|
||||||
|
all(::configureSubstitution)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider<out ShadowJar> =
|
fun Project.embeddableCompiler(taskName: String = "embeddable", body: ShadowJar.() -> Unit = {}): TaskProvider<out ShadowJar> =
|
||||||
compilerShadowJar(taskName) {
|
compilerShadowJar(taskName) {
|
||||||
configureEmbeddableCompilerRelocation()
|
configureEmbeddableCompilerRelocation()
|
||||||
|
|||||||
@@ -1,198 +0,0 @@
|
|||||||
@file:Suppress("unused") // usages in build scripts are not tracked properly
|
|
||||||
|
|
||||||
import net.rubygrapefruit.platform.Native
|
|
||||||
import net.rubygrapefruit.platform.WindowsRegistry
|
|
||||||
import org.gradle.api.GradleException
|
|
||||||
import org.gradle.api.Project
|
|
||||||
import java.nio.file.Paths
|
|
||||||
import java.io.File
|
|
||||||
import net.rubygrapefruit.platform.WindowsRegistry.Key.HKEY_LOCAL_MACHINE
|
|
||||||
import org.gradle.internal.os.OperatingSystem
|
|
||||||
|
|
||||||
enum class JdkMajorVersion(private val mandatory: Boolean = true) {
|
|
||||||
JDK_16, JDK_17, JDK_18, JDK_9, JDK_10(false), JDK_11(false), /*15.0*/JDK_15(false);
|
|
||||||
|
|
||||||
fun isMandatory(): Boolean = mandatory
|
|
||||||
}
|
|
||||||
|
|
||||||
val jdkAlternativeVarNames = mapOf(JdkMajorVersion.JDK_9 to listOf("JDK_19"), JdkMajorVersion.JDK_15 to listOf("JDK_15_0"))
|
|
||||||
|
|
||||||
data class JdkId(val explicit: Boolean, val majorVersion: JdkMajorVersion, var version: String, var homeDir: File)
|
|
||||||
|
|
||||||
fun Project.getConfiguredJdks(): List<JdkId> {
|
|
||||||
val res = arrayListOf<JdkId>()
|
|
||||||
for (jdkMajorVersion in JdkMajorVersion.values()) {
|
|
||||||
val explicitJdkEnvVal = findProperty(jdkMajorVersion.name)?.toString()
|
|
||||||
?: System.getenv(jdkMajorVersion.name)
|
|
||||||
?: jdkAlternativeVarNames[jdkMajorVersion]?.mapNotNull { System.getenv(it) }?.firstOrNull()
|
|
||||||
?: continue
|
|
||||||
val explicitJdk = Paths.get(explicitJdkEnvVal).toRealPath().toFile()
|
|
||||||
if (!explicitJdk.isDirectory) {
|
|
||||||
throw GradleException("Invalid environment value $jdkMajorVersion: $explicitJdkEnvVal, expecting JDK home path")
|
|
||||||
}
|
|
||||||
res.add(JdkId(true, jdkMajorVersion, "X", explicitJdk))
|
|
||||||
}
|
|
||||||
if (res.size < JdkMajorVersion.values().size) {
|
|
||||||
res.discoverJdks(this)
|
|
||||||
}
|
|
||||||
return res
|
|
||||||
}
|
|
||||||
|
|
||||||
// see JEP 223
|
|
||||||
private val javaMajorVersionRegex = Regex("""(?:1\.)?(\d+).*""")
|
|
||||||
private val javaVersionRegex = Regex("""(?:1\.)?(\d+)(\.\d+)?([+-_]\w+){0,3}""")
|
|
||||||
|
|
||||||
fun MutableCollection<JdkId>.addIfBetter(project: Project, version: String, id: String, homeDir: File): Boolean {
|
|
||||||
val matchString = javaMajorVersionRegex.matchEntire(version)?.groupValues?.get(1)
|
|
||||||
val majorJdkVersion = when (matchString) {
|
|
||||||
"6" -> JdkMajorVersion.JDK_16
|
|
||||||
"7" -> JdkMajorVersion.JDK_17
|
|
||||||
"8" -> JdkMajorVersion.JDK_18
|
|
||||||
"9" -> JdkMajorVersion.JDK_9
|
|
||||||
else -> {
|
|
||||||
project.logger.info("Cannot recognize version string '$version' (found version '$matchString')")
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
val prev = find { it.majorVersion == majorJdkVersion }
|
|
||||||
if (prev == null) {
|
|
||||||
add(JdkId(false, majorJdkVersion, version, homeDir))
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
if (prev.explicit) return false
|
|
||||||
val versionsComparisonRes = compareVersions(prev.version, version)
|
|
||||||
if (versionsComparisonRes < 0 || (versionsComparisonRes == 0 && id.contains("64"))) { // prefer 64-bit
|
|
||||||
prev.version = version
|
|
||||||
prev.homeDir = homeDir
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun compareVersions(left: String, right: String): Int {
|
|
||||||
if (left == right) return 0
|
|
||||||
fun MatchResult.extractNumVer(): List<Int> =
|
|
||||||
groups.drop(2).map {
|
|
||||||
it?.value?.filter { it in '0'..'9' }?.toIntOrNull() ?: 0
|
|
||||||
}
|
|
||||||
val lmi = (javaVersionRegex.matchEntire(left)?.extractNumVer() ?: emptyList()).iterator()
|
|
||||||
val rmi = (javaVersionRegex.matchEntire(right)?.extractNumVer() ?: emptyList()).iterator()
|
|
||||||
while (lmi.hasNext() && rmi.hasNext()) {
|
|
||||||
val l = lmi.next()
|
|
||||||
val r = rmi.next()
|
|
||||||
when {
|
|
||||||
l < r -> return -1
|
|
||||||
l > r -> return 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return when {
|
|
||||||
rmi.hasNext() -> -1
|
|
||||||
lmi.hasNext() -> 1
|
|
||||||
else -> 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun MutableCollection<JdkId>.discoverJdks(project: Project) {
|
|
||||||
val os = OperatingSystem.current()
|
|
||||||
when {
|
|
||||||
os.isWindows -> discoverJdksOnWindows(project)
|
|
||||||
os.isMacOsX -> discoverJdksOnMacOS(project)
|
|
||||||
else -> discoverJdksOnUnix(project)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val macOsJavaHomeOutRegexes =
|
|
||||||
listOf(
|
|
||||||
Regex("""\s+(\S+),\s+(\S+):\s+".*?"\s+(.+)"""),
|
|
||||||
Regex("""\s+(\S+)\s+\((.*?)\):\s+(.+)"""),
|
|
||||||
Regex("""\s+(\S+)\s+\((.*?)\)\s+"[^"]*"\s+-\s+"[^"]*"\s(.+)"""),
|
|
||||||
Regex("""\s+(\S+)\s+\((.+)\)\s+".+"\s+-\s+".+"\s+(.+)"""))
|
|
||||||
|
|
||||||
fun MutableCollection<JdkId>.discoverJdksOnMacOS(project: Project) {
|
|
||||||
val procBuilder = ProcessBuilder("/usr/libexec/java_home", "-V").redirectErrorStream(true)
|
|
||||||
val process = procBuilder.start()
|
|
||||||
val retCode = process.waitFor()
|
|
||||||
if (retCode != 0) throw GradleException("Unable to run 'java_home', return code $retCode")
|
|
||||||
process.inputStream.bufferedReader().forEachLine { line ->
|
|
||||||
for (rex in macOsJavaHomeOutRegexes) {
|
|
||||||
val matchResult = rex.matchEntire(line)
|
|
||||||
if (matchResult != null) {
|
|
||||||
val jdkHomeDir = File(matchResult.groupValues[3])
|
|
||||||
// Filter out JRE installed at /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/
|
|
||||||
// and shown by the java_home tool
|
|
||||||
if (!jdkHomeDir.path.contains("JavaAppletPlugin.plugin")) {
|
|
||||||
addIfBetter(project, matchResult.groupValues[1], matchResult.groupValues[0], jdkHomeDir)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val unixConventionalJdkLocations = listOf(
|
|
||||||
"/usr/lib/jvm", // *deb, Arch
|
|
||||||
"/opt", // *rpm, Gentoo, HP/UX
|
|
||||||
"/usr/lib", // Slackware 32
|
|
||||||
"/usr/lib64", // Slackware 64
|
|
||||||
"/usr/local", // OpenBSD, FreeBSD
|
|
||||||
"/usr/pkg/java", // NetBSD
|
|
||||||
"/usr/jdk/instances") // Solaris
|
|
||||||
|
|
||||||
private val unixConventionalJdkDirRex = Regex("jdk|jre|java|zulu")
|
|
||||||
|
|
||||||
fun MutableCollection<JdkId>.discoverJdksOnUnix(project: Project) {
|
|
||||||
for (loc in unixConventionalJdkLocations) {
|
|
||||||
val installedJdks = File(loc).listFiles { dir ->
|
|
||||||
dir.isDirectory &&
|
|
||||||
unixConventionalJdkDirRex.containsMatchIn(dir.name) &&
|
|
||||||
fileFrom(dir, "bin", "java").isFile
|
|
||||||
} ?: continue
|
|
||||||
for (dir in installedJdks) {
|
|
||||||
val versionMatch = javaVersionRegex.find(dir.name)
|
|
||||||
if (versionMatch == null) {
|
|
||||||
project.logger.info("Unable to extract version from possible JDK dir: $dir")
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
addIfBetter(project, versionMatch.value, dir.name, dir)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private val windowsConventionalJdkRegistryPaths = listOf(
|
|
||||||
"SOFTWARE\\JavaSoft\\Java Development Kit",
|
|
||||||
"SOFTWARE\\Wow6432Node\\JavaSoft\\Java Development Kit",
|
|
||||||
"SOFTWARE\\JavaSoft\\JDK",
|
|
||||||
"SOFTWARE\\Wow6432Node\\JavaSoft\\JDK")
|
|
||||||
|
|
||||||
fun MutableCollection<JdkId>.discoverJdksOnWindows(project: Project) {
|
|
||||||
val registry = Native.get(WindowsRegistry::class.java)
|
|
||||||
for (regPath in windowsConventionalJdkRegistryPaths) {
|
|
||||||
val jdkKeys = try {
|
|
||||||
registry.getSubkeys(HKEY_LOCAL_MACHINE, regPath)
|
|
||||||
} catch (e: RuntimeException) {
|
|
||||||
// ignore missing nodes
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for (jdkKey in jdkKeys) {
|
|
||||||
try {
|
|
||||||
val javaHome = registry.getStringValue(HKEY_LOCAL_MACHINE, regPath + "\\" + jdkKey, "JavaHome")
|
|
||||||
val versionMatch = javaVersionRegex.find(jdkKey)
|
|
||||||
if (versionMatch == null) {
|
|
||||||
project.logger.info("Unable to extract version from possible JDK location: $javaHome ($jdkKey)")
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
javaHome.takeIf { it.isNotEmpty() }
|
|
||||||
?.let { File(it) }
|
|
||||||
?.takeIf { it.isDirectory && fileFrom(it, "bin", "java.exe").isFile }
|
|
||||||
?.let {
|
|
||||||
addIfBetter(project, versionMatch.value, jdkKey, it)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (e: RuntimeException) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,8 +5,13 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
// This module does not apply Kotlin plugin, so we are setting toolchain via
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
// java extension
|
||||||
|
java {
|
||||||
|
toolchain {
|
||||||
|
languageVersion.set(JavaLanguageVersion.of(6))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val kotlinVersion: String by rootProject.extra
|
val kotlinVersion: String by rootProject.extra
|
||||||
|
|
||||||
@@ -19,15 +24,10 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<ProcessResources>("processResources") {
|
tasks.named<ProcessResources>("processResources") {
|
||||||
val kotlinVersionLocal = kotlinVersion
|
val kotlinVersionLocal = kotlinVersion
|
||||||
inputs.property("compilerVersion", kotlinVersionLocal)
|
inputs.property("compilerVersion", kotlinVersionLocal)
|
||||||
filesMatching("META-INF/compiler.version") {
|
filesMatching("META-INF/compiler.version") {
|
||||||
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to kotlinVersionLocal))
|
filter<ReplaceTokens>("tokens" to mapOf("snapshot" to kotlinVersionLocal))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ projectTest("testJvmICWithJdk11", parallel = true) {
|
|||||||
filter {
|
filter {
|
||||||
includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunnerTestGenerated*")
|
includeTestsMatching("org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunnerTestGenerated*")
|
||||||
}
|
}
|
||||||
executable = "${rootProject.extra["JDK_11"]}/bin/java"
|
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_11))
|
||||||
}
|
}
|
||||||
|
|
||||||
testsJar()
|
testsJar()
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
@@ -28,40 +26,45 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Project.codegenTest(
|
fun Project.codegenTest(
|
||||||
target: Int, jvm: Int,
|
target: Int,
|
||||||
jdk: String = "JDK_${if (jvm <= 8) "1" else ""}$jvm",
|
jdk: JdkMajorVersion,
|
||||||
body: Test.() -> Unit
|
jvm: String = jdk.majorVersion.toString(),
|
||||||
) {
|
|
||||||
codegenTest(target, jvm.toString(), jdk, body = body)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun Project.codegenTest(
|
|
||||||
target: Int, jvm: String, jdk: String,
|
|
||||||
targetInTestClass: String = "$target",
|
targetInTestClass: String = "$target",
|
||||||
body: Test.() -> Unit
|
body: Test.() -> Unit = {}
|
||||||
): TaskProvider<Test> = projectTest("codegenTarget${targetInTestClass}Jvm${jvm}Test", jUnit5Enabled = true) {
|
): TaskProvider<Test> = projectTest(
|
||||||
|
taskName = "codegenTarget${targetInTestClass}Jvm${jvm}Test",
|
||||||
|
jUnit5Enabled = true
|
||||||
|
) {
|
||||||
dependsOn(":dist")
|
dependsOn(":dist")
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
|
|
||||||
val testName = "JvmTarget${targetInTestClass}OnJvm${jvm}"
|
val testName = "JvmTarget${targetInTestClass}OnJvm${jvm}"
|
||||||
filter.includeTestsMatching("org.jetbrains.kotlin.codegen.jdk.$testName")
|
filter.includeTestsMatching("org.jetbrains.kotlin.codegen.jdk.$testName")
|
||||||
|
|
||||||
|
javaLauncher.set(project.getToolchainLauncherFor(jdk))
|
||||||
|
|
||||||
systemProperty("kotlin.test.default.jvm.target", "${if (target <= 8) "1." else ""}$target")
|
systemProperty("kotlin.test.default.jvm.target", "${if (target <= 8) "1." else ""}$target")
|
||||||
body()
|
body()
|
||||||
doFirst {
|
doFirst {
|
||||||
val jdkPath = project.findProperty(jdk) ?: error("$jdk is not optional to run this test")
|
logger.warn("Running tests with $target target and ${javaLauncher.get().metadata.installationPath.asFile}")
|
||||||
executable = "$jdkPath/bin/java"
|
|
||||||
println("Running tests with $target target and $executable")
|
|
||||||
}
|
}
|
||||||
group = "verification"
|
group = "verification"
|
||||||
}
|
}
|
||||||
|
|
||||||
codegenTest(target = 6, jvm = 6, jdk = "JDK_18") {
|
codegenTest(
|
||||||
|
target = 6,
|
||||||
|
jdk = JdkMajorVersion.JDK_1_8,
|
||||||
|
jvm = JdkMajorVersion.JDK_1_6.majorVersion.toString()
|
||||||
|
) {
|
||||||
dependsOn(testJvm6ServerRuntime)
|
dependsOn(testJvm6ServerRuntime)
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
systemProperty("kotlin.test.default.jvm.target", "1.6")
|
systemProperty("kotlin.test.default.jvm.target", "1.6")
|
||||||
systemProperty("kotlin.test.java.compilation.target", "1.6")
|
systemProperty("kotlin.test.java.compilation.target", "1.6")
|
||||||
|
systemProperty(
|
||||||
|
"JDK_16",
|
||||||
|
project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_6).get().metadata.installationPath.asFile.absolutePath
|
||||||
|
)
|
||||||
|
|
||||||
val port = project.findProperty("kotlin.compiler.codegen.tests.port") ?: "5100"
|
val port = project.findProperty("kotlin.compiler.codegen.tests.port") ?: "5100"
|
||||||
systemProperty("kotlin.test.box.in.separate.process.port", port)
|
systemProperty("kotlin.test.box.in.separate.process.port", port)
|
||||||
@@ -70,37 +73,36 @@ codegenTest(target = 6, jvm = 6, jdk = "JDK_18") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//JDK 8
|
//JDK 8
|
||||||
codegenTest(target = 6, jvm = 8) {}
|
codegenTest(target = 6, jdk = JdkMajorVersion.JDK_1_8)
|
||||||
|
|
||||||
// This is default one and is executed in default build configuration
|
// This is default one and is executed in default build configuration
|
||||||
codegenTest(target = 8, jvm = 8) {}
|
codegenTest(target = 8, jdk = JdkMajorVersion.JDK_1_8)
|
||||||
|
|
||||||
//JDK 11
|
//JDK 11
|
||||||
codegenTest(target = 6, jvm = 11) {}
|
codegenTest(target = 6, jdk = JdkMajorVersion.JDK_11)
|
||||||
|
|
||||||
codegenTest(target = 8, jvm = 11) {}
|
codegenTest(target = 8, jdk = JdkMajorVersion.JDK_11)
|
||||||
|
|
||||||
codegenTest(target = 11, jvm = 11) {}
|
codegenTest(target = 11, jdk = JdkMajorVersion.JDK_11)
|
||||||
|
|
||||||
//JDK 15
|
//JDK 15
|
||||||
codegenTest(target = 6, jvm = 15) {}
|
codegenTest(target = 6, jdk = JdkMajorVersion.JDK_15)
|
||||||
|
|
||||||
codegenTest(target = 8, jvm = 15) {}
|
codegenTest(target = 8, jdk = JdkMajorVersion.JDK_15)
|
||||||
|
|
||||||
codegenTest(target = 15, jvm = 15) {
|
codegenTest(target = 15, jdk = JdkMajorVersion.JDK_15) {
|
||||||
systemProperty("kotlin.test.box.d8.disable", true)
|
systemProperty("kotlin.test.box.d8.disable", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
//..also add this two tasks to build after adding fresh jdks to build agents
|
//..also add this two tasks to build after adding fresh jdks to build agents
|
||||||
val mostRecentJdk = JdkMajorVersion.values().last().name
|
val mostRecentJdk = JdkMajorVersion.values().last()
|
||||||
|
|
||||||
//LAST JDK from JdkMajorVersion available on machine
|
//LAST JDK from JdkMajorVersion available on machine
|
||||||
codegenTest(target = 6, jvm = "Last", jdk = mostRecentJdk) {}
|
codegenTest(target = 6, jvm = "Last", jdk = mostRecentJdk)
|
||||||
|
codegenTest(target = 8, jvm = "Last", jdk = mostRecentJdk)
|
||||||
codegenTest(target = 8, jvm = "Last", jdk = mostRecentJdk) {}
|
|
||||||
|
|
||||||
codegenTest(
|
codegenTest(
|
||||||
mostRecentJdk.substringAfter('_').toInt(),
|
target = mostRecentJdk.majorVersion,
|
||||||
targetInTestClass = "Last",
|
targetInTestClass = "Last",
|
||||||
jvm = "Last",
|
jvm = "Last",
|
||||||
jdk = mostRecentJdk
|
jdk = mostRecentJdk
|
||||||
|
|||||||
+3
-1
@@ -37,9 +37,11 @@ object SeparateJavaProcessHelper {
|
|||||||
|
|
||||||
private fun initJdkProcess() {
|
private fun initJdkProcess() {
|
||||||
println("Configuring JDK6 Test server...")
|
println("Configuring JDK6 Test server...")
|
||||||
val jdkPath = System.getenv("JDK_16") ?: error("JDK_16 is not optional to run this test")
|
val jdkPath = System.getProperty("JDK_16") ?: error("JDK_16 is not optional to run this test")
|
||||||
|
|
||||||
val executable = File(jdkPath, "bin/java").canonicalPath
|
val executable = File(jdkPath, "bin/java").canonicalPath
|
||||||
|
assert(File(executable).exists()) { "Not a JDK path: $jdkPath"}
|
||||||
|
|
||||||
val main = "org.jetbrains.kotlin.test.clientserver.TestProcessServer"
|
val main = "org.jetbrains.kotlin.test.clientserver.TestProcessServer"
|
||||||
val classpath =
|
val classpath =
|
||||||
System.getProperty("kotlin.test.box.in.separate.process.server.classpath") ?: System.getProperty("java.class.path")
|
System.getProperty("kotlin.test.box.in.separate.process.server.classpath") ?: System.getProperty("java.class.path")
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
|
|
||||||
projectTest(parallel = true) {
|
projectTest(parallel = true) {
|
||||||
executable = "${rootProject.extra["JDK_18"]!!}/bin/java"
|
|
||||||
dependsOn(":dist")
|
dependsOn(":dist")
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":core:compiler.common"))
|
api(project(":core:compiler.common"))
|
||||||
@@ -15,11 +14,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(project(":core:util.runtime"))
|
compile(project(":core:util.runtime"))
|
||||||
@@ -17,11 +16,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(project(":kotlin-annotations-jvm"))
|
compile(project(":kotlin-annotations-jvm"))
|
||||||
@@ -21,11 +20,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -1,10 +1,24 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.UsesKotlinJavaToolchain
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only compilation tasks should use JDK 1.6
|
||||||
|
project.disableDeprecatedJvmTargetWarning()
|
||||||
|
tasks
|
||||||
|
.matching { it.name == "compileKotlin" && it is UsesKotlinJavaToolchain }
|
||||||
|
.configureEach {
|
||||||
|
(this as UsesKotlinJavaToolchain).kotlinJavaToolchain.toolchain.use(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_6))
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks
|
||||||
|
.matching { it.name == "compileJava" && it is JavaCompile }
|
||||||
|
.configureEach {
|
||||||
|
(this as JavaCompile).javaCompiler.set(project.getToolchainCompilerFor(JdkMajorVersion.JDK_1_6))
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(project(":core:util.runtime"))
|
compileOnly(project(":core:util.runtime"))
|
||||||
compileOnly(project(":core:descriptors"))
|
compileOnly(project(":core:descriptors"))
|
||||||
@@ -23,19 +37,6 @@ sourceSets {
|
|||||||
"test" { projectDefault() }
|
"test" { projectDefault() }
|
||||||
}
|
}
|
||||||
|
|
||||||
val compileJava by tasks.getting(JavaCompile::class) {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
val compileKotlin by tasks.getting(KotlinCompile::class) {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.6"
|
|
||||||
jdkHome = rootProject.extra["JDK_16"] as String
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateRuntimeDescriptorTestsKt")
|
val generateTests by generator("org.jetbrains.kotlin.generators.tests.GenerateRuntimeDescriptorTestsKt")
|
||||||
|
|
||||||
projectTest(parallel = true) {
|
projectTest(parallel = true) {
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(project(":core:compiler.common"))
|
compile(project(":core:compiler.common"))
|
||||||
@@ -18,11 +17,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":core:metadata.jvm"))
|
api(project(":core:metadata.jvm"))
|
||||||
@@ -17,11 +16,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":core:compiler.common"))
|
api(project(":core:compiler.common"))
|
||||||
@@ -16,11 +15,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(project(":core:metadata"))
|
compile(project(":core:metadata"))
|
||||||
@@ -19,11 +18,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
api(project(":core:metadata"))
|
api(project(":core:metadata"))
|
||||||
@@ -15,11 +14,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(protobufLite())
|
compile(protobufLite())
|
||||||
@@ -16,11 +15,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
@@ -3,8 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly(kotlinStdlib())
|
compileOnly(kotlinStdlib())
|
||||||
@@ -15,11 +14,6 @@ sourceSets {
|
|||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
||||||
|
|||||||
+2
-3
@@ -5,6 +5,7 @@ import java.util.zip.ZipFile
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
base
|
base
|
||||||
|
`java-base`
|
||||||
}
|
}
|
||||||
|
|
||||||
val runtimeElements by configurations.creating {
|
val runtimeElements by configurations.creating {
|
||||||
@@ -15,10 +16,8 @@ val runtimeElements by configurations.creating {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val JDK_18: String by rootProject.extra
|
|
||||||
|
|
||||||
val toolsJarStubs by tasks.registering {
|
val toolsJarStubs by tasks.registering {
|
||||||
val toolsJarFile = toolsJarFile(jdkHome = File(JDK_18)) ?: error("Couldn't find tools.jar in $JDK_18")
|
val toolsJarFile = toolsJar().singleFile
|
||||||
inputs.file(toolsJarFile)
|
inputs.file(toolsJarFile)
|
||||||
|
|
||||||
val outDir = buildDir.resolve(name)
|
val outDir = buildDir.resolve(name)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ org.gradle.jvmargs=-Duser.country=US -Dkotlin.daemon.jvm.options=-Xmx2200m -Dfil
|
|||||||
|
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
org.gradle.caching=true
|
org.gradle.caching=true
|
||||||
|
org.gradle.java.installations.fromEnv=JDK_16,JDK_17,JDK_18,JDK_9,JDK_10,JDK_11,JDK_15
|
||||||
|
|
||||||
cacheRedirectorEnabled=true
|
cacheRedirectorEnabled=true
|
||||||
defaultSnapshotVersion=1.5.255-SNAPSHOT
|
defaultSnapshotVersion=1.5.255-SNAPSHOT
|
||||||
@@ -24,6 +25,9 @@ kotlin.build.publishing.attempts=20
|
|||||||
|
|
||||||
## The following properties can be added to your local.properties file to customize the build:
|
## The following properties can be added to your local.properties file to customize the build:
|
||||||
|
|
||||||
|
# Enable when https://youtrack.jetbrains.com/issue/KT-47520 will be fixed
|
||||||
|
kotlin.jvm.target.validation.mode=ignore
|
||||||
|
|
||||||
#jpsBuild=true
|
#jpsBuild=true
|
||||||
#cidrPluginsEnabled=true
|
#cidrPluginsEnabled=true
|
||||||
#idea.fir.plugin=true
|
#idea.fir.plugin=true
|
||||||
|
|||||||
@@ -1,84 +1,5 @@
|
|||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
ext.configureJavaOnlyJvm6Project = { Project project ->
|
|
||||||
project.tasks.withType(JavaCompile) {
|
|
||||||
sourceCompatibility = 1.6
|
|
||||||
targetCompatibility = 1.6
|
|
||||||
options.fork = true
|
|
||||||
options.forkOptions.javaHome = file(JDK_16)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> tasksWithWarnings = (List<String>) rootProject.ext.get("tasksWithWarnings")
|
|
||||||
|
|
||||||
ext.configureJvm6Project = { Project project ->
|
|
||||||
project.configure(project) {
|
|
||||||
configurations {
|
|
||||||
sources
|
|
||||||
}
|
|
||||||
|
|
||||||
project.ext.jvmTarget = "1.6"
|
|
||||||
project.ext.javaHome = JDK_16
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
|
||||||
classifier = 'sources'
|
|
||||||
from sourceSets.main.kotlin
|
|
||||||
}
|
|
||||||
|
|
||||||
configureJavaOnlyJvm6Project(project)
|
|
||||||
|
|
||||||
tasks.withType(project.compileKotlin.class) {
|
|
||||||
kotlinOptions.jdkHome = JDK_16
|
|
||||||
kotlinOptions.jvmTarget = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
test {
|
|
||||||
executable = "$JDK_16/bin/java"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!BuildPropertiesExtKt.getDisableWerror(project.kotlinBuildProperties)) {
|
|
||||||
project.tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile.class) { task ->
|
|
||||||
if (!tasksWithWarnings.contains(task.path)) {
|
|
||||||
task.kotlinOptions {
|
|
||||||
allWarningsAsErrors = true
|
|
||||||
freeCompilerArgs += "-Xsuppress-deprecated-jvm-target-warning"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ext.compileJava9Sources = { Project project, String moduleName, Collection<FileCollection> moduleOutputs = [project.sourceSets.main.output] ->
|
|
||||||
// module-info.java should be in java9 source set by convention
|
|
||||||
SourceDirectorySet java9SourceSet = project.sourceSets.java9.java
|
|
||||||
project.configurations.java9CompileClasspath.extendsFrom(project.configurations.compileClasspath)
|
|
||||||
project.tasks.getByName("compileJava9Java").configure { JavaCompile it ->
|
|
||||||
dependsOn(moduleOutputs)
|
|
||||||
it.sourceCompatibility = 1.9
|
|
||||||
it.targetCompatibility = 1.9
|
|
||||||
it.destinationDir = file("${java9SourceSet.outputDir}/META-INF/versions/9")
|
|
||||||
it.options.fork = true
|
|
||||||
it.options.forkOptions.javaHome = file(JDK_9)
|
|
||||||
it.options.sourcepath = files(java9SourceSet.srcDirs)
|
|
||||||
def compileClasspath = project.configurations.java9CompileClasspath
|
|
||||||
def objects = project.objects
|
|
||||||
|
|
||||||
doFirst {
|
|
||||||
def moduleFiles = objects.fileCollection().from(*moduleOutputs)
|
|
||||||
def modulePath = compileClasspath.filter { !(it in moduleFiles.files) }
|
|
||||||
|
|
||||||
options.compilerArgs = [
|
|
||||||
'--module-path', modulePath.asPath,
|
|
||||||
'--patch-module', "$moduleName=${moduleFiles.asPath}",
|
|
||||||
'-Xlint:-requires-transitive-automatic' // suppress automatic module transitive dependencies in kotlin.test
|
|
||||||
]
|
|
||||||
|
|
||||||
classpath = objects.fileCollection().from()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ext.manifestAttributes = { Manifest manifest, Project project, String component = null, boolean multiRelease = false ->
|
ext.manifestAttributes = { Manifest manifest, Project project, String component = null, boolean multiRelease = false ->
|
||||||
project.configure(manifest) {
|
project.configure(manifest) {
|
||||||
attributes \
|
attributes \
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ description = 'Kotlin Test Annotations Common'
|
|||||||
|
|
||||||
apply plugin: 'kotlin-platform-common'
|
apply plugin: 'kotlin-platform-common'
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile kotlinStdlib("common")
|
compile kotlinStdlib("common")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ description = 'Kotlin Test Common'
|
|||||||
|
|
||||||
apply plugin: 'kotlin-platform-common'
|
apply plugin: 'kotlin-platform-common'
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile kotlinStdlib("common")
|
compile kotlinStdlib("common")
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ description = 'Kotlin Test JUnit'
|
|||||||
|
|
||||||
apply plugin: 'kotlin-platform-jvm'
|
apply plugin: 'kotlin-platform-jvm'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
@@ -47,5 +48,5 @@ compileTestKotlin {
|
|||||||
configureJvmIrBackend(project)
|
configureJvmIrBackend(project)
|
||||||
|
|
||||||
if (includeJava9) {
|
if (includeJava9) {
|
||||||
compileJava9Sources(project, 'kotlin.test.junit')
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.test.junit')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,6 @@ description = 'Kotlin Test JUnit 5'
|
|||||||
|
|
||||||
apply plugin: 'kotlin-platform-jvm'
|
apply plugin: 'kotlin-platform-jvm'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
|
||||||
ext.javaHome = JDK_18
|
|
||||||
ext.jvmTarget = "1.8"
|
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -34,11 +30,6 @@ jar {
|
|||||||
configureSourcesJar()
|
configureSourcesJar()
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|
||||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
||||||
kotlinOptions.jdkHome = JDK_18
|
|
||||||
kotlinOptions.jvmTarget = 1.8
|
|
||||||
}
|
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
@@ -57,10 +48,9 @@ compileTestKotlin {
|
|||||||
configureJvmIrBackend(project)
|
configureJvmIrBackend(project)
|
||||||
|
|
||||||
if (includeJava9) {
|
if (includeJava9) {
|
||||||
compileJava9Sources(project, 'kotlin.test.junit5')
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.test.junit5')
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
executable = "$JDK_18/bin/java"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ apply plugin: 'kotlin-platform-jvm'
|
|||||||
|
|
||||||
archivesBaseName = 'kotlin-test'
|
archivesBaseName = 'kotlin-test'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
@@ -62,5 +62,5 @@ compileTestKotlin {
|
|||||||
configureJvmIrBackend(project)
|
configureJvmIrBackend(project)
|
||||||
|
|
||||||
if (includeJava9) {
|
if (includeJava9) {
|
||||||
compileJava9Sources(project, 'kotlin.test')
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.test')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,9 @@ description = 'Kotlin Test TestNG'
|
|||||||
|
|
||||||
apply plugin: 'kotlin-platform-jvm'
|
apply plugin: 'kotlin-platform-jvm'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
||||||
ext.javaHome = JDK_17
|
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ compileTestKotlin {
|
|||||||
configureJvmIrBackend(project)
|
configureJvmIrBackend(project)
|
||||||
|
|
||||||
if (includeJava9) {
|
if (includeJava9) {
|
||||||
compileJava9Sources(project, 'kotlin.test.testng')
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.test.testng')
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ pill {
|
|||||||
variant = PillExtension.Variant.FULL
|
variant = PillExtension.Variant.FULL
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ group = "org.jetbrains.kotlinx"
|
|||||||
val deployVersion = findProperty("kotlinxMetadataDeployVersion") as String?
|
val deployVersion = findProperty("kotlinxMetadataDeployVersion") as String?
|
||||||
version = deployVersion ?: "0.1-SNAPSHOT"
|
version = deployVersion ?: "0.1-SNAPSHOT"
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ description = ''
|
|||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
|
||||||
|
|
||||||
@@ -32,8 +33,9 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (includeJava9) {
|
if (includeJava9) {
|
||||||
compileJava9Sources(
|
LibrariesCommon.configureJava9Compilation(
|
||||||
project, 'kotlin.reflect',
|
project,
|
||||||
|
'kotlin.reflect',
|
||||||
[sourceSets.main.output, configurations.compileOnly.filter {
|
[sourceSets.main.output, configurations.compileOnly.filter {
|
||||||
!it.name.contains("kotlin-stdlib")
|
!it.name.contains("kotlin-stdlib")
|
||||||
}]
|
}]
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ plugins {
|
|||||||
java
|
java
|
||||||
}
|
}
|
||||||
|
|
||||||
val JDK_16: String by rootProject.extra
|
java {
|
||||||
|
toolchain {
|
||||||
callGroovy("configureJavaOnlyJvm6Project", project)
|
languageVersion.set(JavaLanguageVersion.of(6))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
publish()
|
publish()
|
||||||
|
|
||||||
@@ -150,9 +152,19 @@ val proguard by task<CacheableProguardTask> {
|
|||||||
injars(mapOf("filter" to "!META-INF/**,!**/*.kotlin_builtins"), proguardAdditionalInJars)
|
injars(mapOf("filter" to "!META-INF/**,!**/*.kotlin_builtins"), proguardAdditionalInJars)
|
||||||
outjars(proguardOutput)
|
outjars(proguardOutput)
|
||||||
|
|
||||||
jdkHome = File(JDK_16)
|
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_6))
|
||||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardDeps)
|
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardDeps)
|
||||||
libraryjars(firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar", jdkHome = jdkHome!!))
|
libraryjars(
|
||||||
|
project.files(
|
||||||
|
javaLauncher.map {
|
||||||
|
firstFromJavaHomeThatExists(
|
||||||
|
"jre/lib/rt.jar",
|
||||||
|
"../Classes/classes.jar",
|
||||||
|
jdkHome = it.metadata.installationPath.asFile
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
configuration("$core/reflection.jvm/reflection.pro")
|
configuration("$core/reflection.jvm/reflection.pro")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
configurations.implementation {
|
configurations.implementation {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(project(":kotlin-script-runtime"))
|
compile(project(":kotlin-script-runtime"))
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
val JDK_16: String by project
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
jvmTarget = "1.6"
|
|
||||||
javaHome = JDK_16
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(project(":kotlin-script-runtime"))
|
compile(project(":kotlin-script-runtime"))
|
||||||
@@ -26,10 +24,6 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Test> {
|
|
||||||
executable = "$JDK_16/bin/java"
|
|
||||||
}
|
|
||||||
|
|
||||||
publish()
|
publish()
|
||||||
|
|
||||||
runtimeJar()
|
runtimeJar()
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-platform-common'
|
|||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||||
|
|
||||||
def commonSrcDir = "../src"
|
def commonSrcDir = "../src"
|
||||||
def commonTestSrcDir = "../test"
|
def commonTestSrcDir = "../test"
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ description = 'Kotlin Standard Library JDK 7 extension'
|
|||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_7)
|
||||||
|
JvmToolchain.updateJvmTarget(project, "1.6")
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
configureSourcesJar()
|
configureSourcesJar()
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|
||||||
ext.javaHome = JDK_17
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
main {
|
main {
|
||||||
kotlin {
|
kotlin {
|
||||||
@@ -66,10 +67,6 @@ artifacts {
|
|||||||
archives modularJar
|
archives modularJar
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
||||||
kotlinOptions.jdkHome = JDK_17
|
|
||||||
}
|
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
@@ -97,18 +94,12 @@ compileTestKotlin {
|
|||||||
|
|
||||||
configureJvmIrBackend(project)
|
configureJvmIrBackend(project)
|
||||||
|
|
||||||
compileJava9Sources(project, 'kotlin.stdlib.jdk7')
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib.jdk7')
|
||||||
|
|
||||||
test {
|
|
||||||
executable = "$JDK_17/bin/java"
|
|
||||||
}
|
|
||||||
|
|
||||||
task testJdk6Tests(type: Test) {
|
task testJdk6Tests(type: Test) {
|
||||||
dependsOn(':kotlin-stdlib:testClasses')
|
dependsOn(':kotlin-stdlib:testClasses')
|
||||||
group = "verification"
|
group = "verification"
|
||||||
|
|
||||||
executable = "$JDK_17/bin/java"
|
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
testClassesDirs = project(':kotlin-stdlib').sourceSets.test.output
|
testClassesDirs = project(':kotlin-stdlib').sourceSets.test.output
|
||||||
classpath = files(
|
classpath = files(
|
||||||
@@ -121,12 +112,9 @@ task testJdk6Tests(type: Test) {
|
|||||||
task testNoJdk7(type: Test, dependsOn: noJdk7TestClasses) {
|
task testNoJdk7(type: Test, dependsOn: noJdk7TestClasses) {
|
||||||
group = "verification"
|
group = "verification"
|
||||||
|
|
||||||
executable = "$JDK_17/bin/java"
|
|
||||||
|
|
||||||
testClassesDirs = sourceSets.noJdk7Test.output.classesDirs
|
testClassesDirs = sourceSets.noJdk7Test.output.classesDirs
|
||||||
classpath = sourceSets.noJdk7Test.runtimeClasspath
|
classpath = sourceSets.noJdk7Test.runtimeClasspath
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
check.dependsOn testJdk6Tests, testNoJdk7
|
check.dependsOn testJdk6Tests, testNoJdk7
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,10 @@ description = 'Kotlin Standard Library JDK 8 extension'
|
|||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
configureSourcesJar()
|
configureSourcesJar()
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|
||||||
ext.javaHome = JDK_18
|
|
||||||
ext.jvmTarget = "1.8"
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':kotlin-stdlib')
|
compile project(':kotlin-stdlib')
|
||||||
compile project(':kotlin-stdlib-jdk7')
|
compile project(':kotlin-stdlib-jdk7')
|
||||||
@@ -59,11 +55,6 @@ artifacts {
|
|||||||
archives modularJar
|
archives modularJar
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
||||||
kotlinOptions.jdkHome = JDK_18
|
|
||||||
kotlinOptions.jvmTarget = 1.8
|
|
||||||
}
|
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
@@ -87,19 +78,13 @@ compileTestKotlin {
|
|||||||
|
|
||||||
configureJvmIrBackend(project)
|
configureJvmIrBackend(project)
|
||||||
|
|
||||||
compileJava9Sources(project, 'kotlin.stdlib.jdk8')
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib.jdk8')
|
||||||
|
|
||||||
test {
|
|
||||||
executable = "$JDK_18/bin/java"
|
|
||||||
}
|
|
||||||
|
|
||||||
task testJdk6Tests(type: Test) { thisTask ->
|
task testJdk6Tests(type: Test) { thisTask ->
|
||||||
dependsOn(':kotlin-stdlib:testClasses')
|
dependsOn(':kotlin-stdlib:testClasses')
|
||||||
check.dependsOn(thisTask)
|
check.dependsOn(thisTask)
|
||||||
group = "verification"
|
group = "verification"
|
||||||
|
|
||||||
executable = "$JDK_18/bin/java"
|
|
||||||
|
|
||||||
doFirst {
|
doFirst {
|
||||||
testClassesDirs = project(':kotlin-stdlib').sourceSets.test.output
|
testClassesDirs = project(':kotlin-stdlib').sourceSets.test.output
|
||||||
classpath = files(
|
classpath = files(
|
||||||
@@ -109,13 +94,12 @@ task testJdk6Tests(type: Test) { thisTask ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JdkMajorVersion.JDK_9, JdkMajorVersion.JDK_10, JdkMajorVersion.JDK_11].forEach { jvmVersion ->
|
||||||
[9, 10, 11].forEach { v ->
|
tasks.register("jdk${jvmVersion.majorVersion}Test", Test) { thisTask ->
|
||||||
task(type: Test, "jdk${v}Test") { thisTask ->
|
|
||||||
check.dependsOn(thisTask)
|
check.dependsOn(thisTask)
|
||||||
group = "verification"
|
group = "verification"
|
||||||
executable = "${project.property("JDK_$v")}/bin/java"
|
thisTask.javaLauncher.set(
|
||||||
if (v > 9)
|
JvmToolchain.getToolchainLauncherFor(project, jvmVersion)
|
||||||
enabled(file(executable).parentFile.isDirectory())
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,7 @@ plugins {
|
|||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.configureJvmToolchain(JdkMajorVersion.JDK_1_6)
|
||||||
javaHome = rootProject.extra["JDK_16"] as String
|
|
||||||
|
|
||||||
val builtins by configurations.creating {
|
val builtins by configurations.creating {
|
||||||
isCanBeResolved = true
|
isCanBeResolved = true
|
||||||
@@ -54,11 +53,6 @@ val copySources by task<Sync> {
|
|||||||
into(File(buildDir, "src"))
|
into(File(buildDir, "src"))
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
dependsOn(copySources)
|
dependsOn(copySources)
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
|
|||||||
@@ -4,7 +4,9 @@ apply plugin: 'kotlin-platform-jvm'
|
|||||||
|
|
||||||
archivesBaseName = 'kotlin-stdlib'
|
archivesBaseName = 'kotlin-stdlib'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
configureSourcesJar()
|
configureSourcesJar()
|
||||||
@@ -38,6 +40,8 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib', [sourceSets.main.output])
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
commonSources
|
commonSources
|
||||||
longRunningTestCompile.extendsFrom(testCompile)
|
longRunningTestCompile.extendsFrom(testCompile)
|
||||||
@@ -127,9 +131,6 @@ compileKotlin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
compileJava9Sources(project, 'kotlin.stdlib', [sourceSets.main.output])
|
|
||||||
|
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
freeCompilerArgs += [
|
freeCompilerArgs += [
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ sourceSets {
|
|||||||
|
|
||||||
compileTestKotlin {
|
compileTestKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jdkHome = JDK_18
|
|
||||||
freeCompilerArgs = [
|
freeCompilerArgs = [
|
||||||
"-Xopt-in=kotlin.ExperimentalStdlibApi",
|
"-Xopt-in=kotlin.ExperimentalStdlibApi",
|
||||||
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
|
"-Xopt-in=kotlin.ExperimentalUnsignedTypes",
|
||||||
@@ -19,7 +18,3 @@ compileTestKotlin {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
|
||||||
executable = "$JDK_18/bin/java"
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -54,5 +54,3 @@ pluginBundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configurePluginMarkers(project)
|
configurePluginMarkers(project)
|
||||||
|
|
||||||
test.executable = "${JDK_18}/bin/java"
|
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ description = 'Kotlin annotations for JVM'
|
|||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
@@ -20,11 +22,6 @@ dependencies {
|
|||||||
configureSourcesJar()
|
configureSourcesJar()
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|
||||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
||||||
kotlinOptions.jdkHome = JDK_16
|
|
||||||
kotlinOptions.jvmTarget = 1.6
|
|
||||||
}
|
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions.freeCompilerArgs = [
|
kotlinOptions.freeCompilerArgs = [
|
||||||
"-Xallow-kotlin-package",
|
"-Xallow-kotlin-package",
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
|
||||||
import org.jetbrains.kotlin.pill.PillExtension
|
import org.jetbrains.kotlin.pill.PillExtension
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@@ -198,11 +197,6 @@ tasks.named<Task>("check") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
|
||||||
kotlinOptions.jdkHome = rootProject.extra["JDK_18"] as String
|
|
||||||
kotlinOptions.jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.withType<Test> {
|
tasks.withType<Test> {
|
||||||
val noTestProperty = project.providers.gradleProperty("noTest")
|
val noTestProperty = project.providers.gradleProperty("noTest")
|
||||||
onlyIf { !noTestProperty.isPresent }
|
onlyIf { !noTestProperty.isPresent }
|
||||||
@@ -210,17 +204,22 @@ tasks.withType<Test> {
|
|||||||
dependsOn(":kotlin-gradle-plugin:validatePlugins")
|
dependsOn(":kotlin-gradle-plugin:validatePlugins")
|
||||||
dependsOnKotlinGradlePluginInstall()
|
dependsOnKotlinGradlePluginInstall()
|
||||||
|
|
||||||
executable = "${rootProject.extra["JDK_18"]!!}/bin/java"
|
|
||||||
|
|
||||||
systemProperty("kotlinVersion", rootProject.extra["kotlinVersion"] as String)
|
systemProperty("kotlinVersion", rootProject.extra["kotlinVersion"] as String)
|
||||||
systemProperty("runnerGradleVersion", gradle.gradleVersion)
|
systemProperty("runnerGradleVersion", gradle.gradleVersion)
|
||||||
systemProperty("jdk9Home", rootProject.extra["JDK_9"] as String)
|
|
||||||
systemProperty("jdk10Home", rootProject.extra["JDK_10"] as String)
|
|
||||||
systemProperty("jdk11Home", rootProject.extra["JDK_11"] as String)
|
|
||||||
|
|
||||||
|
val jdk9Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_9).map { it.metadata.installationPath.asFile.absolutePath }
|
||||||
|
val jdk10Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_10).map { it.metadata.installationPath.asFile.absolutePath }
|
||||||
|
val jdk11Provider = project.getToolchainLauncherFor(JdkMajorVersion.JDK_11).map { it.metadata.installationPath.asFile.absolutePath }
|
||||||
val mavenLocalRepo = project.providers.systemProperty("maven.repo.local").forUseAtConfigurationTime().orNull
|
val mavenLocalRepo = project.providers.systemProperty("maven.repo.local").forUseAtConfigurationTime().orNull
|
||||||
if (mavenLocalRepo != null) {
|
|
||||||
systemProperty("maven.repo.local", mavenLocalRepo)
|
// Query required JDKs paths only on execution phase to avoid triggering auto-download on project configuration phase
|
||||||
|
doFirst {
|
||||||
|
systemProperty("jdk9Home", jdk9Provider.get())
|
||||||
|
systemProperty("jdk10Home", jdk10Provider.get())
|
||||||
|
systemProperty("jdk11Home", jdk11Provider.get())
|
||||||
|
if (mavenLocalRepo != null) {
|
||||||
|
systemProperty("maven.repo.local", mavenLocalRepo)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
useAndroidSdk()
|
useAndroidSdk()
|
||||||
|
|||||||
+2
-2
@@ -595,8 +595,8 @@ class KotlinJavaToolchainTest : KGPBaseTest() {
|
|||||||
) = assertOutputContains("[KOTLIN] Kotlin compilation 'jdkHome' argument: $javaexecPath")
|
) = assertOutputContains("[KOTLIN] Kotlin compilation 'jdkHome' argument: $javaexecPath")
|
||||||
|
|
||||||
private fun getUserJdk(): JavaInfo = Jvm.forHome(File(System.getenv("JAVA_HOME")))
|
private fun getUserJdk(): JavaInfo = Jvm.forHome(File(System.getenv("JAVA_HOME")))
|
||||||
private fun getJdk9(): JavaInfo = Jvm.forHome(File(System.getenv("JDK_9")))
|
private fun getJdk9(): JavaInfo = Jvm.forHome(File(System.getProperty("jdk9Home")))
|
||||||
private fun getJdk11(): JavaInfo = Jvm.forHome(File(System.getenv("JDK_11")))
|
private fun getJdk11(): JavaInfo = Jvm.forHome(File(System.getProperty("jdk11Home")))
|
||||||
// replace required for windows paths so Groovy will not complain about unexpected char '\'
|
// replace required for windows paths so Groovy will not complain about unexpected char '\'
|
||||||
private fun getJdk9Path(): String = getJdk9().javaHome.absolutePath.replace("\\", "\\\\")
|
private fun getJdk9Path(): String = getJdk9().javaHome.absolutePath.replace("\\", "\\\\")
|
||||||
private fun getJdk11Path(): String = getJdk11().javaHome.absolutePath.replace("\\", "\\\\")
|
private fun getJdk11Path(): String = getJdk11().javaHome.absolutePath.replace("\\", "\\\\")
|
||||||
|
|||||||
@@ -145,7 +145,6 @@ tasks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
projectTest {
|
projectTest {
|
||||||
executable = "${rootProject.extra["JDK_18"]!!}/bin/java"
|
|
||||||
dependsOn(tasks.named("validatePlugins"))
|
dependsOn(tasks.named("validatePlugins"))
|
||||||
|
|
||||||
workingDir = rootDir
|
workingDir = rootDir
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import proguard.gradle.ProGuardTask
|
import org.gradle.internal.jvm.Jvm
|
||||||
|
|
||||||
description = "Kotlin \"main\" script definition"
|
description = "Kotlin \"main\" script definition"
|
||||||
|
|
||||||
@@ -8,7 +8,6 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
val JDK_18: String by rootProject.extra
|
|
||||||
val jarBaseName = property("archivesBaseName") as String
|
val jarBaseName = property("archivesBaseName") as String
|
||||||
|
|
||||||
val localPackagesToRelocate =
|
val localPackagesToRelocate =
|
||||||
@@ -88,13 +87,28 @@ val proguard by task<CacheableProguardTask> {
|
|||||||
|
|
||||||
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
|
outjars(fileFrom(buildDir, "libs", "$jarBaseName-$version-after-proguard.jar"))
|
||||||
|
|
||||||
jdkHome = File(JDK_18)
|
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_8))
|
||||||
|
|
||||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraryJars)
|
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraryJars)
|
||||||
libraryjars(
|
libraryjars(
|
||||||
files(
|
files(
|
||||||
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar", jdkHome = jdkHome!!),
|
javaLauncher.map {
|
||||||
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar", jdkHome = jdkHome!!),
|
firstFromJavaHomeThatExists(
|
||||||
toolsJarFile(jdkHome = jdkHome!!)
|
"jre/lib/rt.jar",
|
||||||
|
"../Classes/classes.jar",
|
||||||
|
jdkHome = it.metadata.installationPath.asFile
|
||||||
|
)
|
||||||
|
},
|
||||||
|
javaLauncher.map {
|
||||||
|
firstFromJavaHomeThatExists(
|
||||||
|
"jre/lib/jsse.jar",
|
||||||
|
"../Classes/jsse.jar",
|
||||||
|
jdkHome = it.metadata.installationPath.asFile
|
||||||
|
)
|
||||||
|
},
|
||||||
|
javaLauncher.map {
|
||||||
|
Jvm.forHome(it.metadata.installationPath.asFile).toolsJar
|
||||||
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,6 @@ apply plugin: 'jps-compatible'
|
|||||||
|
|
||||||
configureGradlePluginPublishing(project)
|
configureGradlePluginPublishing(project)
|
||||||
|
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
options.fork = false
|
|
||||||
}
|
|
||||||
|
|
||||||
pill {
|
pill {
|
||||||
variant = 'FULL'
|
variant = 'FULL'
|
||||||
}
|
}
|
||||||
@@ -60,5 +54,3 @@ pluginBundle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configurePluginMarkers(project)
|
configurePluginMarkers(project)
|
||||||
|
|
||||||
test.executable = "${JDK_18}/bin/java"
|
|
||||||
|
|||||||
@@ -3,12 +3,6 @@ apply plugin: 'jps-compatible'
|
|||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
options.fork = false
|
|
||||||
}
|
|
||||||
|
|
||||||
pill {
|
pill {
|
||||||
variant = 'FULL'
|
variant = 'FULL'
|
||||||
}
|
}
|
||||||
@@ -45,5 +39,3 @@ ArtifactsKt.noDefaultJar(project)
|
|||||||
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
ArtifactsKt.runtimeJar(project, EmbeddableKt.rewriteDefaultJarDepsToShadedCompiler(project, {}), {})
|
||||||
configureSourcesJar()
|
configureSourcesJar()
|
||||||
configureJavadocJar()
|
configureJavadocJar()
|
||||||
|
|
||||||
test.executable = "${JDK_18}/bin/java"
|
|
||||||
|
|||||||
@@ -6,12 +6,6 @@ dependencies {
|
|||||||
embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false }
|
embedded(project(":kotlinx-serialization-compiler-plugin")) { transitive = false }
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
options.fork = false
|
|
||||||
}
|
|
||||||
|
|
||||||
TaskProvider<Jar> jar = tasks.named("jar")
|
TaskProvider<Jar> jar = tasks.named("jar")
|
||||||
jar.configure {
|
jar.configure {
|
||||||
manifestAttributes(manifest, project)
|
manifestAttributes(manifest, project)
|
||||||
|
|||||||
@@ -7,12 +7,6 @@ pill {
|
|||||||
variant = 'FULL'
|
variant = 'FULL'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = 1.8
|
|
||||||
targetCompatibility = 1.8
|
|
||||||
options.fork = false
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly project(':kotlin-gradle-plugin')
|
compileOnly project(':kotlin-gradle-plugin')
|
||||||
compile project(':kotlin-gradle-plugin-api')
|
compile project(':kotlin-gradle-plugin-api')
|
||||||
|
|||||||
@@ -5,12 +5,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
tasks.withType<JavaCompile> {
|
|
||||||
sourceCompatibility = "1.6"
|
|
||||||
targetCompatibility = "1.6"
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ description 'Kotlin Script Runtime'
|
|||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
configureJvm6Project(project)
|
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_6)
|
||||||
|
LibrariesCommon.disableDeprecatedJvmTargetWarning(project)
|
||||||
|
|
||||||
configurePublishing(project)
|
configurePublishing(project)
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ dependencies {
|
|||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
"main" { projectDefault() }
|
"main" { projectDefault() }
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.6"
|
project.updateJvmTarget("1.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ plugins {
|
|||||||
kotlin("jvm")
|
kotlin("jvm")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.8"
|
project.updateJvmTarget("1.8")
|
||||||
|
|
||||||
val allTestsRuntime by configurations.creating
|
val allTestsRuntime by configurations.creating
|
||||||
val testCompile by configurations
|
val testCompile by configurations
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ plugins {
|
|||||||
id("jps-compatible")
|
id("jps-compatible")
|
||||||
}
|
}
|
||||||
|
|
||||||
jvmTarget = "1.8"
|
project.updateJvmTarget("1.8")
|
||||||
|
|
||||||
publish()
|
publish()
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
@file:Suppress("HasPlatformType")
|
@file:Suppress("HasPlatformType")
|
||||||
|
|
||||||
|
import org.gradle.internal.jvm.Jvm
|
||||||
import java.util.regex.Pattern.quote
|
import java.util.regex.Pattern.quote
|
||||||
|
|
||||||
description = "Kotlin Compiler"
|
description = "Kotlin Compiler"
|
||||||
@@ -265,7 +266,7 @@ val packCompiler by task<Jar> {
|
|||||||
val proguard by task<CacheableProguardTask> {
|
val proguard by task<CacheableProguardTask> {
|
||||||
dependsOn(packCompiler)
|
dependsOn(packCompiler)
|
||||||
|
|
||||||
jdkHome = File(JDK_18)
|
javaLauncher.set(project.getToolchainLauncherFor(JdkMajorVersion.JDK_1_8))
|
||||||
|
|
||||||
configuration("$projectDir/compiler.pro")
|
configuration("$projectDir/compiler.pro")
|
||||||
|
|
||||||
@@ -291,9 +292,23 @@ val proguard by task<CacheableProguardTask> {
|
|||||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraries)
|
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraries)
|
||||||
libraryjars(
|
libraryjars(
|
||||||
files(
|
files(
|
||||||
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar", jdkHome = jdkHome!!),
|
javaLauncher.map {
|
||||||
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar", jdkHome = jdkHome!!),
|
firstFromJavaHomeThatExists(
|
||||||
toolsJarFile(jdkHome = jdkHome!!)
|
"jre/lib/rt.jar",
|
||||||
|
"../Classes/classes.jar",
|
||||||
|
jdkHome = it.metadata.installationPath.asFile
|
||||||
|
)
|
||||||
|
},
|
||||||
|
javaLauncher.map {
|
||||||
|
firstFromJavaHomeThatExists(
|
||||||
|
"jre/lib/jsse.jar",
|
||||||
|
"../Classes/jsse.jar",
|
||||||
|
jdkHome = it.metadata.installationPath.asFile
|
||||||
|
)
|
||||||
|
},
|
||||||
|
javaLauncher.map {
|
||||||
|
Jvm.forHome(it.metadata.installationPath.asFile).toolsJar
|
||||||
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user