Build java9 modular artifacts under 'modular' classifier
Provide additional modular artifacts as a workaround for KT-21266 Update module-info declarations: - add new packages - add exports and opens for internal PlatformImplementations - remove exports of kotlin.coroutines.experimental.* #KT-27919 Fixed
This commit is contained in:
@@ -90,13 +90,10 @@ ext.manifestAttributes = { Manifest manifest, Project project, String component
|
||||
'Kotlin-Runtime-Component': component,
|
||||
'Kotlin-Version': project.kotlinLanguageVersion
|
||||
}
|
||||
// TODO: enable as soon as this doesn't cause D8/DX to crash
|
||||
/*
|
||||
if (multiRelease) {
|
||||
attributes \
|
||||
'Multi-Release': 'true'
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -25,14 +25,24 @@ dependencies {
|
||||
archivesBaseName = 'kotlin-test'
|
||||
|
||||
jar {
|
||||
manifestAttributes(manifest, project, 'Test', true)
|
||||
manifestAttributes(manifest, project, 'Test' /*true*/)
|
||||
// TODO: enable as soon as this doesn't cause D8/DX to crash
|
||||
// from sourceSets.java9.output
|
||||
}
|
||||
|
||||
task modularJar(type: Jar) {
|
||||
dependsOn(jar)
|
||||
manifestAttributes(manifest, project, 'Test', true)
|
||||
classifier = 'modular'
|
||||
|
||||
from zipTree(jar.outputs.files.singleFile)
|
||||
from sourceSets.java9.output
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
dist {
|
||||
|
||||
@@ -44,8 +44,7 @@ jar {
|
||||
|
||||
task java9Jar(type: Jar) {
|
||||
classifier = "java9"
|
||||
// TODO: enable as soon as this doesn't cause D8/DX to crash
|
||||
// from sourceSets.java9.output
|
||||
from sourceSets.java9.output
|
||||
}
|
||||
|
||||
artifacts {
|
||||
|
||||
@@ -109,7 +109,7 @@ class KotlinModuleShadowTransformer(private val logger: Logger) : Transformer {
|
||||
val reflectShadowJar by task<ShadowJar> {
|
||||
classifier = "shadow"
|
||||
version = null
|
||||
callGroovy("manifestAttributes", manifest, project, "Main", true)
|
||||
callGroovy("manifestAttributes", manifest, project, "Main" /*true*/)
|
||||
|
||||
from(project(":core:descriptors.jvm").mainSourceSet.resources) {
|
||||
include("META-INF/services/**")
|
||||
@@ -191,6 +191,16 @@ val sourcesJar = sourcesJar(sourceSet = null) {
|
||||
val result by task<Jar> {
|
||||
dependsOn(proguard)
|
||||
from(zipTree(file(proguardOutput)))
|
||||
// from(zipTree(reflectShadowJar.archivePath)) {
|
||||
// include("META-INF/versions/**")
|
||||
// }
|
||||
callGroovy("manifestAttributes", manifest, project, "Main" /*true*/)
|
||||
}
|
||||
|
||||
val modularJar by task<Jar> {
|
||||
dependsOn(proguard)
|
||||
classifier = "modular"
|
||||
from(zipTree(file(proguardOutput)))
|
||||
from(zipTree(reflectShadowJar.archivePath)) {
|
||||
include("META-INF/versions/**")
|
||||
}
|
||||
@@ -208,12 +218,13 @@ artifacts {
|
||||
val artifactJar = mapOf(
|
||||
"file" to result.outputs.files.single(),
|
||||
"builtBy" to result,
|
||||
"name" to property("archivesBaseName")
|
||||
"name" to base.archivesBaseName
|
||||
)
|
||||
|
||||
add(mainJar.name, artifactJar)
|
||||
add("runtime", artifactJar)
|
||||
add("archives", artifactJar)
|
||||
add("archives", modularJar)
|
||||
}
|
||||
|
||||
javadocJar()
|
||||
|
||||
@@ -41,14 +41,25 @@ sourceSets {
|
||||
}
|
||||
|
||||
jar {
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
manifestAttributes(manifest, project, 'Main' /*true*/)
|
||||
// TODO: enable as soon as this doesn't cause D8/DX to crash
|
||||
// from sourceSets.java9.output
|
||||
}
|
||||
|
||||
task modularJar(type: Jar) {
|
||||
dependsOn(jar)
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
classifier = 'modular'
|
||||
|
||||
from zipTree(jar.outputs.files.singleFile)
|
||||
from sourceSets.java9.output
|
||||
}
|
||||
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
dist {
|
||||
|
||||
@@ -2,4 +2,7 @@ module kotlin.stdlib.jdk7 {
|
||||
requires transitive kotlin.stdlib;
|
||||
|
||||
exports kotlin.jdk7;
|
||||
|
||||
exports kotlin.internal.jdk7 to kotlin.stdlib.jdk8;
|
||||
opens kotlin.internal.jdk7 to kotlin.stdlib;
|
||||
}
|
||||
|
||||
@@ -44,14 +44,25 @@ sourceSets {
|
||||
}
|
||||
|
||||
jar {
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
manifestAttributes(manifest, project, 'Main' /*true*/)
|
||||
// TODO: enable as soon as this doesn't cause D8/DX to crash
|
||||
// from sourceSets.java9.output
|
||||
}
|
||||
|
||||
task modularJar(type: Jar) {
|
||||
dependsOn(jar)
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
classifier = 'modular'
|
||||
|
||||
from zipTree(jar.outputs.files.singleFile)
|
||||
from sourceSets.java9.output
|
||||
}
|
||||
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
dist {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
module kotlin.stdlib.jdk8 {
|
||||
requires transitive kotlin.stdlib;
|
||||
requires kotlin.stdlib.jdk7;
|
||||
|
||||
exports kotlin.collections.jdk8;
|
||||
exports kotlin.streams.jdk8;
|
||||
exports kotlin.text.jdk8;
|
||||
|
||||
opens kotlin.internal.jdk8 to kotlin.stdlib;
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ dependencies {
|
||||
}
|
||||
|
||||
jar {
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
manifestAttributes(manifest, project, 'Main' /*true*/)
|
||||
from("${rootDir}/dist/builtins")
|
||||
from sourceSets.experimental.output
|
||||
from sourceSets.coroutines.output
|
||||
@@ -85,14 +85,14 @@ jar {
|
||||
task coroutinesJar(type: Jar) {
|
||||
version = null
|
||||
classifier = 'coroutines'
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
manifestAttributes(manifest, project, 'Main')
|
||||
project.configure(manifest) { attributes 'Kotlin-Version': '1.3' }
|
||||
}
|
||||
|
||||
task unsignedJar(type: Jar) {
|
||||
version = null
|
||||
classifier = 'unsigned'
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
manifestAttributes(manifest, project, 'Main')
|
||||
project.configure(manifest) { attributes 'Kotlin-Version': '1.3' }
|
||||
}
|
||||
|
||||
@@ -122,9 +122,19 @@ task distMavenSources(type: Copy) {
|
||||
rename "-${java.util.regex.Pattern.quote(version)}", ''
|
||||
}
|
||||
|
||||
task modularJar(type: Jar) {
|
||||
dependsOn(jar)
|
||||
manifestAttributes(manifest, project, 'Main', true)
|
||||
classifier = 'modular'
|
||||
|
||||
from zipTree(jar.outputs.files.singleFile)
|
||||
from sourceSets.java9.output
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
archives javadocJar
|
||||
archives modularJar
|
||||
}
|
||||
|
||||
dist {
|
||||
@@ -189,7 +199,7 @@ compileExperimentalKotlin {
|
||||
}
|
||||
}
|
||||
|
||||
compileJava9Sources(project, 'kotlin.stdlib')
|
||||
compileJava9Sources(project, 'kotlin.stdlib', [sourceSets.main.output, sourceSets.coroutines.output])
|
||||
|
||||
compileCoroutinesKotlin {
|
||||
kotlinOptions {
|
||||
|
||||
@@ -4,33 +4,39 @@ module kotlin.stdlib {
|
||||
exports kotlin.collections;
|
||||
exports kotlin.comparisons;
|
||||
exports kotlin.concurrent;
|
||||
exports kotlin.contracts;
|
||||
exports kotlin.coroutines;
|
||||
exports kotlin.coroutines.intrinsics;
|
||||
exports kotlin.coroutines.jvm.internal;
|
||||
exports kotlin.io;
|
||||
exports kotlin.jvm;
|
||||
exports kotlin.jvm.functions;
|
||||
exports kotlin.math;
|
||||
exports kotlin.properties;
|
||||
exports kotlin.random;
|
||||
exports kotlin.ranges;
|
||||
exports kotlin.reflect;
|
||||
exports kotlin.sequences;
|
||||
exports kotlin.system;
|
||||
exports kotlin.text;
|
||||
|
||||
exports kotlin.coroutines.experimental;
|
||||
exports kotlin.coroutines.experimental.intrinsics;
|
||||
exports kotlin.coroutines.experimental.jvm.internal;
|
||||
// do not export experimental coroutines packages
|
||||
//exports kotlin.coroutines.experimental;
|
||||
//exports kotlin.coroutines.experimental.intrinsics;
|
||||
//exports kotlin.coroutines.experimental.jvm.internal;
|
||||
//exports kotlin.coroutines.experimental.migration;
|
||||
|
||||
exports kotlin.experimental;
|
||||
|
||||
exports kotlin.internal;
|
||||
exports kotlin.jvm.internal;
|
||||
exports kotlin.jvm.internal.markers;
|
||||
|
||||
// TODO?
|
||||
// exports org.jetbrains.annotations;
|
||||
|
||||
// Open packages with .kotlin_builtins files to kotlin-reflect, to allow reflection to load built-in declarations there
|
||||
opens kotlin to kotlin.reflect;
|
||||
opens kotlin.annotation to kotlin.reflect;
|
||||
opens kotlin.collections to kotlin.reflect;
|
||||
opens kotlin.coroutines to kotlin.reflect;
|
||||
opens kotlin.internal to kotlin.reflect;
|
||||
opens kotlin.ranges to kotlin.reflect;
|
||||
opens kotlin.reflect to kotlin.reflect;
|
||||
|
||||
Reference in New Issue
Block a user