From 35a135cbf60161f5dcb325b7d1456b4b66a11368 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Wed, 4 Jan 2017 15:00:47 +0100 Subject: [PATCH] Add builds for main stdlib, stdlib jre7/8, kotlin.test --- libraries/build.gradle | 5 ++ libraries/kotlin.test/junit/build.gradle | 39 +++++++++++++++- libraries/kotlin.test/shared/build.gradle | 47 ++++++++++++++++++- libraries/stdlib/build.gradle | 54 ++++++++++++++++++++- libraries/stdlib/jre7/build.gradle | 52 ++++++++++++++++++++- libraries/stdlib/jre8/build.gradle | 57 ++++++++++++++++++++++- libraries/tools/runtime/build.gradle | 8 ++++ 7 files changed, 257 insertions(+), 5 deletions(-) diff --git a/libraries/build.gradle b/libraries/build.gradle index e1a2dbc7621..9c3482cb581 100644 --- a/libraries/build.gradle +++ b/libraries/build.gradle @@ -32,6 +32,11 @@ subprojects { 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.allSource diff --git a/libraries/kotlin.test/junit/build.gradle b/libraries/kotlin.test/junit/build.gradle index 55e81c23892..41fe84522fb 100644 --- a/libraries/kotlin.test/junit/build.gradle +++ b/libraries/kotlin.test/junit/build.gradle @@ -1,5 +1,42 @@ -description = '' +description = 'Kotlin Test JUnit' + dependencies { + compile project(':kotlin-runtime') compile project(':kotlin-test-parent:kotlin-test') + 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 { + attributes 'Implementation-Title': "${project.description ?: project.name}" + } +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +compileKotlin { + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", "${project.name}".toString()] +} + +compileTestKotlin { + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] } diff --git a/libraries/kotlin.test/shared/build.gradle b/libraries/kotlin.test/shared/build.gradle index 408c4dc3982..d7107f13e88 100644 --- a/libraries/kotlin.test/shared/build.gradle +++ b/libraries/kotlin.test/shared/build.gradle @@ -1,2 +1,47 @@ -description = '' +description = 'Kotlin Test' + +dependencies { + compile project(':kotlin-runtime') + 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 { + attributes 'addDefaultImplementationEntries': true, + 'Implementation-Title': "${project.description ?: project.name}" + } + dependsOn classes + from sourceSets.main.output + exclude('kotlin/internal/OnlyInputTypes*') + exclude('kotlin/internal/InlineOnly*') + exclude('kotlin/internal') +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +compileKotlin { + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", "${project.name}".toString()] +} + +compileTestKotlin { + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] +} diff --git a/libraries/stdlib/build.gradle b/libraries/stdlib/build.gradle index 30e087fdd4a..e8b017e2e78 100644 --- a/libraries/stdlib/build.gradle +++ b/libraries/stdlib/build.gradle @@ -1,6 +1,58 @@ -description = '' +description = 'Kotlin stdlib' + dependencies { compile project(':kotlin-runtime') + compile project(':kotlin-test-parent:kotlin-test') + compile('junit:junit:4.12') testCompile project(':kotlin-test-parent:kotlin-test-junit') } + +sourceSets { + main { + kotlin { + srcDir 'src' + } + java { + srcDir 'src' + } + } + test { + kotlin { + srcDir 'test' + } + } +} + +jar { + manifest { + attributes 'Kotlin-Runtime-Component': 'Core', + 'Implementation-Title': "${project.description ?: project.name}" + } +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +compileJava { + sourceCompatibility = 1.6 + targetCompatibility = 1.6 +} + +compileTestJava { + sourceCompatibility = 1.6 + targetCompatibility = 1.6 +} + +compileKotlin { + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", + "-Xmultifile-parts-inherit", + "-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json".toString(), + "-module-name", "${project.name}".toString()] +} + +compileTestKotlin { + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] +} diff --git a/libraries/stdlib/jre7/build.gradle b/libraries/stdlib/jre7/build.gradle index c398e757229..e93d018413a 100644 --- a/libraries/stdlib/jre7/build.gradle +++ b/libraries/stdlib/jre7/build.gradle @@ -1,6 +1,56 @@ -description = '' +description = 'Kotlin stdlib JRE 7' + dependencies { compile project(':kotlin-stdlib') testCompile project(':kotlin-test-parent:kotlin-test-junit') } + +sourceSets { + main { + kotlin { + srcDir 'src' + } + } + test { + kotlin { + srcDir 'test' + srcDir '../test' + } + } +} + +jar { + manifest { + attributes 'Kotlin-Runtime-Component': 'Core', + 'Implementation-Title': "${project.description ?: project.name}" + } +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +compileJava { + sourceCompatibility = 1.7 + targetCompatibility = 1.7 +} + +compileTestJava { + sourceCompatibility = 1.7 + targetCompatibility = 1.7 +} + +compileKotlin { + kotlinOptions.jdkHome = System.getenv('JDK_17') + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", + "-Xmultifile-parts-inherit", + "-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json".toString(), + "-module-name", "${project.name}".toString()] +} + +compileTestKotlin { + kotlinOptions.jdkHome = System.getenv('JDK_17') + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] +} diff --git a/libraries/stdlib/jre8/build.gradle b/libraries/stdlib/jre8/build.gradle index c66de849741..84c3e3515c2 100644 --- a/libraries/stdlib/jre8/build.gradle +++ b/libraries/stdlib/jre8/build.gradle @@ -1,6 +1,61 @@ -description = '' +description = 'Kotlin stdlib JRE 8' + dependencies { + compile project(':kotlin-stdlib') compile project(':kotlin-stdlib-jre7') testCompile project(':kotlin-test-parent:kotlin-test-junit') + testCompile project(':kotlin-stdlib-jre7') +} + +sourceSets { + main { + kotlin { + srcDir 'src' + } + } + test { + kotlin { + srcDir 'test' + srcDir '../test' + srcDir '../jre7/test' + } + } +} + +jar { + manifest { + attributes 'Kotlin-Runtime-Component': 'Core', + 'Implementation-Title': "${project.description ?: project.name}" + } +} + +artifacts { + archives sourcesJar + archives javadocJar +} + +compileJava { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 +} + +compileTestJava { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 +} + +compileKotlin { + kotlinOptions.jdkHome = System.getenv('JDK_18') + kotlinOptions.jvmTarget = 1.8 + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", + "-Xmultifile-parts-inherit", + "-Xdump-declarations-to", "${buildDir}/stdlib-declarations.json".toString(), + "-module-name", "${project.name}".toString()] +} + +compileTestKotlin { + kotlinOptions.jdkHome = System.getenv('JDK_18') + kotlinOptions.jvmTarget = 1.8 + kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package"] } diff --git a/libraries/tools/runtime/build.gradle b/libraries/tools/runtime/build.gradle index d055eb60b2c..e3abf070e8a 100644 --- a/libraries/tools/runtime/build.gradle +++ b/libraries/tools/runtime/build.gradle @@ -33,6 +33,14 @@ artifacts { archives javadocJar } +compileJava { + sourceCompatibility = 1.6 + targetCompatibility = 1.6 + options.fork = true + // TODO: find how to fix on macos +// options.bootClasspath = "${System.getenv('JDK_16')}/jre/lib/rt.jar" +} + compileKotlin { kotlinOptions.freeCompilerArgs = ["-Xallow-kotlin-package", "-module-name", "${project.name}".toString()] }