KT-50033 Add missing public API packages to module-info and setup a test

The test checks that new packages are not accidentally non-exported,
so each new stdlib package must be either exported or specified in that
test's expected non-exported package list.
This commit is contained in:
Ilya Gorbunov
2021-12-01 10:48:55 +03:00
committed by Space
parent 8c558fb6ba
commit 9c90d4e471
5 changed files with 117 additions and 6 deletions
+31 -6
View File
@@ -34,6 +34,19 @@ sourceSets {
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 {
@@ -94,11 +107,23 @@ task testJdk6Tests(type: Test) { thisTask ->
}
[JdkMajorVersion.JDK_9, JdkMajorVersion.JDK_10, JdkMajorVersion.JDK_11].forEach { jvmVersion ->
tasks.register("jdk${jvmVersion.majorVersion}Test", Test) { thisTask ->
check.dependsOn(thisTask)
check.dependsOn(tasks.register("jdk${jvmVersion.majorVersion}Test", Test) { thisTask ->
group = "verification"
thisTask.javaLauncher.set(
JvmToolchain.getToolchainLauncherFor(project, jvmVersion)
)
}
thisTask.javaLauncher.set(JvmToolchain.getToolchainLauncherFor(project, jvmVersion))
})
}
compileModuleTestKotlin {
kotlinJavaToolchain.toolchain.use(JvmToolchain.getToolchainLauncherFor(project, JdkMajorVersion.JDK_9))
}
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))
doFirst {
test.systemProperty("stdlibJars", test.classpath.filter { it.name.contains('kotlin-stdlib') }.join(File.pathSeparator))
}
})