Build common standard library headers and kotlin-test (common and jvm) as multiplatform projects.
This commit is contained in:
+63
-38
@@ -14,6 +14,8 @@ buildscript {
|
||||
ext.JDK_16 = System.getenv("JDK_16")
|
||||
ext.JDK_17 = System.getenv("JDK_17")
|
||||
ext.JDK_18 = System.getenv("JDK_18")
|
||||
ext.bootstrapCompilerFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-compiler.jar")
|
||||
ext.compilerPreloaderFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-preloader.jar")
|
||||
|
||||
allprojects {
|
||||
apply plugin: 'maven'
|
||||
@@ -23,45 +25,12 @@ allprojects {
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'signing'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
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/") }
|
||||
}
|
||||
|
||||
// TODO: use dokka instead?
|
||||
javadoc {
|
||||
failOnError = false
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn:classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.kotlin
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn:javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
compileKotlin.compilerJarFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-compiler.jar")
|
||||
compileTestKotlin.compilerJarFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-compiler.jar")
|
||||
|
||||
compileKotlin.kotlinOptions.jdkHome = JDK_16
|
||||
|
||||
signing {
|
||||
required { project.ext.has('signing.keyId') }
|
||||
sign configurations.archives
|
||||
@@ -83,9 +52,65 @@ 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']}) {
|
||||
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
commonJvmProjectConfiguration(project)
|
||||
|
||||
}
|
||||
|
||||
static def commonJvmProjectConfiguration(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/") }
|
||||
}
|
||||
|
||||
|
||||
// TODO: use dokka instead?
|
||||
javadoc {
|
||||
failOnError = false
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn:classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.kotlin
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn:javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
compileKotlin.compilerJarFile = bootstrapCompilerFile
|
||||
compileTestKotlin.compilerJarFile = bootstrapCompilerFile
|
||||
|
||||
compileKotlin.kotlinOptions.jdkHome = JDK_16
|
||||
compileTestKotlin.kotlinOptions.jdkHome = JDK_16
|
||||
|
||||
test {
|
||||
executable = "$JDK_16/bin/java"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static def manifestAttributes(Manifest manifest, Project project, String component) {
|
||||
manifest.attributes \
|
||||
'Kotlin-Runtime-Component': component,
|
||||
'Kotlin-Version': "${project.kotlin_language_version}",
|
||||
'Implementation-Title': "${project.description ?: project.name}"
|
||||
}
|
||||
project.configure(manifest) {
|
||||
attributes \
|
||||
'Kotlin-Runtime-Component': component,
|
||||
'Kotlin-Version': "${project.kotlin_language_version}",
|
||||
'Implementation-Title': "${project.description ?: project.name}"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
description = 'Kotlin Test Common'
|
||||
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-stdlib-common')
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
test {
|
||||
kotlin {
|
||||
srcDir 'src/test'
|
||||
exclude '**'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// common block
|
||||
|
||||
compileKotlinCommon.compilerJarFile = bootstrapCompilerFile
|
||||
|
||||
|
||||
|
||||
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/") }
|
||||
}
|
||||
|
||||
|
||||
// TODO: use dokka instead?
|
||||
javadoc {
|
||||
failOnError = false
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn:classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.kotlin
|
||||
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn:javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package kotlin.jvm
|
||||
|
||||
@Suppress("HEADER_WITHOUT_IMPLEMENTATION")
|
||||
@Target(AnnotationTarget.FILE)
|
||||
internal header annotation class JvmMultifileClass
|
||||
|
||||
@Suppress("HEADER_WITHOUT_IMPLEMENTATION")
|
||||
@Target(AnnotationTarget.FILE)
|
||||
internal header annotation class JvmName(val name: String)
|
||||
@@ -2,25 +2,10 @@
|
||||
description = 'Kotlin Test JUnit'
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-runtime')
|
||||
compile project(':kotlin-test-parent:kotlin-test')
|
||||
compile project(':kotlin-test:kotlin-test-jvm')
|
||||
compile('junit:junit:4.12')
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
kotlin {
|
||||
srcDir 'src/main/kotlin'
|
||||
srcDir 'src/main/kotlin.jvm'
|
||||
}
|
||||
}
|
||||
test {
|
||||
kotlin {
|
||||
srcDir 'src/test/kotlin'
|
||||
srcDir 'src/test/kotlin.jvm'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
|
||||
description = 'Kotlin Test'
|
||||
|
||||
apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-runtime')
|
||||
implement project(':kotlin-test:kotlin-test-common')
|
||||
compile project(':kotlin-stdlib')
|
||||
testCompile('junit:junit:4.12')
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
kotlin {
|
||||
srcDir 'src/main/kotlin'
|
||||
srcDir 'src/main/kotlin.jvm'
|
||||
}
|
||||
}
|
||||
test {
|
||||
kotlin {
|
||||
srcDir 'src/test/kotlin'
|
||||
srcDir 'src/test/kotlin.jvm'
|
||||
}
|
||||
}
|
||||
}
|
||||
commonJvmProjectConfiguration(project)
|
||||
|
||||
archivesBaseName = 'kotlin-test'
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
@@ -28,9 +20,6 @@ jar {
|
||||
}
|
||||
dependsOn classes
|
||||
from sourceSets.main.output
|
||||
exclude('kotlin/internal/OnlyInputTypes*')
|
||||
exclude('kotlin/internal/InlineOnly*')
|
||||
exclude('kotlin/internal')
|
||||
}
|
||||
|
||||
artifacts {
|
||||
@@ -39,7 +28,8 @@ artifacts {
|
||||
}
|
||||
|
||||
compileKotlin {
|
||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", "${project.name}".toString()]
|
||||
// TODO: Why "-Xmulti-platfrom" ?
|
||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-Xmulti-platform", "-module-name", project.archivesBaseName]
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
+16
-12
@@ -1,15 +1,17 @@
|
||||
rootProject.name = 'kotlin-libraries'
|
||||
include ':kotlin-runtime'
|
||||
include ':kotlin-script-runtime'
|
||||
include ':kotlin-js-library'
|
||||
include ':kotlin-test-parent'
|
||||
include ':kotlin-test-parent:kotlin-test'
|
||||
include ':kotlin-test-parent:kotlin-test-junit'
|
||||
//include ':kotlin-stdlib-common'
|
||||
//include ':kotlin-js-library'
|
||||
include ':kotlin-test'
|
||||
include ':kotlin-test:kotlin-test-common'
|
||||
include ':kotlin-test:kotlin-test-jvm'
|
||||
include ':kotlin-test:kotlin-test-junit'
|
||||
//include ':kotlin-test:kotlin-test-js'
|
||||
include ':kotlin-stdlib-common'
|
||||
include ':kotlin-stdlib'
|
||||
include ':kotlin-stdlib-jre7'
|
||||
include ':kotlin-stdlib-jre8'
|
||||
include ':kotlin-reflect'
|
||||
//include ':kotlin-reflect'
|
||||
|
||||
//include ':kotlin-compiler'
|
||||
//include ':kotlin-compiler-embeddable'
|
||||
@@ -50,15 +52,17 @@ include ':kotlin-reflect'
|
||||
|
||||
project(':kotlin-runtime').projectDir = "$rootDir/tools/runtime" as File
|
||||
project(':kotlin-script-runtime').projectDir = "$rootDir/tools/script-runtime" as File
|
||||
project(':kotlin-js-library').projectDir = "$rootDir/tools/kotlin-js-library" as File
|
||||
project(':kotlin-test-parent').projectDir = "$rootDir/kotlin.test" as File
|
||||
project(':kotlin-test-parent:kotlin-test').projectDir = "$rootDir/kotlin.test/shared" as File
|
||||
project(':kotlin-test-parent:kotlin-test-junit').projectDir = "$rootDir/kotlin.test/junit" as File
|
||||
//project(':kotlin-stdlib-common').projectDir = "$rootDir/stdlib/common" as File
|
||||
//project(':kotlin-js-library').projectDir = "$rootDir/tools/kotlin-js-library" as File
|
||||
project(':kotlin-test').projectDir = "$rootDir/kotlin.test" as File
|
||||
project(':kotlin-test:kotlin-test-common').projectDir = "$rootDir/kotlin.test/common" as File
|
||||
project(':kotlin-test:kotlin-test-jvm').projectDir = "$rootDir/kotlin.test/jvm" as File
|
||||
project(':kotlin-test:kotlin-test-junit').projectDir = "$rootDir/kotlin.test/junit" as File
|
||||
//project(':kotlin-test:kotlin-test-js').projectDir = "$rootDir/kotlin.test/js" as File
|
||||
project(':kotlin-stdlib-common').projectDir = "$rootDir/stdlib/common" as File
|
||||
project(':kotlin-stdlib').projectDir = "$rootDir/stdlib" as File
|
||||
project(':kotlin-stdlib-jre7').projectDir = "$rootDir/stdlib/jre7" as File
|
||||
project(':kotlin-stdlib-jre8').projectDir = "$rootDir/stdlib/jre8" as File
|
||||
project(':kotlin-reflect').projectDir = "$rootDir/tools/kotlin-reflect" as File
|
||||
//project(':kotlin-reflect').projectDir = "$rootDir/tools/kotlin-reflect" as File
|
||||
|
||||
//project(':kotlin-compiler').projectDir = "$rootDir/tools/kotlin-compiler" as File
|
||||
//project(':kotlin-compiler-embeddable').projectDir = "$rootDir/tools/kotlin-compiler-embeddable" as File
|
||||
|
||||
@@ -18,15 +18,6 @@ sourceSets {
|
||||
srcDir 'src'
|
||||
}
|
||||
}
|
||||
testLib {
|
||||
kotlin {
|
||||
srcDir '../kotlin.test/common/src/main/kotlin'
|
||||
srcDir '../kotlin.test/jvm/src/main/kotlin'
|
||||
srcDir '../kotlin.test/junit/src/main/kotlin'
|
||||
|
||||
//resources '../kotlin.test/junit/src/main/resources'
|
||||
}
|
||||
}
|
||||
test {
|
||||
kotlin {
|
||||
srcDir 'test'
|
||||
@@ -37,14 +28,8 @@ sourceSets {
|
||||
dependencies {
|
||||
builtinsCompile group: 'org.jetbrains', name: 'annotations', version:'13.0'
|
||||
compile sourceSets.builtins.output
|
||||
// compile project(':kotlin-runtime')
|
||||
// testCompile project(':kotlin-test-parent:kotlin-test-junit')
|
||||
|
||||
testLibCompile sourceSets.builtins.output
|
||||
//testLibCompile sourceSets.main.output
|
||||
testLibCompile('junit:junit:4.12')
|
||||
testCompile configurations.testLibCompile
|
||||
testCompile sourceSets.testLib.output
|
||||
|
||||
testCompile project(':kotlin-test:kotlin-test-junit')
|
||||
}
|
||||
|
||||
jar {
|
||||
@@ -71,9 +56,11 @@ artifacts {
|
||||
}
|
||||
|
||||
compileBuiltinsKotlin {
|
||||
compilerJarFile = bootstrapCompilerFile
|
||||
kotlinOptions {
|
||||
jdkHome = JDK_16
|
||||
freeCompilerArgs = [
|
||||
"-version",
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xdump-declarations-to", "${buildDir}/runtime-declarations.json",
|
||||
"-cp", "${rootDir}/../dist/builtins",
|
||||
@@ -85,6 +72,7 @@ compileKotlin {
|
||||
kotlinOptions {
|
||||
jdkHome = JDK_16
|
||||
freeCompilerArgs = [
|
||||
"-version",
|
||||
"-Xallow-kotlin-package",
|
||||
"-Xmultifile-parts-inherit",
|
||||
"-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json",
|
||||
@@ -92,10 +80,3 @@ compileKotlin {
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
compileTestLibKotlin {
|
||||
kotlinOptions {
|
||||
jdkHome = JDK_16
|
||||
freeCompilerArgs = ["-Xallow-kotlin-package", "-Xmulti-platform"]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,2 +1,68 @@
|
||||
description = 'Kotlin Common Standard Library'
|
||||
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
|
||||
ext.commonSrcDir = "${buildDir}/common-sources"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
kotlin {
|
||||
srcDir 'src'
|
||||
srcDir commonSrcDir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ant.properties.baseDir = projectDir
|
||||
ant.properties.commonSrcDir = commonSrcDir
|
||||
ant.properties.kotlinCompiler = bootstrapCompilerFile.path
|
||||
ant.properties.compilerPreloader = compilerPreloaderFile.path
|
||||
|
||||
ant.importBuild('tasks.xml')
|
||||
|
||||
compileKotlinCommon.dependsOn commonSources
|
||||
|
||||
/*
|
||||
// TODO: currently unsupported
|
||||
compileKotlinCommon {
|
||||
kotlinOptions {
|
||||
freeCompilerArgs = [
|
||||
"-module-name", "${project.name}".toString()
|
||||
]
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
compileKotlinCommon.compilerJarFile = bootstrapCompilerFile
|
||||
|
||||
|
||||
|
||||
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/") }
|
||||
}
|
||||
|
||||
|
||||
// TODO: use dokka instead?
|
||||
javadoc {
|
||||
failOnError = false
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar, dependsOn:classes) {
|
||||
classifier = 'sources'
|
||||
from sourceSets.main.kotlin
|
||||
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar, dependsOn:javadoc) {
|
||||
classifier = 'javadoc'
|
||||
from javadoc.destinationDir
|
||||
}
|
||||
|
||||
description = ''
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<project>
|
||||
<target name="commonSources">
|
||||
<delete dir="${commonSrcDir}" failonerror="false"/>
|
||||
<mkdir dir="${commonSrcDir}"/>
|
||||
<java classname="org.jetbrains.kotlin.preloading.Preloader" failonerror="true" fork="true">
|
||||
<classpath>
|
||||
<pathelement location="${compilerPreloader}"/>
|
||||
</classpath>
|
||||
<assertions>
|
||||
<enable/>
|
||||
</assertions>
|
||||
<arg value="-cp"/>
|
||||
<arg value="${kotlinCompiler}"/>
|
||||
<arg value="org.jetbrains.kotlin.preprocessor.PreprocessorCLI"/>
|
||||
<arg value="${basedir}/../src/kotlin"/>
|
||||
<arg value="${commonSrcDir}"/>
|
||||
<arg value="JS"/>
|
||||
</java>
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,8 +1,9 @@
|
||||
description = 'Kotlin Standard Library JRE 7 extension'
|
||||
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-stdlib')
|
||||
testCompile project(':kotlin-test-parent:kotlin-test-junit')
|
||||
testCompile project(':kotlin-test:kotlin-test-junit')
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -42,3 +43,19 @@ compileTestKotlin {
|
||||
kotlinOptions.jdkHome = JDK_17
|
||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"]
|
||||
}
|
||||
|
||||
test {
|
||||
executable = "$JDK_17/bin/java"
|
||||
}
|
||||
|
||||
task testJre6Tests(type: Test) {
|
||||
dependsOn project(':kotlin-stdlib').tasks.testClasses
|
||||
group = "verification"
|
||||
|
||||
executable = "$JDK_17/bin/java"
|
||||
|
||||
testClassesDir = project.file('../build/classes/test')
|
||||
classpath = project.files('../build/classes/test') + sourceSets.test.compileClasspath
|
||||
}
|
||||
|
||||
check.dependsOn testJre6Tests
|
||||
@@ -3,7 +3,7 @@ description = 'Kotlin Standard Library JRE 8 extension'
|
||||
dependencies {
|
||||
compile project(':kotlin-stdlib')
|
||||
compile project(':kotlin-stdlib-jre7')
|
||||
testCompile project(':kotlin-test-parent:kotlin-test-junit')
|
||||
testCompile project(':kotlin-test:kotlin-test-junit')
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
@@ -46,3 +46,20 @@ compileTestKotlin {
|
||||
kotlinOptions.jvmTarget = 1.8
|
||||
kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"]
|
||||
}
|
||||
|
||||
test {
|
||||
executable = "$JDK_18/bin/java"
|
||||
}
|
||||
|
||||
|
||||
task testJre6Tests(type: Test) {
|
||||
dependsOn project(':kotlin-stdlib').tasks.testClasses
|
||||
group = "verification"
|
||||
|
||||
executable = "$JDK_18/bin/java"
|
||||
|
||||
testClassesDir = project.file('../build/classes/test')
|
||||
classpath = project.files('../build/classes/test') + sourceSets.test.compileClasspath
|
||||
}
|
||||
|
||||
check.dependsOn testJre6Tests
|
||||
Reference in New Issue
Block a user