Refactor build to make manifest specification less error-prone.

Use legacy implementation title in manifest of JS stdlib for now.

Change the way common jvm project configurations is applied.
Add missing artifacts to common libraries.
This commit is contained in:
Ilya Gorbunov
2017-03-28 23:43:56 +03:00
parent 325ebfbd5f
commit 92ef26606b
13 changed files with 81 additions and 87 deletions
+12 -30
View File
@@ -68,34 +68,9 @@ subprojects {
}
}
// plain kotlin jvm projects
configure(subprojects.findAll {it.name in [
'kotlin-runtime', 'kotlin-script-runtime',
'kotlin-stdlib', 'kotlin-stdlib-jre7', 'kotlin-stdlib-jre8',
'kotlin-test-junit',
'kotlin-reflect']}) {
apply plugin: 'kotlin'
commonJvmProjectConfiguration(project)
}
static def commonJvmProjectConfiguration(Project project) {
static def configureJvmProject(Project project) {
project.configure(project) {
jar {
manifest {
attributes 'Implementation-Vendor': 'JetBrains',
'Implementation-Title': "${project.description ?: project.name}", // TODO: project.description is resolved after evaluating this, therefore this attribute is repeated in the projects; seek for a solution
'Implementation-Version': version,
'Build-Jdk': System.getProperty('java.version'),
'Built-By': 'JetBrains'
}
from("${rootDir}/../dist/kotlinc/build.txt") { into("META-INF/") }
}
task sourcesJar(type: Jar, dependsOn:classes) {
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.kotlin
}
@@ -117,12 +92,19 @@ static def commonJvmProjectConfiguration(Project project) {
}
}
static def manifestAttributes(Manifest manifest, Project project, String component) {
static def manifestAttributes(Manifest manifest, Project project, String component = null) {
project.configure(manifest) {
attributes \
'Implementation-Vendor': 'JetBrains',
'Implementation-Title': project.archivesBaseName,
'Implementation-Version': project.version,
'Build-Jdk': System.getProperty('java.version')
if (component != null) {
attributes \
'Kotlin-Runtime-Component': component,
'Kotlin-Version': "${project.kotlin_language_version}",
'Implementation-Title': "${project.description ?: project.name}"
'Kotlin-Version': project.kotlin_language_version
}
}
}
+7 -16
View File
@@ -6,25 +6,16 @@ dependencies {
compile project(':kotlin-stdlib-common')
}
// common block
jar {
baseName = project.name
manifest {
attributes 'Implementation-Vendor': 'JetBrains',
'Implementation-Title': "${project.description ?: project.name}", // TODO: project.description is resolved after evaluating this, therefore this attribute is repeated in the projects; seek for a solution
'Implementation-Version': version,
'Build-Jdk': System.getProperty('java.version'),
'Built-By': 'JetBrains'
}
from("${rootDir}/../dist/kotlinc/build.txt") { into("META-INF/") }
manifestAttributes(manifest, project, 'Test')
}
task sourcesJar(type: Jar, dependsOn:classes) {
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.kotlin
}
artifacts {
archives sourcesJar
archives javadocJar
}
+1 -6
View File
@@ -27,12 +27,7 @@ compileTestKotlin2Js {
archivesBaseName = 'kotlin-test-js'
jar {
manifest {
attributes 'addDefaultImplementationEntries': true,
'Implementation-Title': "${project.description ?: project.name}"
}
dependsOn classes
from sourceSets.main.output
manifestAttributes(manifest, project, 'Test')
}
task sourcesJar(type: Jar, dependsOn: classes) {
+11 -10
View File
@@ -1,27 +1,28 @@
description = 'Kotlin Test JUnit'
apply plugin: 'kotlin'
configureJvmProject(project)
dependencies {
compile project(':kotlin-test:kotlin-test-jvm')
compile('junit:junit:4.12')
compile project(':kotlin-test:kotlin-test-jvm')
compile('junit:junit:4.12')
}
jar {
manifest {
attributes 'Implementation-Title': "${project.description ?: project.name}"
}
manifestAttributes(manifest, project, 'Test')
}
artifacts {
archives sourcesJar
archives javadocJar
archives sourcesJar
archives javadocJar
}
compileKotlin {
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", project.name]
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", project.name]
}
compileTestKotlin {
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"]
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"]
}
+3 -7
View File
@@ -3,23 +3,19 @@ description = 'Kotlin Test'
apply plugin: 'kotlin-platform-jvm'
configureJvmProject(project)
dependencies {
implement project(':kotlin-test:kotlin-test-common')
compile project(':kotlin-stdlib')
testCompile('junit:junit:4.12')
}
commonJvmProjectConfiguration(project)
archivesBaseName = 'kotlin-test'
jar {
manifest {
attributes 'addDefaultImplementationEntries': true,
'Implementation-Title': "${project.description ?: project.name}"
}
dependsOn classes
from sourceSets.main.output
manifestAttributes(manifest, project, 'Test')
}
artifacts {
+5 -1
View File
@@ -1,5 +1,9 @@
description = 'Kotlin Standard Library'
apply plugin: 'kotlin'
configureJvmProject(project)
sourceSets {
builtins {
java {
@@ -39,7 +43,7 @@ task originalStdlibJar(type: Jar) {
}
jar {
manifestAttributes(manifest, project, 'Core')
manifestAttributes(manifest, project, 'Main')
from("${rootDir}/../dist/builtins")
from sourceSets.builtins.output
}
+7 -11
View File
@@ -29,20 +29,16 @@ compileKotlinCommon {
*/
jar {
baseName = project.name
manifest {
attributes 'Implementation-Vendor': 'JetBrains',
'Implementation-Title': "${project.description ?: project.name}", // TODO: project.description is resolved after evaluating this, therefore this attribute is repeated in the projects; seek for a solution
'Implementation-Version': version,
'Build-Jdk': System.getProperty('java.version'),
'Built-By': 'JetBrains'
}
from("${rootDir}/../dist/kotlinc/build.txt") { into("META-INF/") }
manifestAttributes(manifest, project, 'Main')
}
task sourcesJar(type: Jar, dependsOn:classes) {
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.kotlin
}
artifacts {
archives sourcesJar
archives javadocJar
}
+4 -1
View File
@@ -1,5 +1,8 @@
description = 'Kotlin Standard Library JRE 7 extension'
apply plugin: 'kotlin'
configureJvmProject(project)
dependencies {
compile project(':kotlin-stdlib')
@@ -23,7 +26,7 @@ sourceSets {
}
jar {
manifestAttributes(manifest, project, 'Core')
manifestAttributes(manifest, project, 'Main')
}
artifacts {
+5 -1
View File
@@ -1,5 +1,9 @@
description = 'Kotlin Standard Library JRE 8 extension'
apply plugin: 'kotlin'
configureJvmProject(project)
dependencies {
compile project(':kotlin-stdlib')
compile project(':kotlin-stdlib-jre7')
@@ -24,7 +28,7 @@ sourceSets {
}
jar {
manifestAttributes(manifest, project, 'Core')
manifestAttributes(manifest, project, 'Main')
}
artifacts {
+9
View File
@@ -188,6 +188,15 @@ jar {
task mergedJar(type: Jar, dependsOn: classes) {
classifier = null
manifestAttributes(manifest, project, 'Main')
// TODO: Use standard implementation title after js stdlib detector becomes more flexible
Properties properties = new Properties()
new File("${rootDir}/../resources/kotlinManifest.properties").withInputStream {
properties.load(it)
}
manifest.attributes 'Implementation-Title' : properties."manifest.impl.title.kotlin.javascript.stdlib"
includeEmptyDirs false
duplicatesStrategy DuplicatesStrategy.EXCLUDE
from jsOutputFile
@@ -13,6 +13,10 @@ buildscript {
}
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'kotlin'
configureJvmProject(project)
def core = "${rootDir}/../core"
def annotationsSrc = "${buildDir}/annotations"
@@ -79,6 +83,9 @@ kotlin.experimental.coroutines "enable"
task reflectShadowJar(type: ShadowJar) {
classifier = 'shadow'
version = null
manifestAttributes(manifest, project, 'Main')
manifest.attributes 'Class-Path': 'kotlin-runtime.jar' // TODO replace soon with 'kotlin-stdlib.jar'
from (sourceSets.main.output)
from ("${core}/descriptor.loader.java/src") {
include 'META-INF/services/**'
+5 -2
View File
@@ -1,5 +1,8 @@
description 'Kotlin Runtime (deprecated, use koltin-stdlib artifact instead)'
description 'Kotlin Runtime'
apply plugin: 'kotlin'
configureJvmProject(project)
dependencies {
compile group: 'org.jetbrains', name: 'annotations', version:'13.0'
@@ -20,7 +23,7 @@ sourceSets {
}
jar {
manifestAttributes(manifest, project, 'Core')
manifestAttributes(manifest, project, 'Main')
from("${rootDir}/../dist/builtins")
}
+5 -2
View File
@@ -1,6 +1,9 @@
description 'Kotlin Script Runtime'
apply plugin: 'kotlin'
configureJvmProject(project)
dependencies {
compileOnly project(':kotlin-stdlib')
}
@@ -14,7 +17,7 @@ sourceSets {
}
jar {
manifestAttributes(manifest, project, 'Core')
manifestAttributes(manifest, project, 'Main')
}
artifacts {