Add module-info.java for standard Kotlin libraries

Using the new multi-release jar feature, store compiled
module-info.class files into META-INF/versions/9 instead of the artifact
root. Hopefully, this will break fewer tools which do not support
module-info.class files because any sane tool should not do anything
with files in META-INF because before Java 9 that directory only
contained resources.

Upgrade some Maven plugins to newer versions which do not fail on
module-info.class files

 #KT-21266 In Progress
This commit is contained in:
Alexander Udalov
2017-08-29 11:02:45 +03:00
parent 650e97f200
commit 2d41c7d462
15 changed files with 140 additions and 19 deletions
+11 -2
View File
@@ -41,6 +41,11 @@ sourceSets {
srcDir 'test'
}
}
java9 {
java {
srcDir 'jvm/java9'
}
}
}
dependencies {
@@ -56,27 +61,31 @@ configurations {
builtins
}
createCompileJava9Task(project, "compileJava9", "kotlin.stdlib", [sourceSets.builtins.output/* TODO: sourceSets.annotations.output?*/])
task originalStdlibJar(type: Jar) {
baseName = 'original-kotlin-stdlib'
from sourceSets.main.output
}
jar {
manifestAttributes(manifest, project, 'Main')
manifestAttributes(manifest, project, 'Main', true)
from("${rootDir}/dist/builtins")
from sourceSets.builtins.output
from sourceSets.experimental.output
from compileJava9.outputs
}
task distJar(type: Jar) {
baseName = 'dist-kotlin-stdlib'
version = null
manifestAttributes(manifest, project, 'Main')
manifestAttributes(manifest, project, 'Main', true)
from("${rootDir}/dist/builtins")
from sourceSets.annotations.output
from sourceSets.builtins.output
from sourceSets.main.output
from sourceSets.experimental.output
from compileJava9.outputs
}
task builtinsJar(type: Jar) {
+9 -1
View File
@@ -26,10 +26,18 @@ sourceSets {
}
}
}
java9 {
java {
srcDirs = ['java9']
}
}
}
createCompileJava9Task(project, "compileJava9", "kotlin.stdlib.jdk7")
jar {
manifestAttributes(manifest, project, 'Main')
manifestAttributes(manifest, project, 'Main', true)
from compileJava9.outputs
}
artifacts {
@@ -0,0 +1,5 @@
module kotlin.stdlib.jdk7 {
requires transitive kotlin.stdlib;
exports kotlin.jdk7;
}
+9 -1
View File
@@ -29,10 +29,18 @@ sourceSets {
}
}
}
java9 {
java {
srcDirs = ['java9']
}
}
}
createCompileJava9Task(project, "compileJava9", "kotlin.stdlib.jdk8")
jar {
manifestAttributes(manifest, project, 'Main')
manifestAttributes(manifest, project, 'Main', true)
from compileJava9.outputs
}
artifacts {
@@ -0,0 +1,7 @@
module kotlin.stdlib.jdk8 {
requires transitive kotlin.stdlib;
exports kotlin.collections.jdk8;
exports kotlin.streams.jdk8;
exports kotlin.text.jdk8;
}
@@ -0,0 +1,37 @@
module kotlin.stdlib {
exports kotlin;
exports kotlin.annotation;
exports kotlin.collections;
exports kotlin.comparisons;
exports kotlin.concurrent;
exports kotlin.io;
exports kotlin.jvm;
exports kotlin.jvm.functions;
exports kotlin.math;
exports kotlin.properties;
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;
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.internal to kotlin.reflect;
opens kotlin.ranges to kotlin.reflect;
opens kotlin.reflect to kotlin.reflect;
}