Fix embeddable compiler dependencies, fix dist task, use runtimeJar...
dependencies where appropriate, some helpers refactoring
This commit is contained in:
+11
-5
@@ -200,6 +200,12 @@ fun Project.allprojectsRecursive(body: Project.() -> Unit) {
|
||||
this.subprojects { allprojectsRecursive(body) }
|
||||
}
|
||||
|
||||
fun Task.listConfigurationContents(configName: String) {
|
||||
doFirst {
|
||||
println("$configName configuration files:\n${project.configurations[configName].allArtifacts.files.files.joinToString("\n ", " ")}")
|
||||
}
|
||||
}
|
||||
|
||||
val defaultJvmTarget = "1.8"
|
||||
val defaultJavaHome = jdkPath(defaultJvmTarget!!)
|
||||
|
||||
@@ -243,11 +249,11 @@ allprojects {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
task("printArchives") {
|
||||
doFirst {
|
||||
println("Archives configuration files:\n${configurations["archives"].allArtifacts.files.files.joinToString("\n ", " ")}")
|
||||
}
|
||||
}
|
||||
task("listArchives") { listConfigurationContents("archives") }
|
||||
|
||||
task("listRuntimeJar") { listConfigurationContents("runtimeJar") }
|
||||
|
||||
task("listDistJar") { listConfigurationContents("distJar") }
|
||||
|
||||
afterEvaluate {
|
||||
logger.info("configuring project $name to compile to the target jvm version $jvmTarget using jdk: $javaHome")
|
||||
|
||||
@@ -142,7 +142,9 @@ fun Project.ideaPlugin(subdir: String = "lib", body: AbstractCopyTask.() -> Unit
|
||||
}
|
||||
|
||||
fun Project.ideaPlugin(subdir: String = "lib"): Copy = ideaPlugin(subdir) {
|
||||
fromRuntimeJarIfExists(this)
|
||||
runtimeJarTaskIfExists()?.let {
|
||||
from(it)
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.dist(targetDir: File? = null,
|
||||
@@ -155,27 +157,22 @@ fun Project.dist(targetDir: File? = null,
|
||||
|
||||
return task<Copy>("dist") {
|
||||
body()
|
||||
when {
|
||||
fromTask != null -> from(fromTask)
|
||||
else -> project.fromRuntimeJarIfExists(this)
|
||||
(fromTask ?: runtimeJarTaskIfExists())?.let {
|
||||
from(it)
|
||||
if (targetName != null) {
|
||||
rename(it.outputs.files.singleFile.name, targetName)
|
||||
}
|
||||
}
|
||||
rename(".*", distJarName)
|
||||
// rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
|
||||
rename("-${java.util.regex.Pattern.quote(rootProject.extra["build.number"].toString())}", "")
|
||||
into(targetDir ?: distLibDir)
|
||||
project.addArtifact(distJarCfg, this, File(targetDir ?: distLibDir, distJarName))
|
||||
}
|
||||
}
|
||||
|
||||
private fun<T: AbstractCopyTask> Project.fromRuntimeJarIfExists(task: T) {
|
||||
if (extra.has("runtimeJarTask")) {
|
||||
task.from(extra["runtimeJarTask"] as Task)
|
||||
}
|
||||
else {
|
||||
tasks.findByName("jar")?.let {
|
||||
task.from(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun Project.runtimeJarTaskIfExists(): Task? =
|
||||
if (extra.has("runtimeJarTask")) extra["runtimeJarTask"] as Task
|
||||
else tasks.findByName("jar")
|
||||
|
||||
|
||||
fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName(name) ?: create(name)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ dependencies {
|
||||
testCompile(projectDist(":kotlin-script-runtime"))
|
||||
testCompile(projectDist(":kotlin-reflect"))
|
||||
testCompile(projectTests(":compiler"))
|
||||
testRuntime(projectDist(":kotlin-preloader"))
|
||||
testRuntime(projectRuntimeJar(":kotlin-preloader"))
|
||||
testRuntime(ideaSdkCoreDeps("*.jar"))
|
||||
testRuntime(ideaSdkDeps("*.jar"))
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ dependencies {
|
||||
compile(project(":core"))
|
||||
compile(project(":compiler:backend"))
|
||||
compile(project(":compiler:cli-common"))
|
||||
compile(projectDist(":kotlin-daemon-client"))
|
||||
compile(projectRuntimeJar(":kotlin-daemon-client"))
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":compiler:frontend.java"))
|
||||
compile(project(":compiler:frontend.script"))
|
||||
|
||||
@@ -7,9 +7,9 @@ dependencies {
|
||||
compile(project(":core"))
|
||||
compile(project(":kotlin-compiler-runner"))
|
||||
compile(project(":compiler:daemon-common"))
|
||||
compile(projectDist(":kotlin-daemon-client"))
|
||||
compile(projectRuntimeJar(":kotlin-daemon-client"))
|
||||
compile(project(":compiler:frontend.java"))
|
||||
compile(projectDist(":kotlin-preloader"))
|
||||
compile(projectRuntimeJar(":kotlin-preloader"))
|
||||
compile(project(":idea:idea-jps-common"))
|
||||
compile(ideaSdkDeps("jps-builders", "jps-builders-6", subdir = "jps"))
|
||||
testCompile(project(":compiler.tests-common"))
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
compileOnly(ideaSdkCoreDeps("intellij-core"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
compileOnly(project(":compiler:frontend"))
|
||||
runtime(projectDist(":kotlin-compiler"))
|
||||
runtime(projectRuntimeJar(":kotlin-compiler"))
|
||||
runtime(projectDist(":kotlin-stdlib"))
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ dependencies {
|
||||
compileOnly(project(":compiler:backend"))
|
||||
compileOnly(project(":compiler:util"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
runtime(projectDist(":kotlin-compiler"))
|
||||
runtime(projectRuntimeJar(":kotlin-compiler"))
|
||||
runtime(projectDist(":kotlin-stdlib"))
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ dependencies {
|
||||
compileOnly(project(":compiler:frontend"))
|
||||
compileOnly(project(":compiler:frontend.java"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
runtime(projectDist(":kotlin-compiler"))
|
||||
runtime(projectRuntimeJar(":kotlin-compiler"))
|
||||
runtime(projectDist(":kotlin-stdlib"))
|
||||
}
|
||||
|
||||
@@ -24,7 +24,9 @@ javadocJar()
|
||||
|
||||
publish()
|
||||
|
||||
dist(targetName = the<BasePluginConvention>().archivesBaseName.removePrefix("kotlin-") + ".jar")
|
||||
dist {
|
||||
rename("kotlin-", "")
|
||||
}
|
||||
|
||||
ideaPlugin {
|
||||
from(jar)
|
||||
|
||||
@@ -37,7 +37,7 @@ val packagesToRelocate =
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
|
||||
compilerJar(projectDist(":kotlin-compiler"))
|
||||
compilerJar(projectRuntimeJar(":kotlin-compiler"))
|
||||
|
||||
compile(project(":kotlin-stdlib"))
|
||||
compile(project(":kotlin-script-runtime"))
|
||||
|
||||
@@ -66,7 +66,7 @@ dependencies {
|
||||
testCompile(ideaUltimateSdkDeps("gson"))
|
||||
testCompile(preloadedDeps("kotlinx-coroutines-core"))
|
||||
|
||||
testRuntime(projectDist(":kotlin-compiler"))
|
||||
testRuntime(projectRuntimeJar(":kotlin-compiler"))
|
||||
testRuntime(project(":plugins:android-extensions-ide")) { isTransitive = false }
|
||||
testRuntime(project(":plugins:android-extensions-compiler")) { isTransitive = false }
|
||||
testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
|
||||
|
||||
Reference in New Issue
Block a user