Refactor compiler-related published projects
- move preparation into separate projects - rename projects for publishing - add compiler plugins
This commit is contained in:
@@ -176,6 +176,10 @@ allprojects {
|
||||
kotlinOptions.freeCompilerArgs = listOf("-Xallow-kotlin-package", "-module-name", project.name)
|
||||
}
|
||||
|
||||
tasks.withType<Javadoc> {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
task<Jar>("javadocJar") {
|
||||
classifier = "javadoc"
|
||||
}
|
||||
|
||||
+1
-157
@@ -1,70 +1,11 @@
|
||||
|
||||
import java.io.File
|
||||
import proguard.gradle.ProGuardTask
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
import org.gradle.api.internal.plugins.DslObject
|
||||
import org.gradle.api.publication.maven.internal.deployer.MavenRemoteRepository
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.3")
|
||||
classpath("net.sf.proguard:proguard-gradle:5.3.1")
|
||||
}
|
||||
}
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
plugins {
|
||||
maven
|
||||
}
|
||||
//apply { plugin("maven") }
|
||||
|
||||
|
||||
// Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build
|
||||
val shrink = true
|
||||
|
||||
val compilerManifestClassPath =
|
||||
"kotlin-runtime.jar kotlin-reflect.jar kotlin-script-runtime.jar"
|
||||
|
||||
val fatJarContents by configurations.creating
|
||||
val proguardLibraryJars by configurations.creating
|
||||
val fatJar by configurations.creating
|
||||
val compilerJar by configurations.creating
|
||||
val embeddableCompilerJar by configurations.creating
|
||||
|
||||
val compilerBaseName: String by rootProject.extra
|
||||
val embeddableCompilerBaseName: String by rootProject.extra
|
||||
|
||||
val javaHome = File(System.getProperty("java.home"))
|
||||
|
||||
val buildLocalRepoPath: File by rootProject.extra
|
||||
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
val otherCompilerModules = compilerModules.filter { it != path }
|
||||
|
||||
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
|
||||
|
||||
val packagesToRelocate =
|
||||
listOf("com.intellij",
|
||||
"com.google",
|
||||
"com.sampullara",
|
||||
"org.apache",
|
||||
"org.jdom",
|
||||
"org.picocontainer",
|
||||
"jline",
|
||||
"gnu",
|
||||
"javax.inject",
|
||||
"org.fusesource")
|
||||
|
||||
fun firstFromJavaHomeThatExists(vararg paths: String): File =
|
||||
paths.mapNotNull { File(javaHome, it).takeIf { it.exists() } }.firstOrNull()
|
||||
?: throw GradleException("Cannot find under '$javaHome' neither of: ${paths.joinToString()}")
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
val compileOnly by configurations
|
||||
@@ -95,37 +36,12 @@ dependencies {
|
||||
testCompile(project(":ant"))
|
||||
otherCompilerModules.forEach {
|
||||
testCompile(project(it))
|
||||
fatJarContents(project(it)) { isTransitive = false }
|
||||
}
|
||||
testRuntime(ideaSdkCoreDeps("*.jar"))
|
||||
testRuntime(ideaSdkDeps("*.jar"))
|
||||
// testRuntime(project(":prepare:compiler", configuration = "default"))
|
||||
// testRuntime(project(":kotlin-compiler", configuration = "default"))
|
||||
|
||||
buildVersion()
|
||||
|
||||
fatJarContents(project(":core:builtins", configuration = "builtins"))
|
||||
fatJarContents(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
|
||||
fatJarContents(ideaSdkDeps("jna-platform", "oromatcher"))
|
||||
fatJarContents(ideaSdkDeps("jps-model.jar", subdir = "jps"))
|
||||
fatJarContents(commonDep("javax.inject"))
|
||||
fatJarContents(commonDep("org.jline", "jline"))
|
||||
fatJarContents(protobufFull())
|
||||
fatJarContents(commonDep("com.github.spullara.cli-parser", "cli-parser"))
|
||||
fatJarContents(commonDep("com.google.code.findbugs", "jsr305"))
|
||||
fatJarContents(commonDep("io.javaslang", "javaslang"))
|
||||
fatJarContents(preloadedDeps("json-org"))
|
||||
|
||||
proguardLibraryJars(files(firstFromJavaHomeThatExists("lib/rt.jar", "../Classes/classes.jar"),
|
||||
firstFromJavaHomeThatExists("lib/jsse.jar", "../Classes/jsse.jar"),
|
||||
firstFromJavaHomeThatExists("../lib/tools.jar", "../Classes/tools.jar")))
|
||||
proguardLibraryJars(project(":kotlin-stdlib", configuration = "mainJar"))
|
||||
proguardLibraryJars(project(":kotlin-script-runtime", configuration = "mainJar"))
|
||||
proguardLibraryJars(project(":kotlin-reflect", configuration = "mainJar"))
|
||||
proguardLibraryJars(preloadedDeps("kotlinx-coroutines-core"))
|
||||
|
||||
// proguardLibraryJars(project(":prepare:runtime", configuration = "default").apply { isTransitive = false })
|
||||
// proguardLibraryJars(project(":prepare:reflect", configuration = "default").apply { isTransitive = false })
|
||||
// proguardLibraryJars(project(":core:script.runtime").apply { isTransitive = false })
|
||||
}
|
||||
|
||||
configureKotlinProjectSources(
|
||||
@@ -153,75 +69,3 @@ tasks.withType<Test> {
|
||||
ignoreFailures = true
|
||||
}
|
||||
|
||||
val packCompiler by task<ShadowJar> {
|
||||
configurations = listOf(fatJar)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
destinationDir = File(buildDir, "libs")
|
||||
baseName = compilerBaseName
|
||||
classifier = "before-proguard"
|
||||
dependsOn(protobufFullTask)
|
||||
|
||||
setupRuntimeJar("Kotlin Compiler")
|
||||
from(getCompiledClasses())
|
||||
from(fatJarContents)
|
||||
|
||||
manifest.attributes.put("Class-Path", compilerManifestClassPath)
|
||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
|
||||
}
|
||||
|
||||
val proguard by task<ProGuardTask> {
|
||||
dependsOn(packCompiler)
|
||||
configuration("$rootDir/compiler/compiler.pro")
|
||||
|
||||
val outputJar = File(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
||||
|
||||
inputs.files(packCompiler.outputs.files.singleFile)
|
||||
outputs.file(outputJar)
|
||||
|
||||
// TODO: remove after dropping compatibility with ant build
|
||||
doFirst {
|
||||
System.setProperty("kotlin-compiler-jar-before-shrink", packCompiler.outputs.files.singleFile.canonicalPath)
|
||||
System.setProperty("kotlin-compiler-jar", outputJar.canonicalPath)
|
||||
}
|
||||
|
||||
libraryjars(proguardLibraryJars)
|
||||
printconfiguration("$buildDir/compiler.pro.dump")
|
||||
}
|
||||
|
||||
val embeddable by task<ShadowJar> {
|
||||
destinationDir = File(buildDir, "libs")
|
||||
baseName = embeddableCompilerBaseName
|
||||
configurations = listOf(embeddableCompilerJar)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
dependsOn(proguard)
|
||||
from(proguard)
|
||||
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
|
||||
packagesToRelocate.forEach {
|
||||
relocate(it, "$kotlinEmbeddableRootPackage.$it")
|
||||
}
|
||||
relocate("org.fusesource", "$kotlinEmbeddableRootPackage.org.fusesource") {
|
||||
// TODO: remove "it." after #KT-12848 get addressed
|
||||
exclude("org.fusesource.jansi.internal.CLibrary")
|
||||
}
|
||||
}
|
||||
|
||||
dist {
|
||||
if (shrink) {
|
||||
from(proguard)
|
||||
} else {
|
||||
from(packCompiler)
|
||||
}
|
||||
rename(".*", compilerBaseName + ".jar")
|
||||
}
|
||||
|
||||
artifacts.add(compilerJar.name, proguard.outputs.files.singleFile) {
|
||||
builtBy(proguard)
|
||||
classifier = ""
|
||||
name = compilerBaseName
|
||||
}
|
||||
artifacts.add(embeddableCompilerJar.name, embeddable.outputs.files.singleFile) {
|
||||
builtBy(embeddable)
|
||||
classifier = ""
|
||||
name = embeddableCompilerBaseName
|
||||
}
|
||||
|
||||
|
||||
@@ -79,12 +79,12 @@ dependencies {
|
||||
testCompile(project(":plugins:android-extensions-compiler"))
|
||||
testCompile(project(":plugins:android-extensions-idea")) { isTransitive = false }
|
||||
testCompile(project(":plugins:allopen-ide")) { isTransitive = false }
|
||||
testCompile(project(":plugins:allopen-cli"))
|
||||
testCompile(project(":kotlin-allopen-compiler-plugin"))
|
||||
testCompile(project(":plugins:noarg-ide")) { isTransitive = false }
|
||||
testCompile(project(":plugins:noarg-cli"))
|
||||
testCompile(project(":kotlin-noarg-compiler-plugin"))
|
||||
testCompile(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
|
||||
testCompile(project(":plugins:sam-with-receiver-ide")) { isTransitive = false }
|
||||
testCompile(project(":plugins:sam-with-receiver-cli"))
|
||||
testCompile(project(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
testCompile(project(":idea:idea-android")) { isTransitive = false }
|
||||
testCompile(project(":plugins:lint")) { isTransitive = false }
|
||||
testCompile(project(":plugins:uast-kotlin"))
|
||||
|
||||
@@ -13,8 +13,8 @@ dependencies {
|
||||
compile project(':kotlin-gradle-plugin-api')
|
||||
|
||||
compile project(':kotlin-stdlib')
|
||||
compileOnly project(path: ':compiler', configuration: 'embeddableCompilerJar')
|
||||
compile project(':plugins:allopen-cli')
|
||||
compileOnly project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar')
|
||||
compile project(':kotlin-allopen-compiler-plugin')
|
||||
|
||||
compileOnly 'org.jetbrains.kotlin:gradle-api:1.6'
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ dependencies {
|
||||
|
||||
compile project(':kotlin-stdlib')
|
||||
compileOnly project(':compiler')
|
||||
compile project(':plugins:noarg-cli')
|
||||
compile project(':kotlin-noarg-compiler-plugin')
|
||||
|
||||
compileOnly 'org.jetbrains.kotlin:gradle-api:1.6'
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ dependencies {
|
||||
|
||||
compile project(':kotlin-stdlib')
|
||||
compileOnly project(':compiler')
|
||||
compile project(':plugins:sam-with-receiver-cli')
|
||||
compile project(':kotlin-sam-with-receiver-compiler-plugin')
|
||||
|
||||
compileOnly 'org.jetbrains.kotlin:gradle-api:1.6'
|
||||
}
|
||||
|
||||
@@ -1,30 +1,32 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
description = "Kotlin AllOpen Compiler Plugin"
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
compile(ideaSdkCoreDeps("intellij-core"))
|
||||
compile(project(":compiler:plugin-api"))
|
||||
compile(project(":compiler:frontend"))
|
||||
val compileOnly by configurations
|
||||
val runtime by configurations
|
||||
compileOnly(ideaSdkCoreDeps("intellij-core"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
compileOnly(project(":compiler:frontend"))
|
||||
runtime(project(":kotlin-compiler", configuration = "runtimeJar"))
|
||||
runtime(project(":kotlin-stdlib"))
|
||||
}
|
||||
|
||||
configureKotlinProjectSourcesDefault()
|
||||
configureKotlinProjectNoTests()
|
||||
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
setupRuntimeJar("Kotlin AllOpen Compiler Plugin")
|
||||
val jar = runtimeJar {
|
||||
from(fileTree("$projectDir/src")) { include("META-INF/**") }
|
||||
archiveName = "allopen-compiler-plugin.jar"
|
||||
}
|
||||
|
||||
dist {
|
||||
from(jar)
|
||||
rename("^kotlin-", "")
|
||||
}
|
||||
|
||||
ideaPlugin {
|
||||
from(jar)
|
||||
rename("^kotlin-", "")
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ apply { plugin("kotlin") }
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
compile(project(":plugins:allopen-cli"))
|
||||
compile(project(":kotlin-allopen-compiler-plugin"))
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":compiler:cli-common"))
|
||||
|
||||
@@ -1,32 +1,34 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
description = "Kotlin NoArg Compiler Plugin"
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":compiler:frontend.java"))
|
||||
compile(project(":compiler:backend"))
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:plugin-api"))
|
||||
val compileOnly by configurations
|
||||
val runtime by configurations
|
||||
compileOnly(project(":compiler:frontend"))
|
||||
compileOnly(project(":compiler:frontend.java"))
|
||||
compileOnly(project(":compiler:backend"))
|
||||
compileOnly(project(":compiler:util"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
runtime(project(":kotlin-compiler", configuration = "runtimeJar"))
|
||||
runtime(project(":kotlin-stdlib"))
|
||||
}
|
||||
|
||||
configureKotlinProjectSourcesDefault()
|
||||
configureKotlinProjectNoTests()
|
||||
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
setupRuntimeJar("Kotlin NoArg Compiler Plugin")
|
||||
val jar = runtimeJar {
|
||||
from(fileTree("$projectDir/src")) { include("META-INF/**") }
|
||||
archiveName = "noarg-compiler-plugin.jar"
|
||||
}
|
||||
|
||||
dist {
|
||||
from(jar)
|
||||
rename("^kotlin-", "")
|
||||
}
|
||||
|
||||
ideaPlugin {
|
||||
from(jar)
|
||||
rename("^kotlin-", "")
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ apply { plugin("kotlin") }
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
compile(project(":plugins:noarg-cli"))
|
||||
compile(project(":kotlin-noarg-compiler-plugin"))
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":compiler:frontend.java"))
|
||||
|
||||
@@ -14,12 +14,12 @@ dependencies {
|
||||
testCompile(project(":plugins:android-extensions-compiler"))
|
||||
testCompile(project(":plugins:android-extensions-idea"))
|
||||
testCompile(project(":plugins:allopen-ide")) { isTransitive = false }
|
||||
testCompile(project(":plugins:allopen-cli"))
|
||||
testCompile(project(":kotlin-allopen-compiler-plugin"))
|
||||
testCompile(project(":plugins:noarg-ide")) { isTransitive = false }
|
||||
testCompile(project(":plugins:noarg-cli"))
|
||||
testCompile(project(":kotlin-noarg-compiler-plugin"))
|
||||
testCompile(project(":plugins:annotation-based-compiler-plugins-ide-support")) { isTransitive = false }
|
||||
testCompile(project(":plugins:sam-with-receiver-ide")) { isTransitive = false }
|
||||
testCompile(project(":plugins:sam-with-receiver-cli"))
|
||||
testCompile(project(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
testCompile(project(":idea:idea-android")) { isTransitive = false }
|
||||
testCompile(project(":plugins:lint")) { isTransitive = false }
|
||||
testCompile(project(":plugins:uast-kotlin"))
|
||||
|
||||
@@ -1,30 +1,36 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
description = "Kotlin SamWithReceiver Compiler Plugin"
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":compiler:frontend.java"))
|
||||
compile(project(":compiler:plugin-api"))
|
||||
val compileOnly by configurations
|
||||
val runtime by configurations
|
||||
compileOnly(project(":compiler:frontend"))
|
||||
compileOnly(project(":compiler:frontend.java"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
runtime(project(":kotlin-compiler", configuration = "runtimeJar"))
|
||||
runtime(project(":kotlin-stdlib"))
|
||||
}
|
||||
|
||||
configureKotlinProjectSourcesDefault()
|
||||
configureKotlinProjectNoTests()
|
||||
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
setupRuntimeJar("Kotlin SamWithReceiver Compiler Plugin")
|
||||
val jar = runtimeJar {
|
||||
from(fileTree("$projectDir/src")) { include("META-INF/**") }
|
||||
archiveName = "sam-with-receiver-compiler-plugin.jar"
|
||||
}
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
publish()
|
||||
|
||||
dist {
|
||||
from(jar)
|
||||
rename("^kotlin-", "")
|
||||
}
|
||||
|
||||
ideaPlugin {
|
||||
from(jar)
|
||||
rename("^kotlin-", "")
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ apply { plugin("kotlin") }
|
||||
|
||||
dependencies {
|
||||
val compile by configurations
|
||||
compile(project(":plugins:sam-with-receiver-cli"))
|
||||
compile(project(":kotlin-sam-with-receiver-compiler-plugin"))
|
||||
compile(project(":plugins:annotation-based-compiler-plugins-ide-support"))
|
||||
compile(project(":compiler:util"))
|
||||
compile(project(":compiler:frontend"))
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
import org.gradle.jvm.tasks.Jar
|
||||
description = "Kotlin SourceSections Compiler Plugin"
|
||||
|
||||
apply { plugin("kotlin") }
|
||||
|
||||
@@ -9,9 +9,12 @@ dependencies {
|
||||
val testCompile by configurations
|
||||
val testCompileOnly by configurations
|
||||
val testRuntime by configurations
|
||||
compile(project(":compiler:frontend"))
|
||||
compile(project(":compiler:frontend.script"))
|
||||
compile(project(":compiler:plugin-api"))
|
||||
compileOnly(project(":compiler:frontend"))
|
||||
compileOnly(project(":compiler:frontend.script"))
|
||||
compileOnly(project(":compiler:plugin-api"))
|
||||
testCompile(project(":compiler:frontend"))
|
||||
testCompile(project(":compiler:frontend.script"))
|
||||
testCompile(project(":compiler:plugin-api"))
|
||||
testCompile(project(":compiler.tests-common"))
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":compiler:util"))
|
||||
@@ -28,11 +31,11 @@ configureKotlinProjectResources("src") {
|
||||
}
|
||||
configureKotlinProjectTestsDefault()
|
||||
|
||||
val jar: Jar by tasks
|
||||
jar.apply {
|
||||
setupRuntimeJar("Kotlin SourceSections Compiler Plugin")
|
||||
archiveName = "kotlin-source-sections-compiler-plugin.jar"
|
||||
}
|
||||
val jar = runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
publish()
|
||||
|
||||
dist {
|
||||
from(jar)
|
||||
|
||||
@@ -1,38 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
description = "Kotlin compiler client embeddable"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
@@ -53,7 +22,6 @@ val jarContents by configurations.creating
|
||||
val testRuntimeCompilerJar by configurations.creating
|
||||
val testStdlibJar by configurations.creating
|
||||
val testScriptRuntimeJar by configurations.creating
|
||||
val default by configurations
|
||||
val archives by configurations
|
||||
|
||||
val projectsToInclude = listOf(
|
||||
@@ -70,18 +38,11 @@ dependencies {
|
||||
testCompile(commonDep("junit:junit"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-jvm"))
|
||||
testCompile(project(":kotlin-test:kotlin-test-junit"))
|
||||
testRuntimeCompilerJar(project(":compiler", configuration = "compilerJar"))
|
||||
testRuntimeCompilerJar(project(":kotlin-compiler", configuration = "runtimeJar"))
|
||||
testStdlibJar(project(":kotlin-stdlib", configuration = "mainJar"))
|
||||
testScriptRuntimeJar(project(":kotlin-script-runtime", configuration = "mainJar"))
|
||||
}
|
||||
|
||||
val shadowJar by task<ShadowJar> {
|
||||
setupRuntimeJar("Kotlin compiler client embeddable")
|
||||
baseName = "kotlin-compiler-client-embeddable"
|
||||
from(jarContents)
|
||||
classifier = ""
|
||||
}
|
||||
|
||||
configureKotlinProjectSources() // no sources
|
||||
configureKotlinProjectTests("libraries/tools/kotlin-compiler-client-embeddable-test/src", sourcesBaseDir = rootDir)
|
||||
|
||||
@@ -108,18 +69,15 @@ archives.artifacts.let { artifacts ->
|
||||
}
|
||||
}
|
||||
|
||||
artifacts.add(default.name, shadowJar.outputs.files.singleFile) {
|
||||
builtBy(shadowJar)
|
||||
classifier = ""
|
||||
runtimeJar(task<ShadowJar>("shadowJar")) {
|
||||
from(jarContents)
|
||||
}
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
artifacts.add("archives", shadowJar.outputs.files.singleFile) {
|
||||
builtBy(shadowJar)
|
||||
classifier = ""
|
||||
}
|
||||
|
||||
apply<plugins.PublishedKotlinModule>()
|
||||
publish()
|
||||
|
||||
// TODO: remove after finalizing publishing (now due to the problems with sam-with-receiver, the code is not fully navigable in the buildSrc)
|
||||
//tasks {
|
||||
// "uploadArchives"(Upload::class) {
|
||||
//
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
description = "Kotlin Compiler (embeddable)"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
@@ -11,10 +13,7 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
val embedCfg = configurations.create("embed")
|
||||
val mainCfg = configurations.create("default")
|
||||
|
||||
val embeddableCompilerBaseName: String by rootProject.extra
|
||||
val compilerJar by configurations.creating
|
||||
|
||||
val kotlinEmbeddableRootPackage = "org.jetbrains.kotlin"
|
||||
|
||||
@@ -31,16 +30,14 @@ val packagesToRelocate =
|
||||
"org.fusesource")
|
||||
|
||||
dependencies {
|
||||
embedCfg(project(":prepare:compiler", configuration = "default"))
|
||||
compilerJar(project(":kotlin-compiler", configuration = "runtimeJar"))
|
||||
}
|
||||
|
||||
val embeddableTask = task<ShadowJar>("prepare") {
|
||||
runtimeJar(task<ShadowJar>("embeddable")) {
|
||||
destinationDir = File(buildDir, "libs")
|
||||
baseName = embeddableCompilerBaseName
|
||||
configurations = listOf(mainCfg)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
dependsOn(":build-common:assemble", ":core:script.runtime:assemble")
|
||||
from(embedCfg.files)
|
||||
// dependsOn(":kotlin-compiler:proguard")
|
||||
from(compilerJar)
|
||||
relocate("com.google.protobuf", "org.jetbrains.kotlin.protobuf")
|
||||
packagesToRelocate.forEach {
|
||||
relocate(it, "$kotlinEmbeddableRootPackage.$it")
|
||||
@@ -51,9 +48,8 @@ val embeddableTask = task<ShadowJar>("prepare") {
|
||||
}
|
||||
}
|
||||
|
||||
defaultTasks(embeddableTask.name)
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
publish()
|
||||
|
||||
artifacts.add(mainCfg.name, embeddableTask.outputs.files.singleFile) {
|
||||
builtBy(embeddableTask)
|
||||
classifier = ""
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import proguard.gradle.ProGuardTask
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.file.DuplicatesStrategy
|
||||
|
||||
description = "Kotlin Compiler"
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter()
|
||||
@@ -15,22 +17,21 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
apply { plugin("maven") }
|
||||
plugins {
|
||||
`java-base`
|
||||
}
|
||||
|
||||
// Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build
|
||||
val shrink = true
|
||||
val bootstrapBuild = false
|
||||
|
||||
val compilerManifestClassPath =
|
||||
if (bootstrapBuild) "kotlin-runtime-internal-bootstrap.jar kotlin-reflect-internal-bootstrap.jar kotlin-script-runtime-internal-bootstrap.jar"
|
||||
else "kotlin-runtime.jar kotlin-reflect.jar kotlin-script-runtime.jar"
|
||||
"kotlin-runtime.jar kotlin-reflect.jar kotlin-script-runtime.jar"
|
||||
|
||||
val ideaSdkCoreCfg = configurations.create("ideaSdk-core")
|
||||
val otherDepsCfg = configurations.create("other-deps")
|
||||
val proguardLibraryJarsCfg = configurations.create("library-jars")
|
||||
val mainCfg = configurations.create("default_")
|
||||
val packedCfg = configurations.create("packed")
|
||||
//val withBootstrapRuntimeCfg = configurations.create("withBootstrapRuntime")
|
||||
val fatJarContents by configurations.creating
|
||||
val fatSourcesJarContents by configurations.creating
|
||||
val proguardLibraryJars by configurations.creating
|
||||
val fatJar by configurations.creating
|
||||
val compilerJar by configurations.creating
|
||||
val archives by configurations
|
||||
|
||||
val compilerBaseName: String by rootProject.extra
|
||||
|
||||
@@ -38,81 +39,113 @@ val outputJar = File(buildDir, "libs", "$compilerBaseName.jar")
|
||||
|
||||
val javaHome = System.getProperty("java.home")
|
||||
|
||||
val compilerProject = project(":compiler")
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
|
||||
dependencies {
|
||||
ideaSdkCoreCfg(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
|
||||
ideaSdkCoreCfg(ideaSdkDeps("jna-platform", "oromatcher"))
|
||||
ideaSdkCoreCfg(ideaSdkDeps("jps-model.jar", subdir = "jps"))
|
||||
otherDepsCfg(commonDep("javax.inject"))
|
||||
otherDepsCfg(commonDep("org.jline", "jline"))
|
||||
otherDepsCfg(protobufFull())
|
||||
otherDepsCfg(commonDep("com.github.spullara.cli-parser", "cli-parser"))
|
||||
otherDepsCfg(commonDep("com.google.code.findbugs", "jsr305"))
|
||||
otherDepsCfg(commonDep("io.javaslang","javaslang"))
|
||||
otherDepsCfg(preloadedDeps("json-org"))
|
||||
buildVersion()
|
||||
proguardLibraryJarsCfg(files("$javaHome/lib/rt.jar".takeIf { File(it).exists() } ?: "$javaHome/../Classes/classes.jar",
|
||||
"$javaHome/lib/jsse.jar".takeIf { File(it).exists() } ?: "$javaHome/../Classes/jsse.jar"))
|
||||
proguardLibraryJarsCfg(kotlinDep("stdlib"))
|
||||
proguardLibraryJarsCfg(kotlinDep("script-runtime"))
|
||||
proguardLibraryJarsCfg(kotlinDep("reflect"))
|
||||
proguardLibraryJarsCfg(files("${System.getProperty("java.home")}/../lib/tools.jar"))
|
||||
// proguardLibraryJarsCfg(project(":prepare:runtime", configuration = "default").apply { isTransitive = false })
|
||||
// proguardLibraryJarsCfg(project(":prepare:reflect", configuration = "default").apply { isTransitive = false })
|
||||
// proguardLibraryJarsCfg(project(":core:script.runtime").apply { isTransitive = false })
|
||||
val packagesToRelocate =
|
||||
listOf("com.intellij",
|
||||
"com.google",
|
||||
"com.sampullara",
|
||||
"org.apache",
|
||||
"org.jdom",
|
||||
"org.picocontainer",
|
||||
"jline",
|
||||
"gnu",
|
||||
"javax.inject",
|
||||
"org.fusesource")
|
||||
|
||||
fun firstFromJavaHomeThatExists(vararg paths: String): File =
|
||||
paths.mapNotNull { File(javaHome, it).takeIf { it.exists() } }.firstOrNull()
|
||||
?: throw GradleException("Cannot find under '$javaHome' neither of: ${paths.joinToString()}")
|
||||
|
||||
compilerModules.forEach { evaluationDependsOn(it) }
|
||||
|
||||
val compiledModulesSources = compilerModules.map {
|
||||
project(it).the<JavaPluginConvention>().sourceSets.getByName("main").allSource
|
||||
}
|
||||
|
||||
val packCompilerTask = task<ShadowJar>("internal.pack-compiler") {
|
||||
configurations = listOf(packedCfg)
|
||||
dependencies {
|
||||
compilerModules.forEach {
|
||||
fatJarContents(project(it)) { isTransitive = false }
|
||||
}
|
||||
compiledModulesSources.forEach {
|
||||
fatSourcesJarContents(it)
|
||||
}
|
||||
// buildVersion()
|
||||
|
||||
fatJarContents(project(":core:builtins", configuration = "builtins"))
|
||||
fatJarContents(ideaSdkCoreDeps(*(rootProject.extra["ideaCoreSdkJars"] as Array<String>)))
|
||||
fatJarContents(ideaSdkDeps("jna-platform", "oromatcher"))
|
||||
fatJarContents(ideaSdkDeps("jps-model.jar", subdir = "jps"))
|
||||
fatJarContents(commonDep("javax.inject"))
|
||||
fatJarContents(commonDep("org.jline", "jline"))
|
||||
fatJarContents(protobufFull())
|
||||
fatJarContents(commonDep("com.github.spullara.cli-parser", "cli-parser"))
|
||||
fatJarContents(commonDep("com.google.code.findbugs", "jsr305"))
|
||||
fatJarContents(commonDep("io.javaslang", "javaslang"))
|
||||
fatJarContents(preloadedDeps("json-org"))
|
||||
|
||||
proguardLibraryJars(files(firstFromJavaHomeThatExists("lib/rt.jar", "../Classes/classes.jar"),
|
||||
firstFromJavaHomeThatExists("lib/jsse.jar", "../Classes/jsse.jar"),
|
||||
firstFromJavaHomeThatExists("../lib/tools.jar", "../Classes/tools.jar")))
|
||||
proguardLibraryJars(project(":kotlin-stdlib", configuration = "mainJar"))
|
||||
proguardLibraryJars(project(":kotlin-script-runtime", configuration = "mainJar"))
|
||||
proguardLibraryJars(project(":kotlin-reflect", configuration = "mainJar"))
|
||||
proguardLibraryJars(preloadedDeps("kotlinx-coroutines-core"))
|
||||
|
||||
// proguardLibraryJars(project(":prepare:runtime", configuration = "default").apply { isTransitive = false })
|
||||
// proguardLibraryJars(project(":prepare:reflect", configuration = "default").apply { isTransitive = false })
|
||||
// proguardLibraryJars(project(":core:script.runtime").apply { isTransitive = false })
|
||||
}
|
||||
|
||||
val packCompiler by task<ShadowJar> {
|
||||
configurations = listOf(fatJar)
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
destinationDir = File(buildDir, "libs")
|
||||
baseName = compilerBaseName + "-before-shrink"
|
||||
// baseName = compilerBaseName
|
||||
dependsOn(protobufFullTask)
|
||||
setupRuntimeJar("Kotlin Compiler")
|
||||
(rootProject.extra["compilerModules"] as Array<String>).forEach {
|
||||
dependsOn("$it:classes")
|
||||
from(project(it).getCompiledClasses())
|
||||
}
|
||||
from(ideaSdkCoreCfg.files)
|
||||
from(otherDepsCfg.files)
|
||||
from(project(":core:builtins").getResourceFiles()) { include("kotlin/**") }
|
||||
|
||||
setupPublicJar("before-proguard", "")
|
||||
from(fatJarContents)
|
||||
|
||||
manifest.attributes.put("Class-Path", compilerManifestClassPath)
|
||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.cli.jvm.K2JVMCompiler")
|
||||
}
|
||||
|
||||
val proguardTask = task<ProGuardTask>("internal.proguard-compiler") {
|
||||
dependsOn(packCompilerTask)
|
||||
val proguard by task<ProGuardTask> {
|
||||
dependsOn(packCompiler)
|
||||
configuration("$rootDir/compiler/compiler.pro")
|
||||
|
||||
inputs.files(packCompilerTask.outputs.files.singleFile)
|
||||
val outputJar = File(buildDir, "libs", "$compilerBaseName-after-proguard.jar")
|
||||
|
||||
inputs.files(packCompiler.outputs.files.singleFile)
|
||||
outputs.file(outputJar)
|
||||
|
||||
// TODO: remove after dropping compatibility with ant build
|
||||
doFirst {
|
||||
System.setProperty("kotlin-compiler-jar-before-shrink", packCompilerTask.outputs.files.singleFile.canonicalPath)
|
||||
System.setProperty("kotlin-compiler-jar-before-shrink", packCompiler.outputs.files.singleFile.canonicalPath)
|
||||
System.setProperty("kotlin-compiler-jar", outputJar.canonicalPath)
|
||||
}
|
||||
|
||||
proguardLibraryJarsCfg.files.forEach { jar ->
|
||||
libraryjars(jar)
|
||||
}
|
||||
libraryjars(proguardLibraryJars)
|
||||
printconfiguration("$buildDir/compiler.pro.dump")
|
||||
}
|
||||
|
||||
dist {
|
||||
if (shrink) {
|
||||
from(proguardTask)
|
||||
from(proguard)
|
||||
} else {
|
||||
from(packCompilerTask)
|
||||
rename("-before-shrink", "")
|
||||
from(packCompiler)
|
||||
}
|
||||
rename(".*", compilerBaseName + ".jar")
|
||||
}
|
||||
|
||||
artifacts.add(mainCfg.name, proguardTask.outputs.files.singleFile) {
|
||||
builtBy(proguardTask)
|
||||
runtimeJarArtifactBy(proguard, proguard.outputs.files.singleFile) {
|
||||
name = compilerBaseName
|
||||
classifier = ""
|
||||
}
|
||||
sourcesJar {
|
||||
from(fatSourcesJarContents)
|
||||
}
|
||||
javadocJar()
|
||||
|
||||
|
||||
publish()
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
|
||||
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()
|
||||
}
|
||||
|
||||
configureKotlinProjectSourcesDefault()
|
||||
configureKotlinProjectNoTests()
|
||||
|
||||
val jar = runtimeJar {
|
||||
from(zipTree(nativePlatformUberjar))
|
||||
}
|
||||
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from(jar)
|
||||
}
|
||||
|
||||
publish()
|
||||
+19
-12
@@ -4,8 +4,8 @@ include ":build-common",
|
||||
":compiler",
|
||||
":compiler:util",
|
||||
":compiler:daemon-common",
|
||||
":compiler:daemon-client",
|
||||
":compiler:preloader",
|
||||
":kotlin-daemon-client",
|
||||
":kotlin-preloader",
|
||||
":compiler:cli-runner",
|
||||
":compiler:container",
|
||||
":compiler:resolution",
|
||||
@@ -55,13 +55,13 @@ include ":build-common",
|
||||
":plugins:android-extensions-compiler",
|
||||
":plugins:android-extensions-idea",
|
||||
":plugins:android-extensions-jps",
|
||||
":plugins:allopen-cli",
|
||||
":kotlin-allopen-compiler-plugin",
|
||||
":plugins:allopen-ide",
|
||||
":plugins:noarg-cli",
|
||||
":kotlin-noarg-compiler-plugin",
|
||||
":plugins:noarg-ide",
|
||||
":plugins:sam-with-receiver-cli",
|
||||
":kotlin-sam-with-receiver-compiler-plugin",
|
||||
":plugins:sam-with-receiver-ide",
|
||||
":plugins:source-sections-compiler",
|
||||
":kotlin-source-sections-compiler-plugin",
|
||||
":plugins:uast-kotlin",
|
||||
":plugins:uast-kotlin-idea",
|
||||
":plugins:annotation-based-compiler-plugins-ide-support",
|
||||
@@ -86,7 +86,10 @@ include ":build-common",
|
||||
":prepare:kotlin-plugin",
|
||||
":prepare:android-lint",
|
||||
":prepare:mock-runtime-for-test",
|
||||
":prepare:compiler-client-embeddable",
|
||||
":kotlin-compiler",
|
||||
":kotlin-compiler-embeddable",
|
||||
":kotlin-compiler-client-embeddable",
|
||||
":kotlin-daemon-client",
|
||||
":kotlin-reflect",
|
||||
":ant",
|
||||
":compiler:tests-java8",
|
||||
@@ -119,10 +122,14 @@ project(':kotlin-stdlib-jre7').projectDir = "$rootDir/libraries/stdlib/jre7" as
|
||||
project(':kotlin-stdlib-jre8').projectDir = "$rootDir/libraries/stdlib/jre8" as File
|
||||
project(':kotlin-stdlib:samples').projectDir = "$rootDir/libraries/stdlib/samples" as File
|
||||
project(':kotlin-reflect').projectDir = "$rootDir/libraries/tools/kotlin-reflect" as File
|
||||
project(':kotlin-compiler').projectDir = "$rootDir/prepare/compiler" as File
|
||||
project(':kotlin-compiler-embeddable').projectDir = "$rootDir/prepare/compiler-embeddable" as File
|
||||
project(':kotlin-compiler-client-embeddable').projectDir = "$rootDir/prepare/compiler-client-embeddable" as File
|
||||
project(':kotlin-daemon-client').projectDir = "$rootDir/prepare/daemon-client" as File
|
||||
project(':compiler:cli-common').projectDir = "$rootDir/compiler/cli/cli-common" as File
|
||||
project(':compiler:cli-runner').projectDir = "$rootDir/compiler/cli/cli-runner" as File
|
||||
project(':compiler:daemon-common').projectDir = "$rootDir/compiler/daemon/daemon-common" as File
|
||||
project(':compiler:daemon-client').projectDir = "$rootDir/compiler/daemon/daemon-client" as File
|
||||
project(':kotlin-daemon-client').projectDir = "$rootDir/compiler/daemon/daemon-client" as File
|
||||
project(':compiler:ir.tree').projectDir = "$rootDir/compiler/ir/ir.tree" as File
|
||||
project(':compiler:ir.psi2ir').projectDir = "$rootDir/compiler/ir/ir.psi2ir" as File
|
||||
project(':compiler:ir.ir2cfg').projectDir = "$rootDir/compiler/ir/ir.ir2cfg" as File
|
||||
@@ -130,13 +137,13 @@ project(':idea:idea-android-output-parser').projectDir = "$rootDir/idea/idea-and
|
||||
project(':plugins:android-extensions-compiler').projectDir = "$rootDir/plugins/android-extensions/android-extensions-compiler" as File
|
||||
project(':plugins:android-extensions-idea').projectDir = "$rootDir/plugins/android-extensions/android-extensions-idea" as File
|
||||
project(':plugins:android-extensions-jps').projectDir = "$rootDir/plugins/android-extensions/android-extensions-jps" as File
|
||||
project(':plugins:allopen-cli').projectDir = "$rootDir/plugins/allopen/allopen-cli" as File
|
||||
project(':kotlin-allopen-compiler-plugin').projectDir = "$rootDir/plugins/allopen/allopen-cli" as File
|
||||
project(':plugins:allopen-ide').projectDir = "$rootDir/plugins/allopen/allopen-ide" as File
|
||||
project(':plugins:noarg-cli').projectDir = "$rootDir/plugins/noarg/noarg-cli" as File
|
||||
project(':kotlin-noarg-compiler-plugin').projectDir = "$rootDir/plugins/noarg/noarg-cli" as File
|
||||
project(':plugins:noarg-ide').projectDir = "$rootDir/plugins/noarg/noarg-ide" as File
|
||||
project(':plugins:sam-with-receiver-cli').projectDir = "$rootDir/plugins/sam-with-receiver/sam-with-receiver-cli" as File
|
||||
project(':kotlin-sam-with-receiver-compiler-plugin').projectDir = "$rootDir/plugins/sam-with-receiver/sam-with-receiver-cli" as File
|
||||
project(':plugins:sam-with-receiver-ide').projectDir = "$rootDir/plugins/sam-with-receiver/sam-with-receiver-ide" as File
|
||||
project(':plugins:source-sections-compiler').projectDir = "$rootDir/plugins/source-sections/source-sections-compiler" as File
|
||||
project(':kotlin-source-sections-compiler-plugin').projectDir = "$rootDir/plugins/source-sections/source-sections-compiler" as File
|
||||
project(':tools:binary-compatibility-validator').projectDir = "$rootDir/libraries/tools/binary-compatibility-validator" as File
|
||||
project(':tools:kotlin-stdlib-js-merger').projectDir = "$rootDir/libraries/tools/kotlin-stdlib-js-merger" as File
|
||||
project(':tools:kotlin-stdlib-gen').projectDir = "$rootDir/libraries/tools/kotlin-stdlib-gen" as File
|
||||
|
||||
Reference in New Issue
Block a user