diff --git a/libraries/build.gradle b/libraries/build.gradle index fc8903b0706..977a775d6fe 100644 --- a/libraries/build.gradle +++ b/libraries/build.gradle @@ -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 + } } } diff --git a/libraries/kotlin.test/common/build.gradle b/libraries/kotlin.test/common/build.gradle index d85ddb5bbc5..a8752466dc8 100644 --- a/libraries/kotlin.test/common/build.gradle +++ b/libraries/kotlin.test/common/build.gradle @@ -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 +} \ No newline at end of file diff --git a/libraries/kotlin.test/js/build.gradle b/libraries/kotlin.test/js/build.gradle index 2aff3d953c6..bcb92790ebb 100644 --- a/libraries/kotlin.test/js/build.gradle +++ b/libraries/kotlin.test/js/build.gradle @@ -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) { diff --git a/libraries/kotlin.test/junit/build.gradle b/libraries/kotlin.test/junit/build.gradle index 367ae54f2e7..a78953a38df 100644 --- a/libraries/kotlin.test/junit/build.gradle +++ b/libraries/kotlin.test/junit/build.gradle @@ -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"] } diff --git a/libraries/kotlin.test/jvm/build.gradle b/libraries/kotlin.test/jvm/build.gradle index b6a3f1c31a8..f431e5447fb 100644 --- a/libraries/kotlin.test/jvm/build.gradle +++ b/libraries/kotlin.test/jvm/build.gradle @@ -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 { diff --git a/libraries/stdlib/build.gradle b/libraries/stdlib/build.gradle index 14d5c3ef6b5..ccab3ea0628 100644 --- a/libraries/stdlib/build.gradle +++ b/libraries/stdlib/build.gradle @@ -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 } diff --git a/libraries/stdlib/common/build.gradle b/libraries/stdlib/common/build.gradle index 03fb664b470..e641ec6c8c5 100644 --- a/libraries/stdlib/common/build.gradle +++ b/libraries/stdlib/common/build.gradle @@ -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 +} \ No newline at end of file diff --git a/libraries/stdlib/jre7/build.gradle b/libraries/stdlib/jre7/build.gradle index 1bfd7e5646f..866a51dd11a 100644 --- a/libraries/stdlib/jre7/build.gradle +++ b/libraries/stdlib/jre7/build.gradle @@ -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 { diff --git a/libraries/stdlib/jre8/build.gradle b/libraries/stdlib/jre8/build.gradle index 5dcc1e034ba..804711b4ced 100644 --- a/libraries/stdlib/jre8/build.gradle +++ b/libraries/stdlib/jre8/build.gradle @@ -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 { diff --git a/libraries/stdlib/js/build.gradle b/libraries/stdlib/js/build.gradle index d3eb84fa18b..bec32856998 100644 --- a/libraries/stdlib/js/build.gradle +++ b/libraries/stdlib/js/build.gradle @@ -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 diff --git a/libraries/tools/kotlin-reflect/build.gradle b/libraries/tools/kotlin-reflect/build.gradle index 89df80fdc2d..2dc0f9a102a 100644 --- a/libraries/tools/kotlin-reflect/build.gradle +++ b/libraries/tools/kotlin-reflect/build.gradle @@ -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/**' diff --git a/libraries/tools/runtime/build.gradle b/libraries/tools/runtime/build.gradle index cb1ca551691..b8775de4fa2 100644 --- a/libraries/tools/runtime/build.gradle +++ b/libraries/tools/runtime/build.gradle @@ -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") } diff --git a/libraries/tools/script-runtime/build.gradle b/libraries/tools/script-runtime/build.gradle index 098800aa9e9..48657cb8cfa 100644 --- a/libraries/tools/script-runtime/build.gradle +++ b/libraries/tools/script-runtime/build.gradle @@ -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 {