Build: Centralize compiler dist build logic in :kotlin-compiler project
This commit is contained in:
@@ -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'
|
||||
@@ -219,8 +209,8 @@ allprojects { project ->
|
||||
project.ext.javadocJar = { lambda = {} ->
|
||||
ArtifactsKt.javadocJar(project, lambda)
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user