Fix embeddable compiler dependencies, fix dist task, use runtimeJar...

dependencies where appropriate, some helpers refactoring
This commit is contained in:
Ilya Chernikov
2017-09-19 14:28:43 +02:00
parent b7226951b6
commit d61695be55
10 changed files with 36 additions and 31 deletions
+11 -5
View File
@@ -200,6 +200,12 @@ fun Project.allprojectsRecursive(body: Project.() -> Unit) {
this.subprojects { allprojectsRecursive(body) } 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 defaultJvmTarget = "1.8"
val defaultJavaHome = jdkPath(defaultJvmTarget!!) val defaultJavaHome = jdkPath(defaultJvmTarget!!)
@@ -243,11 +249,11 @@ allprojects {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE duplicatesStrategy = DuplicatesStrategy.EXCLUDE
} }
task("printArchives") { task("listArchives") { listConfigurationContents("archives") }
doFirst {
println("Archives configuration files:\n${configurations["archives"].allArtifacts.files.files.joinToString("\n ", " ")}") task("listRuntimeJar") { listConfigurationContents("runtimeJar") }
}
} task("listDistJar") { listConfigurationContents("distJar") }
afterEvaluate { afterEvaluate {
logger.info("configuring project $name to compile to the target jvm version $jvmTarget using jdk: $javaHome") logger.info("configuring project $name to compile to the target jvm version $jvmTarget using jdk: $javaHome")
+13 -16
View File
@@ -142,7 +142,9 @@ fun Project.ideaPlugin(subdir: String = "lib", body: AbstractCopyTask.() -> Unit
} }
fun Project.ideaPlugin(subdir: String = "lib"): Copy = ideaPlugin(subdir) { fun Project.ideaPlugin(subdir: String = "lib"): Copy = ideaPlugin(subdir) {
fromRuntimeJarIfExists(this) runtimeJarTaskIfExists()?.let {
from(it)
}
} }
fun Project.dist(targetDir: File? = null, fun Project.dist(targetDir: File? = null,
@@ -155,27 +157,22 @@ fun Project.dist(targetDir: File? = null,
return task<Copy>("dist") { return task<Copy>("dist") {
body() body()
when { (fromTask ?: runtimeJarTaskIfExists())?.let {
fromTask != null -> from(fromTask) from(it)
else -> project.fromRuntimeJarIfExists(this) 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) into(targetDir ?: distLibDir)
project.addArtifact(distJarCfg, this, File(targetDir ?: distLibDir, distJarName)) project.addArtifact(distJarCfg, this, File(targetDir ?: distLibDir, distJarName))
} }
} }
private fun<T: AbstractCopyTask> Project.fromRuntimeJarIfExists(task: T) { private fun Project.runtimeJarTaskIfExists(): Task? =
if (extra.has("runtimeJarTask")) { if (extra.has("runtimeJarTask")) extra["runtimeJarTask"] as Task
task.from(extra["runtimeJarTask"] as Task) else tasks.findByName("jar")
}
else {
tasks.findByName("jar")?.let {
task.from(it)
}
}
}
fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName(name) ?: create(name) fun ConfigurationContainer.getOrCreate(name: String): Configuration = findByName(name) ?: create(name)
+1 -1
View File
@@ -20,7 +20,7 @@ dependencies {
testCompile(projectDist(":kotlin-script-runtime")) testCompile(projectDist(":kotlin-script-runtime"))
testCompile(projectDist(":kotlin-reflect")) testCompile(projectDist(":kotlin-reflect"))
testCompile(projectTests(":compiler")) testCompile(projectTests(":compiler"))
testRuntime(projectDist(":kotlin-preloader")) testRuntime(projectRuntimeJar(":kotlin-preloader"))
testRuntime(ideaSdkCoreDeps("*.jar")) testRuntime(ideaSdkCoreDeps("*.jar"))
testRuntime(ideaSdkDeps("*.jar")) testRuntime(ideaSdkDeps("*.jar"))
} }
+1 -1
View File
@@ -8,7 +8,7 @@ dependencies {
compile(project(":core")) compile(project(":core"))
compile(project(":compiler:backend")) compile(project(":compiler:backend"))
compile(project(":compiler:cli-common")) compile(project(":compiler:cli-common"))
compile(projectDist(":kotlin-daemon-client")) compile(projectRuntimeJar(":kotlin-daemon-client"))
compile(project(":compiler:frontend")) compile(project(":compiler:frontend"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
compile(project(":compiler:frontend.script")) compile(project(":compiler:frontend.script"))
+2 -2
View File
@@ -7,9 +7,9 @@ dependencies {
compile(project(":core")) compile(project(":core"))
compile(project(":kotlin-compiler-runner")) compile(project(":kotlin-compiler-runner"))
compile(project(":compiler:daemon-common")) compile(project(":compiler:daemon-common"))
compile(projectDist(":kotlin-daemon-client")) compile(projectRuntimeJar(":kotlin-daemon-client"))
compile(project(":compiler:frontend.java")) compile(project(":compiler:frontend.java"))
compile(projectDist(":kotlin-preloader")) compile(projectRuntimeJar(":kotlin-preloader"))
compile(project(":idea:idea-jps-common")) compile(project(":idea:idea-jps-common"))
compile(ideaSdkDeps("jps-builders", "jps-builders-6", subdir = "jps")) compile(ideaSdkDeps("jps-builders", "jps-builders-6", subdir = "jps"))
testCompile(project(":compiler.tests-common")) testCompile(project(":compiler.tests-common"))
+1 -1
View File
@@ -7,7 +7,7 @@ dependencies {
compileOnly(ideaSdkCoreDeps("intellij-core")) compileOnly(ideaSdkCoreDeps("intellij-core"))
compileOnly(project(":compiler:plugin-api")) compileOnly(project(":compiler:plugin-api"))
compileOnly(project(":compiler:frontend")) compileOnly(project(":compiler:frontend"))
runtime(projectDist(":kotlin-compiler")) runtime(projectRuntimeJar(":kotlin-compiler"))
runtime(projectDist(":kotlin-stdlib")) runtime(projectDist(":kotlin-stdlib"))
} }
+1 -1
View File
@@ -9,7 +9,7 @@ dependencies {
compileOnly(project(":compiler:backend")) compileOnly(project(":compiler:backend"))
compileOnly(project(":compiler:util")) compileOnly(project(":compiler:util"))
compileOnly(project(":compiler:plugin-api")) compileOnly(project(":compiler:plugin-api"))
runtime(projectDist(":kotlin-compiler")) runtime(projectRuntimeJar(":kotlin-compiler"))
runtime(projectDist(":kotlin-stdlib")) runtime(projectDist(":kotlin-stdlib"))
} }
@@ -7,7 +7,7 @@ dependencies {
compileOnly(project(":compiler:frontend")) compileOnly(project(":compiler:frontend"))
compileOnly(project(":compiler:frontend.java")) compileOnly(project(":compiler:frontend.java"))
compileOnly(project(":compiler:plugin-api")) compileOnly(project(":compiler:plugin-api"))
runtime(projectDist(":kotlin-compiler")) runtime(projectRuntimeJar(":kotlin-compiler"))
runtime(projectDist(":kotlin-stdlib")) runtime(projectDist(":kotlin-stdlib"))
} }
@@ -24,7 +24,9 @@ javadocJar()
publish() publish()
dist(targetName = the<BasePluginConvention>().archivesBaseName.removePrefix("kotlin-") + ".jar") dist {
rename("kotlin-", "")
}
ideaPlugin { ideaPlugin {
from(jar) from(jar)
+1 -1
View File
@@ -37,7 +37,7 @@ val packagesToRelocate =
dependencies { dependencies {
val compile by configurations val compile by configurations
compilerJar(projectDist(":kotlin-compiler")) compilerJar(projectRuntimeJar(":kotlin-compiler"))
compile(project(":kotlin-stdlib")) compile(project(":kotlin-stdlib"))
compile(project(":kotlin-script-runtime")) compile(project(":kotlin-script-runtime"))
+1 -1
View File
@@ -66,7 +66,7 @@ dependencies {
testCompile(ideaUltimateSdkDeps("gson")) testCompile(ideaUltimateSdkDeps("gson"))
testCompile(preloadedDeps("kotlinx-coroutines-core")) 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-ide")) { isTransitive = false }
testRuntime(project(":plugins:android-extensions-compiler")) { isTransitive = false } testRuntime(project(":plugins:android-extensions-compiler")) { isTransitive = false }
testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false } testRuntime(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }