Refactor: project renaming, using improved build dsl
This commit is contained in:
@@ -3,18 +3,16 @@ import java.io.File
|
||||
|
||||
val buildVersionFilePath = "${rootProject.extra["distDir"]}/build.txt"
|
||||
|
||||
val mainCfg = configurations.create("default")
|
||||
val buildVersion by configurations.creating
|
||||
|
||||
artifacts.add(mainCfg.name, file(buildVersionFilePath))
|
||||
|
||||
val mainTask = task("prepare") {
|
||||
val prepare = task("prepare") {
|
||||
val versionString = rootProject.extra["build.number"].toString()
|
||||
val versionFile = File(buildVersionFilePath)
|
||||
outputs.file(buildVersionFilePath)
|
||||
outputs.upToDateWhen {
|
||||
(versionFile.exists() && versionFile.readText().trim() == versionString).apply {
|
||||
if (!this) {
|
||||
println("!!! not up-to-date $versionFile: ${versionFile.takeIf { it.exists() }?.readText()?.trim()}")
|
||||
(versionFile.exists() && versionFile.readText().trim() == versionString).also {
|
||||
if (!it) {
|
||||
logger.info("$versionFile is not up-to-date: ${versionFile.takeIf { it.exists() }?.readText()?.trim()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,5 +22,6 @@ val mainTask = task("prepare") {
|
||||
}
|
||||
}
|
||||
|
||||
defaultTasks(mainTask.name)
|
||||
|
||||
artifacts.add(buildVersion.name, file(buildVersionFilePath)) {
|
||||
builtBy(prepare)
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
|
||||
description = "Kotlin Daemon Client"
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
val nativePlatformUberjar = "$rootDir/dependencies/native-platform-uberjar.jar"
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:cli-common"))
|
||||
compile(project(":compiler:daemon-common"))
|
||||
compile(files(nativePlatformUberjar))
|
||||
buildVersion()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
"main" { default() }
|
||||
"test" { none() }
|
||||
}
|
||||
|
||||
runtimeJar {
|
||||
from(zipTree(nativePlatformUberjar))
|
||||
}
|
||||
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
publish()
|
||||
@@ -1,10 +1,24 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
apply { plugin("java") }
|
||||
description = "Kotlin JPS plugin"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.github.jengelman.gradle.plugins:shadow:2.0.1")
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
`java-base`
|
||||
}
|
||||
|
||||
val projectsToShadow = listOf(
|
||||
":build-common",
|
||||
":kotlin-build-common",
|
||||
":compiler:cli-common",
|
||||
":compiler:compiler-runner",
|
||||
":kotlin-daemon-client",
|
||||
@@ -17,31 +31,19 @@ val projectsToShadow = listOf(
|
||||
":core:util.runtime",
|
||||
":plugins:android-extensions-jps")
|
||||
|
||||
dependencies {}
|
||||
val fatJarContents by configurations.creating
|
||||
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
setupRuntimeJar("Kotlin JPS plugin")
|
||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main")
|
||||
manifest.attributes.put("Class-Path", "kotlin-runtime.jar")
|
||||
archiveName = "kotlin-jps-plugin.jar"
|
||||
dependencies {
|
||||
projectsToShadow.forEach {
|
||||
dependsOn("$it:classes")
|
||||
project(it).let { p ->
|
||||
p.pluginManager.withPlugin("java") {
|
||||
from(p.the<JavaPluginConvention>().sourceSets.getByName("main").output)
|
||||
}
|
||||
}
|
||||
fatJarContents(project(it)) { isTransitive = false }
|
||||
}
|
||||
from(fileTree("$rootDir/jps-plugin/src")) { include("META-INF/**") }
|
||||
}
|
||||
|
||||
runtimeJar<ShadowJar>(task<ShadowJar>("jar")) {
|
||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main")
|
||||
manifest.attributes.put("Class-Path", "kotlin-stdlib.jar")
|
||||
from(fatJarContents)
|
||||
from(files("$rootDir/resources/kotlinManifest.properties"))
|
||||
from(zipTree("$rootDir/dependencies/native-platform-uberjar.jar"))
|
||||
}
|
||||
|
||||
configureKotlinProjectSources() // no sources
|
||||
configureKotlinProjectNoTests()
|
||||
|
||||
ideaPlugin("lib/jps") {
|
||||
from(jar)
|
||||
}
|
||||
|
||||
ideaPlugin("lib/jps")
|
||||
|
||||
@@ -16,7 +16,7 @@ val projectsToShadow = listOf(
|
||||
":plugins:annotation-based-compiler-plugins-ide-support",
|
||||
":compiler:backend",
|
||||
":compiler:backend-common",
|
||||
":build-common",
|
||||
":kotlin-build-common",
|
||||
":compiler:cli-common",
|
||||
":compiler:container",
|
||||
":compiler:daemon-common",
|
||||
|
||||
Reference in New Issue
Block a user