Build: Centralize compiler dist build logic in :kotlin-compiler project
This commit is contained in:
@@ -19,6 +19,3 @@ sourceSets {
|
||||
runtimeJar {
|
||||
manifest.attributes.put("Class-Path", "$compilerManifestClassPath kotlin-preloader.jar")
|
||||
}
|
||||
|
||||
dist()
|
||||
|
||||
|
||||
+2
-7
@@ -437,13 +437,8 @@ gradle.taskGraph.whenReady {
|
||||
}
|
||||
}
|
||||
|
||||
val dist by task<Copy> {
|
||||
val childDistTasks = getTasksByName("dist", true) - this@task
|
||||
dependsOn(childDistTasks)
|
||||
|
||||
into(distDir)
|
||||
from(files("compiler/cli/bin")) { into("kotlinc/bin") }
|
||||
from(files("license")) { into("kotlinc/license") }
|
||||
val dist = tasks.register("dist") {
|
||||
dependsOn(":kotlin-compiler:dist")
|
||||
}
|
||||
|
||||
val copyCompilerToIdeaPlugin by task<Copy> {
|
||||
|
||||
@@ -151,31 +151,6 @@ fun Project.publish(body: Upload.() -> Unit = {}): Upload {
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.dist(
|
||||
targetDir: File? = null,
|
||||
targetName: String? = null,
|
||||
fromTask: Task? = null,
|
||||
body: AbstractCopyTask.() -> Unit = {}
|
||||
): AbstractCopyTask {
|
||||
val distJarCfg = configurations.getOrCreate("distJar")
|
||||
val distLibDir: File by rootProject.extra
|
||||
val distJarName = targetName ?: (the<BasePluginConvention>().archivesBaseName + ".jar")
|
||||
val thisProject = this
|
||||
|
||||
return task<Copy>("dist") {
|
||||
body()
|
||||
(fromTask ?: runtimeJarTaskIfExists())?.let {
|
||||
from(it)
|
||||
if (targetName != null) {
|
||||
rename(it.outputs.files.singleFile.name, targetName)
|
||||
}
|
||||
}
|
||||
rename("-${java.util.regex.Pattern.quote(thisProject.version.toString())}", "")
|
||||
into(targetDir ?: distLibDir)
|
||||
project.addArtifact(distJarCfg, this, File(targetDir ?: distLibDir, distJarName))
|
||||
}
|
||||
}
|
||||
|
||||
private fun Project.runtimeJarTaskIfExists(): Task? =
|
||||
if (extra.has("runtimeJarTask")) extra["runtimeJarTask"] as Task
|
||||
else tasks.findByName("jar")
|
||||
|
||||
@@ -73,13 +73,14 @@ fun Project.ideaUltimatePreloadedDeps(vararg artifactBaseNames: String, subdir:
|
||||
else files()
|
||||
}
|
||||
|
||||
fun Project.kotlinDep(artifactBaseName: String, version: String): String = "org.jetbrains.kotlin:kotlin-$artifactBaseName:$version"
|
||||
fun Project.kotlinDep(artifactBaseName: String, version: String, classifier: String? = null): String =
|
||||
listOfNotNull("org.jetbrains.kotlin:kotlin-$artifactBaseName:$version", classifier).joinToString(":")
|
||||
|
||||
fun Project.kotlinStdlib(suffix: String? = null): Any {
|
||||
fun Project.kotlinStdlib(suffix: String? = null, classifier: String? = null): Any {
|
||||
return if (kotlinBuildProperties.useBootstrapStdlib)
|
||||
kotlinDep(listOfNotNull("stdlib", suffix).joinToString("-"), bootstrapKotlinVersion)
|
||||
kotlinDep(listOfNotNull("stdlib", suffix).joinToString("-"), bootstrapKotlinVersion, classifier)
|
||||
else
|
||||
dependencies.project(listOfNotNull(":kotlin-stdlib", suffix).joinToString("-"))
|
||||
dependencies.project(listOfNotNull(":kotlin-stdlib", suffix).joinToString("-"), classifier)
|
||||
}
|
||||
|
||||
fun Project.kotlinBuiltins(): Any =
|
||||
|
||||
@@ -19,6 +19,3 @@ runtimeJar {
|
||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.runner.Main")
|
||||
manifest.attributes.put("Class-Path", "kotlin-stdlib.jar")
|
||||
}
|
||||
|
||||
dist()
|
||||
|
||||
|
||||
@@ -57,5 +57,3 @@ runtimeJar(task<ShadowJar>("shadowJar")) {
|
||||
sourcesJar()
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
@@ -71,5 +71,3 @@ runtimeJar(task<ShadowJar>("shadowJar")) {
|
||||
sourcesJar()
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
@@ -50,5 +50,3 @@ runtimeJar()
|
||||
sourcesJar()
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
@@ -22,5 +22,3 @@ sourceSets {
|
||||
runtimeJar {
|
||||
manifest.attributes.put("Main-Class", "org.jetbrains.kotlin.preloading.Preloader")
|
||||
}
|
||||
|
||||
dist()
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
ext.configureJvmProject = { Project project ->
|
||||
project.configure(project) {
|
||||
configurations {
|
||||
sources
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.kotlin
|
||||
@@ -31,6 +35,10 @@ ext.configureJavaOnlyJvm6Project = { Project project ->
|
||||
|
||||
ext.configureJvm6Project = { Project project ->
|
||||
project.configure(project) {
|
||||
configurations {
|
||||
sources
|
||||
}
|
||||
|
||||
project.ext.jvmTarget = "1.6"
|
||||
project.ext.javaHome = JDK_16
|
||||
|
||||
@@ -132,24 +140,6 @@ ext.signPom = { Project project, MavenDeployer deployer ->
|
||||
}
|
||||
}
|
||||
|
||||
ext.configureDist = { Project project ->
|
||||
project.configure(project) {
|
||||
configurations {
|
||||
distJar
|
||||
}
|
||||
|
||||
task dist(type: Copy, dependsOn: assemble) {
|
||||
rename "-${java.util.regex.Pattern.quote(version)}", ''
|
||||
into distLibDir
|
||||
afterEvaluate {
|
||||
project.artifacts {
|
||||
distJar file: file("$distLibDir${File.separator}${archivesBaseName}.jar"), builtBy: "dist"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext.configurePublishing = { Project project ->
|
||||
project.configure(project) {
|
||||
apply plugin: 'maven'
|
||||
@@ -221,6 +211,6 @@ allprojects { project ->
|
||||
}
|
||||
|
||||
dependencies.ext.kotlinStdlib = { suffix ->
|
||||
DependenciesKt.kotlinStdlib(project, suffix)
|
||||
DependenciesKt.kotlinStdlib(project, suffix, null)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,8 @@ description = 'Kotlin Test Annotations Common'
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
|
||||
dependencies {
|
||||
compile kotlinStdlib("common")
|
||||
testCompile project(":kotlin-test:kotlin-test-common")
|
||||
|
||||
@@ -3,10 +3,8 @@ description = 'Kotlin Test Common'
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
|
||||
dependencies {
|
||||
compile kotlinStdlib("common")
|
||||
testCompile project(":kotlin-test:kotlin-test-annotations-common")
|
||||
|
||||
@@ -68,11 +68,3 @@ artifacts {
|
||||
if (project.findProperty("kotlin.stdlib.js.ir.publish")?.toBoolean() == true) {
|
||||
configurePublishing(project)
|
||||
}
|
||||
|
||||
if (project.findProperty("kotlin.stdlib.js.ir.dist")?.toBoolean() == true) {
|
||||
configureDist(project)
|
||||
|
||||
dist {
|
||||
from(jar, sourcesJar)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,13 @@ description = 'Kotlin Test for JS'
|
||||
|
||||
apply plugin: 'kotlin-platform-js'
|
||||
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
configurations {
|
||||
sources
|
||||
distJs
|
||||
}
|
||||
|
||||
dependencies {
|
||||
expectedBy project(':kotlin-test:kotlin-test-common')
|
||||
expectedBy project(':kotlin-test:kotlin-test-annotations-common')
|
||||
@@ -44,17 +48,10 @@ task sourcesJar(type: Jar, dependsOn: classes) {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
distJs(file(compileKotlin2Js.kotlinOptions.outputFile)) {
|
||||
builtBy(compileKotlin2Js)
|
||||
}
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
task distJs(type: Copy) {
|
||||
dependsOn(compileKotlin2Js)
|
||||
from(compileKotlin2Js.kotlinOptions.outputFile)
|
||||
into "$distDir/js"
|
||||
}
|
||||
|
||||
dist {
|
||||
dependsOn distJs
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin-platform-jvm'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
pill {
|
||||
@@ -24,14 +23,11 @@ jar {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", project.name]
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ description = 'Kotlin Test JUnit 5'
|
||||
apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
ext.javaHome = JDK_18
|
||||
ext.jvmTarget = "1.8"
|
||||
@@ -24,14 +23,11 @@ jar {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
||||
kotlinOptions.jdkHome = JDK_18
|
||||
kotlinOptions.jvmTarget = 1.8
|
||||
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin-platform-jvm'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
pill {
|
||||
@@ -47,15 +46,12 @@ task modularJar(type: Jar) {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-Xnormalize-constructor-calls=enable",
|
||||
"-Xuse-experimental=kotlin.contracts.ExperimentalContracts",
|
||||
|
||||
@@ -3,32 +3,26 @@ description = 'Kotlin Test TestNG'
|
||||
apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
ext.javaHome = JDK_17
|
||||
|
||||
|
||||
dependencies {
|
||||
expectedBy project(':kotlin-test:kotlin-test-annotations-common')
|
||||
compile project(':kotlin-test:kotlin-test-jvm')
|
||||
compile('org.testng:testng:6.13.1')
|
||||
}
|
||||
|
||||
|
||||
jar {
|
||||
manifestAttributes(manifest, project, 'Test')
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", project.name]
|
||||
}
|
||||
|
||||
@@ -222,7 +222,3 @@ artifacts {
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist(fromTask = result) {
|
||||
from(sourcesJar)
|
||||
}
|
||||
|
||||
@@ -23,5 +23,3 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
@@ -22,5 +22,3 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
@@ -3,7 +3,6 @@ description = 'Kotlin Common Standard Library'
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
def commonSrcDir = "../src"
|
||||
@@ -109,15 +108,4 @@ artifacts {
|
||||
|
||||
javadocJar()
|
||||
|
||||
// TODO: call the "dist" task instead, once we need to publish kotlin-stdlib-common.jar with the compiler distribution
|
||||
task distCommon(type: Copy) {
|
||||
from(jar)
|
||||
from(sourcesJar)
|
||||
into "$distDir/common"
|
||||
rename "-${java.util.regex.Pattern.quote(version)}", ''
|
||||
}
|
||||
|
||||
dist.dependsOn distCommon
|
||||
|
||||
|
||||
classes.setDependsOn(classes.dependsOn.findAll { it != "compileJava" })
|
||||
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
ext.javaHome = JDK_17
|
||||
|
||||
@@ -67,16 +66,13 @@ task modularJar(type: Jar) {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
||||
kotlinOptions.jdkHome = JDK_17
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
ext.javaHome = JDK_18
|
||||
ext.jvmTarget = "1.8"
|
||||
@@ -61,15 +60,13 @@ task modularJar(type: Jar) {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
||||
kotlinOptions.jdkHome = JDK_18
|
||||
kotlinOptions.jvmTarget = 1.8
|
||||
|
||||
@@ -161,13 +161,6 @@ if (project.findProperty("kotlin.stdlib.js.ir.publish")?.toBoolean() == true) {
|
||||
configurePublishing(project)
|
||||
}
|
||||
|
||||
if (project.findProperty("kotlin.stdlib.js.ir.dist")?.toBoolean() == true) {
|
||||
configureDist(project)
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
}
|
||||
|
||||
node {
|
||||
download = true
|
||||
version = '8.9.4' // The default 6.9.1 has buggy hyperbolic functions implementation
|
||||
|
||||
@@ -7,9 +7,14 @@ description = 'Kotlin Standard Library for JS'
|
||||
apply plugin: 'kotlin-platform-js'
|
||||
apply plugin: 'idea'
|
||||
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
configurations {
|
||||
sources
|
||||
commonSources
|
||||
distSources
|
||||
distJs
|
||||
}
|
||||
|
||||
def builtinsSrcDir = "${buildDir}/builtin-sources"
|
||||
def builtinsSrcDir2 = "${buildDir}/builtin-sources-for-builtins"
|
||||
@@ -77,9 +82,6 @@ sourceSets {
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
commonSources
|
||||
}
|
||||
dependencies {
|
||||
expectedBy project(":kotlin-stdlib-common")
|
||||
commonSources project(path: ":kotlin-stdlib-common", configuration: "sources")
|
||||
@@ -331,9 +333,8 @@ task sourcesJar(type: Jar, dependsOn: compileJs) {
|
||||
|
||||
task distSourcesJar(type: Jar) {
|
||||
dependsOn(sourcesJar, configurations.commonSources)
|
||||
baseName = 'dist-kotlin-stdlib-js'
|
||||
version = null
|
||||
classifier = 'sources'
|
||||
destinationDirectory = file("$buildDir/lib/dist")
|
||||
archiveClassifier = 'sources'
|
||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
||||
from zipTree(sourcesJar.outputs.files.singleFile)
|
||||
|
||||
@@ -354,23 +355,16 @@ artifacts {
|
||||
runtime mergedJar
|
||||
archives mergedJar
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
distSources distSourcesJar
|
||||
|
||||
compileJs.outputs.files.forEach { artifact ->
|
||||
distJs(artifact) { builtBy(compileJs) }
|
||||
}
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
task distJs(type: Copy) {
|
||||
from(compileJs)
|
||||
into "$distDir/js"
|
||||
}
|
||||
|
||||
dist {
|
||||
dependsOn distJs
|
||||
[mergedJar, distSourcesJar].forEach {
|
||||
rename("dist-", "")
|
||||
from(it)
|
||||
}
|
||||
}
|
||||
|
||||
node {
|
||||
download = true
|
||||
version = '8.9.4' // The default 6.9.1 has buggy hyperbolic functions implementation
|
||||
|
||||
@@ -12,6 +12,11 @@ javaHome = rootProject.extra["JDK_16"] as String
|
||||
|
||||
val builtins by configurations.creating
|
||||
|
||||
val runtime by configurations
|
||||
val runtimeJar by configurations.creating {
|
||||
runtime.extendsFrom(this)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly(project(":kotlin-stdlib"))
|
||||
builtins(project(":core:builtins"))
|
||||
@@ -61,14 +66,11 @@ tasks.withType<KotlinCompile> {
|
||||
}
|
||||
|
||||
val jar = runtimeJar {
|
||||
archiveFileName.set("kotlin-stdlib-minimal-for-test.jar")
|
||||
dependsOn(builtins)
|
||||
from(provider { zipTree(builtins.singleFile) }) { include("kotlin/**") }
|
||||
}
|
||||
|
||||
val distDir: String by rootProject.extra
|
||||
|
||||
dist(targetName = "kotlin-stdlib-minimal-for-test.jar", targetDir = File(distDir), fromTask = jar)
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("internal") {
|
||||
|
||||
@@ -6,9 +6,12 @@ apply plugin: 'pill-configurable'
|
||||
archivesBaseName = 'kotlin-stdlib'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
configurations {
|
||||
distSources
|
||||
}
|
||||
|
||||
pill {
|
||||
importAsLibrary = true
|
||||
}
|
||||
@@ -105,10 +108,10 @@ sourcesJar {
|
||||
|
||||
task distSourcesJar(type: Jar) {
|
||||
dependsOn(sourcesJar, configurations.commonSources)
|
||||
baseName = 'dist-kotlin-stdlib'
|
||||
version = null
|
||||
destinationDirectory = file("$buildDir/lib/dist")
|
||||
classifier = 'sources'
|
||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
||||
|
||||
from zipTree(sourcesJar.outputs.files.singleFile)
|
||||
|
||||
from(zipTree(configurations.commonSources.singleFile)) {
|
||||
@@ -118,12 +121,6 @@ task distSourcesJar(type: Jar) {
|
||||
}
|
||||
}
|
||||
|
||||
task distMavenSources(type: Copy) {
|
||||
from(sourcesJar)
|
||||
into "$distDir/maven"
|
||||
rename "-${java.util.regex.Pattern.quote(version)}", ''
|
||||
}
|
||||
|
||||
task modularJar(type: Jar) {
|
||||
dependsOn(jar)
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
@@ -138,25 +135,13 @@ task modularJar(type: Jar) {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
distSources distSourcesJar
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
dependsOn distMavenSources
|
||||
|
||||
[jar, distSourcesJar].forEach {
|
||||
from(it) {
|
||||
rename('dist-', '')
|
||||
}
|
||||
}
|
||||
|
||||
from (configurations.compile) {
|
||||
include 'annotations*.jar'
|
||||
}
|
||||
}
|
||||
|
||||
task dexMethodCount(type: DexMethodCount) {
|
||||
from jar
|
||||
ownPackages = ['kotlin']
|
||||
|
||||
@@ -37,5 +37,3 @@ publish()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
runtimeJar()
|
||||
dist()
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
pill {
|
||||
@@ -25,14 +24,11 @@ dependencies {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
||||
kotlinOptions.jdkHome = JDK_16
|
||||
kotlinOptions.jvmTarget = 1.6
|
||||
|
||||
@@ -17,18 +17,12 @@ val jarBaseName = property("archivesBaseName") as String
|
||||
|
||||
val proguardLibraryJars by configurations.creating
|
||||
|
||||
val default by configurations
|
||||
val runtimeJar by configurations.creating
|
||||
|
||||
default.apply {
|
||||
extendsFrom(runtimeJar)
|
||||
}
|
||||
|
||||
val projectsDependencies = listOf(
|
||||
":kotlin-scripting-common",
|
||||
":kotlin-scripting-jvm",
|
||||
":kotlin-script-util",
|
||||
":kotlin-script-runtime")
|
||||
":kotlin-script-runtime"
|
||||
)
|
||||
|
||||
dependencies {
|
||||
projectsDependencies.forEach {
|
||||
@@ -95,17 +89,18 @@ val proguard by task<ProGuardTask> {
|
||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraryJars)
|
||||
}
|
||||
|
||||
val pack = if (shrink) proguard else packJar
|
||||
|
||||
runtimeJarArtifactBy(pack, pack.outputs.files.singleFile) {
|
||||
name = jarBaseName
|
||||
classifier = ""
|
||||
val resultJar = tasks.register<Jar>("resultJar") {
|
||||
val pack = if (shrink) proguard else packJar
|
||||
dependsOn(pack)
|
||||
setupPublicJar(jarBaseName)
|
||||
from {
|
||||
zipTree(pack.outputs.files.singleFile)
|
||||
}
|
||||
}
|
||||
|
||||
dist(
|
||||
targetName = "$name.jar",
|
||||
fromTask = pack
|
||||
)
|
||||
addArtifact("runtime", resultJar)
|
||||
addArtifact("archives", resultJar)
|
||||
|
||||
sourcesJar()
|
||||
|
||||
javadocJar()
|
||||
|
||||
@@ -60,8 +60,7 @@ tasks {
|
||||
}
|
||||
"test" {
|
||||
// These dependencies are needed because ForTestCompileRuntime loads jars from dist
|
||||
dependsOn(":kotlin-reflect:dist")
|
||||
dependsOn(":kotlin-script-runtime:dist")
|
||||
dependsOn(":dist")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,5 +16,3 @@ sourceSets {
|
||||
"main" { projectDefault() }
|
||||
"test" {}
|
||||
}
|
||||
|
||||
dist()
|
||||
|
||||
@@ -4,7 +4,6 @@ apply plugin: 'kotlin'
|
||||
apply plugin: 'pill-configurable'
|
||||
|
||||
configureJvm6Project(project)
|
||||
configureDist(project)
|
||||
configurePublishing(project)
|
||||
|
||||
pill {
|
||||
@@ -33,15 +32,12 @@ jar {
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
sources sourcesJar
|
||||
mainJar jar
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
dist {
|
||||
from (jar, sourcesJar)
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = [
|
||||
"-Xallow-kotlin-package",
|
||||
@@ -49,5 +45,3 @@ compileKotlin {
|
||||
"-module-name", project.name
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -30,11 +30,9 @@ sourceSets {
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
val jar = runtimeJar {}
|
||||
runtimeJar()
|
||||
|
||||
testsJar {}
|
||||
|
||||
dist(targetName = the<BasePluginConvention>().archivesBaseName.removePrefix("kotlin-") + ".jar")
|
||||
testsJar()
|
||||
|
||||
projectTest(parallel = true) {
|
||||
workingDir = rootDir
|
||||
|
||||
@@ -47,8 +47,6 @@ sourceSets {
|
||||
|
||||
runtimeJar()
|
||||
|
||||
dist()
|
||||
|
||||
testsJar()
|
||||
|
||||
projectTest {
|
||||
|
||||
@@ -75,7 +75,7 @@ sourceSets {
|
||||
testsJar {}
|
||||
|
||||
projectTest(parallel = true) {
|
||||
dependsOn(":kotlin-android-extensions-runtime:dist")
|
||||
dependsOn(":dist")
|
||||
workingDir = rootDir
|
||||
useAndroidSdk()
|
||||
useAndroidJar()
|
||||
|
||||
@@ -22,5 +22,3 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist(targetName = "android-extensions-runtime.jar")
|
||||
|
||||
@@ -35,5 +35,3 @@ projectTest {
|
||||
}
|
||||
|
||||
runtimeJar()
|
||||
|
||||
dist()
|
||||
@@ -39,6 +39,5 @@ publish()
|
||||
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
dist()
|
||||
|
||||
testsJar()
|
||||
@@ -18,9 +18,7 @@ sourceSets {
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
testsJar {}
|
||||
|
||||
dist()
|
||||
testsJar()
|
||||
|
||||
projectTest {
|
||||
workingDir = rootDir
|
||||
|
||||
@@ -60,5 +60,3 @@ runtimeJar()
|
||||
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
@@ -21,5 +21,3 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist(targetName = "kotlin-annotation-processing-runtime.jar")
|
||||
|
||||
@@ -36,9 +36,7 @@ sourceSets {
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
testsJar {}
|
||||
|
||||
dist(targetName = the<BasePluginConvention>().archivesBaseName + ".jar")
|
||||
testsJar()
|
||||
|
||||
projectTest(parallel = true) {
|
||||
workingDir = rootDir
|
||||
|
||||
@@ -34,8 +34,6 @@ runtimeJar()
|
||||
|
||||
testsJar()
|
||||
|
||||
dist(targetName = the<BasePluginConvention>().archivesBaseName.removePrefix("kotlin-") + ".jar")
|
||||
|
||||
projectTest(parallel = true) {
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
@@ -34,13 +34,9 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
testsJar {}
|
||||
|
||||
dist {
|
||||
rename("kotlin-", "")
|
||||
}
|
||||
testsJar()
|
||||
|
||||
projectTest(parallel = true) {
|
||||
dependsOn(":kotlin-stdlib:jvm-minimal-for-test:dist")
|
||||
dependsOn(":dist")
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
@@ -50,8 +50,6 @@ runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
projectTest {
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
@@ -47,12 +47,10 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
||||
|
||||
publish()
|
||||
|
||||
val jar = runtimeJar {}
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
projectTest {
|
||||
workingDir = rootDir
|
||||
}
|
||||
|
||||
@@ -47,5 +47,3 @@ publish()
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
dist()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@file:Suppress("HasPlatformType")
|
||||
|
||||
import java.io.File
|
||||
|
||||
val buildVersionFilePath = "${rootProject.extra["distDir"]}/build.txt"
|
||||
|
||||
val buildVersionFilePath = "$buildDir/build.txt"
|
||||
val buildVersion by configurations.creating
|
||||
val buildNumber: String by rootProject.extra
|
||||
val kotlinVersion: String by rootProject.extra
|
||||
@@ -17,6 +17,10 @@ val writeBuildNumber by tasks.creating {
|
||||
}
|
||||
}
|
||||
|
||||
artifacts.add(buildVersion.name, file(buildVersionFilePath)) {
|
||||
builtBy(writeBuildNumber)
|
||||
}
|
||||
|
||||
fun replaceVersion(versionFile: File, versionPattern: String, replacement: (MatchResult) -> String) {
|
||||
check(versionFile.isFile) { "Version file $versionFile is not found" }
|
||||
val text = versionFile.readText()
|
||||
@@ -69,15 +73,3 @@ val writePluginVersion by tasks.creating {
|
||||
val writeVersions by tasks.creating {
|
||||
dependsOn(writeBuildNumber, writeStdlibVersion, writeCompilerVersion)
|
||||
}
|
||||
|
||||
|
||||
artifacts.add(buildVersion.name, file(buildVersionFilePath)) {
|
||||
builtBy(writeBuildNumber)
|
||||
}
|
||||
|
||||
val distKotlinHomeDir: String by rootProject.extra
|
||||
|
||||
val dist by task<Copy> {
|
||||
from(writeBuildNumber)
|
||||
into(File(distKotlinHomeDir))
|
||||
}
|
||||
|
||||
@@ -36,9 +36,7 @@ sourceSets {
|
||||
}
|
||||
|
||||
projectTest {
|
||||
dependsOn(":kotlin-compiler:dist",
|
||||
":kotlin-stdlib:dist",
|
||||
":kotlin-script-runtime:dist")
|
||||
dependsOn(":dist")
|
||||
workingDir = File(rootDir, "libraries/tools/kotlin-compiler-client-embeddable-test/src")
|
||||
doFirst {
|
||||
systemProperty("kotlin.test.script.classpath", testSourceSet.output.classesDirs.joinToString(File.pathSeparator))
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
@file:Suppress("HasPlatformType")
|
||||
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import proguard.gradle.ProGuardTask
|
||||
import java.util.regex.Pattern.quote
|
||||
|
||||
description = "Kotlin Compiler"
|
||||
|
||||
@@ -12,21 +15,30 @@ plugins {
|
||||
// You can run Gradle with "-Pkotlin.build.proguard=true" to enable ProGuard run on kotlin-compiler.jar (on TeamCity, ProGuard always runs)
|
||||
val shrink = findProperty("kotlin.build.proguard")?.toString()?.toBoolean() ?: hasProperty("teamcity")
|
||||
|
||||
val jsIrDist = findProperty("kotlin.stdlib.js.ir.dist")?.toString()?.toBoolean() == true
|
||||
|
||||
val fatJarContents by configurations.creating
|
||||
val fatJarContentsStripMetadata by configurations.creating
|
||||
val fatJarContentsStripServices by configurations.creating
|
||||
|
||||
val runtimeJar by configurations.creating
|
||||
val compile by configurations // maven plugin writes pom compile scope from compile configuration by default
|
||||
val libraries by configurations.creating {
|
||||
val proguardLibraries by configurations.creating {
|
||||
extendsFrom(compile)
|
||||
}
|
||||
|
||||
val trove4jJar by configurations.creating
|
||||
val ktorNetworkJar by configurations.creating
|
||||
|
||||
val default by configurations
|
||||
default.extendsFrom(runtimeJar)
|
||||
// Libraries to copy to the lib directory
|
||||
val libraries by configurations.creating
|
||||
// Compiler plugins should be copied without `kotlin-` prefix
|
||||
val compilerPlugins by configurations.creating
|
||||
val sources by configurations.creating
|
||||
// contents of dist/maven directory
|
||||
val distMavenContents by configurations.creating
|
||||
// contents of dist/common directory
|
||||
val distCommonContents by configurations.creating
|
||||
val distStdlibMinimalForTests by configurations.creating
|
||||
val buildNumber by configurations.creating
|
||||
val distJSContents by configurations.creating
|
||||
|
||||
val compilerBaseName = name
|
||||
|
||||
@@ -34,14 +46,78 @@ val outputJar = fileFrom(buildDir, "libs", "$compilerBaseName.jar")
|
||||
|
||||
val compilerModules: Array<String> by rootProject.extra
|
||||
|
||||
val distLibraryProjects = listOfNotNull(
|
||||
":kotlin-annotation-processing",
|
||||
":kotlin-annotation-processing-cli",
|
||||
":kotlin-annotation-processing-runtime",
|
||||
":kotlin-annotations-android",
|
||||
":kotlin-annotations-jvm",
|
||||
":kotlin-ant",
|
||||
":kotlin-daemon",
|
||||
":kotlin-daemon-client",
|
||||
":kotlin-daemon-client-new",
|
||||
":kotlin-imports-dumper-compiler-plugin",
|
||||
":kotlin-main-kts",
|
||||
":kotlin-preloader",
|
||||
":kotlin-reflect",
|
||||
":kotlin-runner",
|
||||
":kotlin-script-runtime",
|
||||
":kotlin-scripting-common",
|
||||
":kotlin-scripting-compiler",
|
||||
":kotlin-scripting-compiler-impl",
|
||||
":kotlin-scripting-jvm",
|
||||
":kotlin-stdlib-js-ir".takeIf { jsIrDist },
|
||||
":kotlin-source-sections-compiler-plugin",
|
||||
":kotlin-test:kotlin-test-js",
|
||||
":kotlin-test:kotlin-test-js-ir".takeIf { jsIrDist },
|
||||
":kotlin-test:kotlin-test-junit",
|
||||
":kotlin-test:kotlin-test-junit5",
|
||||
":kotlin-test:kotlin-test-jvm",
|
||||
":kotlin-test:kotlin-test-testng",
|
||||
":libraries:tools:mutability-annotations-compat",
|
||||
":plugins:android-extensions-compiler",
|
||||
":plugins:jvm-abi-gen"
|
||||
)
|
||||
|
||||
val distCompilerPluginProjects = listOf(
|
||||
":kotlin-allopen-compiler-plugin",
|
||||
":kotlin-android-extensions-runtime",
|
||||
":kotlin-noarg-compiler-plugin",
|
||||
":kotlin-sam-with-receiver-compiler-plugin",
|
||||
":kotlinx-serialization-compiler-plugin"
|
||||
)
|
||||
|
||||
val distSourcesProjects = listOfNotNull(
|
||||
":kotlin-annotations-jvm",
|
||||
":kotlin-reflect",
|
||||
":kotlin-script-runtime",
|
||||
":kotlin-stdlib-jdk7".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
|
||||
":kotlin-stdlib-jdk8".takeIf { !kotlinBuildProperties.isInJpsBuildIdeaSync },
|
||||
":kotlin-stdlib-js-ir".takeIf { jsIrDist },
|
||||
":kotlin-test:kotlin-test-js",
|
||||
":kotlin-test:kotlin-test-js-ir".takeIf { jsIrDist },
|
||||
":kotlin-test:kotlin-test-junit",
|
||||
":kotlin-test:kotlin-test-junit5",
|
||||
":kotlin-test:kotlin-test-jvm",
|
||||
":kotlin-test:kotlin-test-testng"
|
||||
)
|
||||
|
||||
libraries.apply {
|
||||
resolutionStrategy {
|
||||
preferProjectModules()
|
||||
}
|
||||
|
||||
exclude("org.jetbrains.kotlin", "kotlin-stdlib-common")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile(kotlinStdlib())
|
||||
compile(project(":kotlin-script-runtime"))
|
||||
compile(project(":kotlin-reflect"))
|
||||
compile(commonDep("org.jetbrains.intellij.deps", "trove4j"))
|
||||
|
||||
libraries(project(":kotlin-annotations-jvm"))
|
||||
libraries(
|
||||
proguardLibraries(project(":kotlin-annotations-jvm"))
|
||||
proguardLibraries(
|
||||
files(
|
||||
firstFromJavaHomeThatExists("jre/lib/rt.jar", "../Classes/classes.jar"),
|
||||
firstFromJavaHomeThatExists("jre/lib/jsse.jar", "../Classes/jsse.jar"),
|
||||
@@ -53,8 +129,39 @@ dependencies {
|
||||
fatJarContents(project(it)) { isTransitive = false }
|
||||
}
|
||||
|
||||
trove4jJar(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } }
|
||||
ktorNetworkJar(commonDep("io.ktor", "ktor-network"))
|
||||
libraries(intellijDep()) { includeIntellijCoreJarDependencies(project) { it.startsWith("trove4j") } }
|
||||
libraries(commonDep("io.ktor", "ktor-network"))
|
||||
libraries(kotlinStdlib("jdk8"))
|
||||
libraries(kotlinStdlib("js"))
|
||||
|
||||
distLibraryProjects.forEach {
|
||||
libraries(project(it)) { isTransitive = false }
|
||||
}
|
||||
|
||||
distCompilerPluginProjects.forEach {
|
||||
compilerPlugins(project(it)) { isTransitive = false }
|
||||
}
|
||||
|
||||
distSourcesProjects.forEach {
|
||||
sources(project(it, configuration = "sources"))
|
||||
}
|
||||
|
||||
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||
sources(project(":kotlin-stdlib", configuration = "distSources"))
|
||||
sources(project(":kotlin-stdlib-js", configuration = "distSources"))
|
||||
|
||||
distStdlibMinimalForTests(project(":kotlin-stdlib:jvm-minimal-for-test"))
|
||||
|
||||
distJSContents(project(":kotlin-stdlib-js", configuration = "distJs"))
|
||||
distJSContents(project(":kotlin-test:kotlin-test-js", configuration = "distJs"))
|
||||
}
|
||||
|
||||
distCommonContents(kotlinStdlib(suffix = "common"))
|
||||
distCommonContents(kotlinStdlib(suffix = "common", classifier = "sources"))
|
||||
|
||||
distMavenContents(kotlinStdlib(classifier = "sources"))
|
||||
|
||||
buildNumber(project(":prepare:build.version", configuration = "buildVersion"))
|
||||
|
||||
fatJarContents(kotlinBuiltins())
|
||||
fatJarContents(commonDep("javax.inject"))
|
||||
@@ -96,7 +203,7 @@ noDefaultJar()
|
||||
val packCompiler by task<ShadowJar> {
|
||||
configurations = emptyList()
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
destinationDir = File(buildDir, "libs")
|
||||
destinationDirectory.set(File(buildDir, "libs"))
|
||||
|
||||
setupPublicJar(compilerBaseName, "before-proguard")
|
||||
|
||||
@@ -129,7 +236,7 @@ val proguard by task<ProGuardTask> {
|
||||
inputs.files(packCompiler.outputs.files.singleFile)
|
||||
outputs.file(outputJar)
|
||||
|
||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), libraries)
|
||||
libraryjars(mapOf("filter" to "!META-INF/versions/**"), proguardLibraries)
|
||||
|
||||
printconfiguration("$buildDir/compiler.pro.dump")
|
||||
|
||||
@@ -142,9 +249,56 @@ val proguard by task<ProGuardTask> {
|
||||
|
||||
val pack = if (shrink) proguard else packCompiler
|
||||
|
||||
dist(targetName = "$compilerBaseName.jar", fromTask = pack) {
|
||||
from(trove4jJar)
|
||||
from(ktorNetworkJar)
|
||||
val distDir: String by rootProject.extra
|
||||
|
||||
val distKotlinc = distTask<Sync>("distKotlinc") {
|
||||
destinationDir = File("$distDir/kotlinc")
|
||||
|
||||
from(buildNumber)
|
||||
|
||||
into("bin") {
|
||||
from(files("$rootDir/compiler/cli/bin"))
|
||||
}
|
||||
|
||||
into("license") {
|
||||
from(files("$rootDir/license"))
|
||||
}
|
||||
|
||||
into("lib") {
|
||||
from(pack) { rename { "$compilerBaseName.jar" } }
|
||||
from(libraries)
|
||||
from(sources)
|
||||
from(compilerPlugins) {
|
||||
rename { it.removePrefix("kotlin-") }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val distCommon = distTask<Sync>("distCommon") {
|
||||
destinationDir = File("$distDir/common")
|
||||
from(distCommonContents)
|
||||
}
|
||||
|
||||
val distMaven = distTask<Sync>("distMaven") {
|
||||
destinationDir = File("$distDir/maven")
|
||||
from(distMavenContents)
|
||||
}
|
||||
|
||||
val distJs = distTask<Sync>("distJs") {
|
||||
destinationDir = File("$distDir/js")
|
||||
from(distJSContents)
|
||||
}
|
||||
|
||||
distTask<Copy>("dist") {
|
||||
destinationDir = File(distDir)
|
||||
|
||||
dependsOn(distKotlinc)
|
||||
dependsOn(distCommon)
|
||||
dependsOn(distMaven)
|
||||
dependsOn(distJs)
|
||||
|
||||
from(buildNumber)
|
||||
from(distStdlibMinimalForTests)
|
||||
}
|
||||
|
||||
runtimeJarArtifactBy(pack, pack.outputs.files.singleFile) {
|
||||
@@ -161,3 +315,12 @@ sourcesJar {
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
inline fun <reified T : AbstractCopyTask> Project.distTask(
|
||||
name: String,
|
||||
crossinline block: T.() -> Unit
|
||||
) = tasks.register<T>(name) {
|
||||
duplicatesStrategy = DuplicatesStrategy.FAIL
|
||||
rename(quote("-$version"), "")
|
||||
block()
|
||||
}
|
||||
Reference in New Issue
Block a user