mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
Build: Fix usages of "java.home" for tools.jar dependency
#KT-33984
This commit is contained in:
@@ -8,6 +8,7 @@ import org.gradle.api.Project
|
|||||||
import org.gradle.api.artifacts.ProjectDependency
|
import org.gradle.api.artifacts.ProjectDependency
|
||||||
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.tasks.AbstractCopyTask
|
import org.gradle.api.tasks.AbstractCopyTask
|
||||||
import org.gradle.kotlin.dsl.extra
|
import org.gradle.kotlin.dsl.extra
|
||||||
import org.gradle.kotlin.dsl.project
|
import org.gradle.kotlin.dsl.project
|
||||||
@@ -128,7 +129,9 @@ fun Project.firstFromJavaHomeThatExists(vararg paths: String, jdkHome: File = Fi
|
|||||||
logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome")
|
logger.warn("Cannot find file by paths: ${paths.toList()} in $jdkHome")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Project.toolsJar(jdkHome: File = File(this.property("JDK_18") as String)): File? =
|
fun Project.toolsJar(): FileCollection = files(toolsJarFile() ?: error("tools.jar is not found!"))
|
||||||
|
|
||||||
|
fun Project.toolsJarFile(jdkHome: File = File(this.property("JDK_18") as String)): File? =
|
||||||
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
|
firstFromJavaHomeThatExists("lib/tools.jar", jdkHome = jdkHome)
|
||||||
|
|
||||||
val compilerManifestClassPath
|
val compilerManifestClassPath
|
||||||
|
|||||||
@@ -85,10 +85,10 @@ dependencies {
|
|||||||
|
|
||||||
}
|
}
|
||||||
testRuntime(androidDxJar())
|
testRuntime(androidDxJar())
|
||||||
testRuntime(files(toolsJar()))
|
testRuntime(toolsJar())
|
||||||
|
|
||||||
antLauncherJar(commonDep("org.apache.ant", "ant"))
|
antLauncherJar(commonDep("org.apache.ant", "ant"))
|
||||||
antLauncherJar(files(toolsJar()))
|
antLauncherJar(toolsJar())
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ dependencies {
|
|||||||
compile(project(":compiler:fir:resolve"))
|
compile(project(":compiler:fir:resolve"))
|
||||||
compile(project(":compiler:fir:java"))
|
compile(project(":compiler:fir:java"))
|
||||||
compile(project(":compiler:fir:fir2ir"))
|
compile(project(":compiler:fir:fir2ir"))
|
||||||
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
compile(toolsJar())
|
||||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
|
||||||
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
compileOnly(intellijDep()) { includeIntellijCoreJarDependencies(project) }
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ dependencies {
|
|||||||
|
|
||||||
runtimeOnly(intellijDep())
|
runtimeOnly(intellijDep())
|
||||||
runtimeOnly(intellijRuntimeAnnotations())
|
runtimeOnly(intellijRuntimeAnnotations())
|
||||||
runtimeOnly(files(toolsJar()))
|
runtimeOnly(toolsJar())
|
||||||
}
|
}
|
||||||
|
|
||||||
val ideaPluginDir: File by rootProject.extra
|
val ideaPluginDir: File by rootProject.extra
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
compile(project(":compiler:backend"))
|
compile(project(":compiler:backend"))
|
||||||
compile(files(toolsJar()))
|
compile(toolsJar())
|
||||||
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", rootProject = rootProject) }
|
compileOnly(intellijCoreDep()) { includeJars("intellij-core", "asm-all", rootProject = rootProject) }
|
||||||
testCompile(project(":kotlin-test:kotlin-test-junit"))
|
testCompile(project(":kotlin-test:kotlin-test-junit"))
|
||||||
testCompile(commonDep("junit:junit"))
|
testCompile(commonDep("junit:junit"))
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ dependencies {
|
|||||||
compile(project(":idea:idea-core"))
|
compile(project(":idea:idea-core"))
|
||||||
compile(project(":idea:ide-common"))
|
compile(project(":idea:ide-common"))
|
||||||
compile(project(":idea:jvm-debugger:jvm-debugger-util"))
|
compile(project(":idea:jvm-debugger:jvm-debugger-util"))
|
||||||
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
compile(toolsJar())
|
||||||
|
|
||||||
compileOnly(intellijDep())
|
compileOnly(intellijDep())
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ dependencies {
|
|||||||
compile(project(":idea:idea-core"))
|
compile(project(":idea:idea-core"))
|
||||||
compile(project(":idea:idea-j2k"))
|
compile(project(":idea:idea-j2k"))
|
||||||
compile(project(":idea:jvm-debugger:jvm-debugger-util"))
|
compile(project(":idea:jvm-debugger:jvm-debugger-util"))
|
||||||
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
compile(toolsJar())
|
||||||
Platform[192].orHigher {
|
Platform[192].orHigher {
|
||||||
compileOnly(intellijPluginDep("java"))
|
compileOnly(intellijPluginDep("java"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compile(project(":compiler:backend"))
|
compile(project(":compiler:backend"))
|
||||||
compile(project(":idea:ide-common"))
|
compile(project(":idea:ide-common"))
|
||||||
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
compile(toolsJar())
|
||||||
|
|
||||||
compileOnly(intellijDep())
|
compileOnly(intellijDep())
|
||||||
Platform[192].orHigher {
|
Platform[192].orHigher {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dependencies {
|
|||||||
// TODO: get rid of this
|
// TODO: get rid of this
|
||||||
compile(project(":idea:jvm-debugger:eval4j"))
|
compile(project(":idea:jvm-debugger:eval4j"))
|
||||||
|
|
||||||
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
compile(toolsJar())
|
||||||
|
|
||||||
Platform[192].orHigher {
|
Platform[192].orHigher {
|
||||||
compileOnly(intellijPluginDep("java"))
|
compileOnly(intellijPluginDep("java"))
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
antLauncherJar(commonDep("org.apache.ant", "ant"))
|
antLauncherJar(commonDep("org.apache.ant", "ant"))
|
||||||
antLauncherJar(files(toolsJar()))
|
antLauncherJar(toolsJar())
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ dependencies {
|
|||||||
embedded(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
|
embedded(commonDep("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
|
||||||
proguardLibraryJars(files(firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar"),
|
proguardLibraryJars(files(firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar"),
|
||||||
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar"),
|
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar"),
|
||||||
toolsJar()))
|
toolsJarFile()))
|
||||||
proguardLibraryJars(kotlinStdlib())
|
proguardLibraryJars(kotlinStdlib())
|
||||||
proguardLibraryJars(project(":kotlin-reflect"))
|
proguardLibraryJars(project(":kotlin-reflect"))
|
||||||
proguardLibraryJars(project(":kotlin-compiler"))
|
proguardLibraryJars(project(":kotlin-compiler"))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ plugins {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile(kotlinStdlib())
|
compile(kotlinStdlib())
|
||||||
compile(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
compile(toolsJar())
|
||||||
testCompile(commonDep("junit:junit"))
|
testCompile(commonDep("junit:junit"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ dependencies {
|
|||||||
files(
|
files(
|
||||||
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar"),
|
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar"),
|
||||||
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar"),
|
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar"),
|
||||||
toolsJar()
|
toolsJarFile()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user