127 lines
3.5 KiB
Groovy
127 lines
3.5 KiB
Groovy
description = 'Kotlin Standard Library JDK 8 extension'
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
configurePublishing(project)
|
|
configureSourcesJar()
|
|
configureJavadocJar()
|
|
|
|
dependencies {
|
|
api project(':kotlin-stdlib')
|
|
api project(':kotlin-stdlib-jdk7')
|
|
testApi project(':kotlin-test:kotlin-test-junit')
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
kotlin {
|
|
}
|
|
}
|
|
test {
|
|
kotlin {
|
|
srcDir 'test'
|
|
if(!BuildPropertiesKt.getKotlinBuildProperties(project).inIdeaSync) {
|
|
srcDir '../jvm/test'
|
|
srcDir '../common/test'
|
|
srcDir '../test'
|
|
srcDir '../jdk7/test'
|
|
}
|
|
}
|
|
}
|
|
java9 {
|
|
java {
|
|
srcDir 'java9'
|
|
}
|
|
}
|
|
moduleTest {
|
|
java {
|
|
srcDir 'moduleTest'
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
moduleTestApi project(':kotlin-stdlib')
|
|
moduleTestApi project(':kotlin-stdlib-jdk7')
|
|
moduleTestCompileOnly project
|
|
moduleTestApi project(':kotlin-test:kotlin-test-junit')
|
|
moduleTestApi "org.ow2.asm:asm:9.0"
|
|
}
|
|
|
|
jar {
|
|
manifestAttributes(manifest, project, 'Main', true)
|
|
from sourceSets.java9.output
|
|
}
|
|
|
|
sourcesJar {
|
|
from sourceSets.java9.allSource
|
|
}
|
|
|
|
artifacts {
|
|
archives sourcesJar
|
|
sources sourcesJar
|
|
}
|
|
|
|
compileKotlin {
|
|
kotlinOptions.freeCompilerArgs = [
|
|
"-Xallow-kotlin-package",
|
|
"-Xmultifile-parts-inherit",
|
|
"-Xno-new-java-annotation-targets",
|
|
]
|
|
kotlinOptions.moduleName = project.name
|
|
}
|
|
|
|
compileTestKotlin {
|
|
kotlinOptions.freeCompilerArgs = [
|
|
"-Xallow-kotlin-package",
|
|
"-Xmulti-platform",
|
|
"-opt-in=kotlin.RequiresOptIn",
|
|
"-opt-in=kotlin.ExperimentalUnsignedTypes",
|
|
"-opt-in=kotlin.ExperimentalStdlibApi",
|
|
"-opt-in=kotlin.io.path.ExperimentalPathApi",
|
|
"-Xcommon-sources=${fileTree('../test').join(',')}",
|
|
"-XXLanguage:+RangeUntilOperator",
|
|
]
|
|
}
|
|
|
|
configureFrontendIr(project)
|
|
|
|
LibrariesCommon.configureJava9Compilation(project, 'kotlin.stdlib.jdk8')
|
|
|
|
task testJdk6Tests(type: Test) { thisTask ->
|
|
dependsOn(':kotlin-stdlib:testClasses')
|
|
check.dependsOn(thisTask)
|
|
group = "verification"
|
|
def kotlinStdLibTestOutput = project(':kotlin-stdlib').sourceSets.test.output
|
|
def objectFactory = project.objects
|
|
doFirst {
|
|
testClassesDirs = kotlinStdLibTestOutput
|
|
classpath = objectFactory.fileCollection().from(
|
|
testClassesDirs,
|
|
sourceSets.test.compileClasspath
|
|
)
|
|
}
|
|
}
|
|
|
|
[JdkMajorVersion.JDK_9_0, JdkMajorVersion.JDK_10_0, JdkMajorVersion.JDK_11_0].forEach { jvmVersion ->
|
|
check.dependsOn(tasks.register("jdk${jvmVersion.majorVersion}Test", Test) { thisTask ->
|
|
group = "verification"
|
|
thisTask.javaLauncher.set(JvmToolchain.getToolchainLauncherFor(project, jvmVersion))
|
|
})
|
|
}
|
|
|
|
compileModuleTestKotlin {
|
|
kotlinJavaToolchain.toolchain.use(JvmToolchain.getToolchainLauncherFor(project, JdkMajorVersion.JDK_9_0))
|
|
}
|
|
|
|
check.dependsOn(tasks.register("moduleInfoTest", Test) {test ->
|
|
test.dependsOn(moduleTestClasses)
|
|
test.group = "verification"
|
|
test.testClassesDirs = sourceSets.moduleTest.output.classesDirs
|
|
test.classpath = files(sourceSets.moduleTest.runtimeClasspath, tasks.jar)
|
|
test.javaLauncher.set(JvmToolchain.getToolchainLauncherFor(project, JdkMajorVersion.JDK_9_0))
|
|
doFirst {
|
|
test.systemProperty("stdlibJars", test.classpath.filter { it.name.contains('kotlin-stdlib') }.join(File.pathSeparator))
|
|
}
|
|
})
|