Build common standard library headers and kotlin-test (common and jvm) as multiplatform projects.

This commit is contained in:
Ilya Gorbunov
2017-03-06 19:47:51 +03:00
parent 780e12f04a
commit 08fa304b6f
11 changed files with 272 additions and 121 deletions
+5 -24
View 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"]
}
}
+67 -1
View File
@@ -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 = ''
+20
View File
@@ -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>
+18 -1
View File
@@ -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
+18 -1
View File
@@ -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