JS: support '-Xskip-metadata-version-check' to allow pre-release libraries

This commit is contained in:
Alexander Udalov
2017-03-16 14:35:17 +03:00
parent a795a256f4
commit 30dfd5cc1b
6 changed files with 59 additions and 15 deletions
@@ -0,0 +1,9 @@
package a
open class A {
class Nested
}
fun foo() {}
var bar = 42
typealias TA = String
@@ -0,0 +1,15 @@
@file:Suppress("UNUSED_VARIABLE")
package usage
import a.*
fun baz(param: A) {
val constructor = A()
val methodCall = param.hashCode()
val supertype = object : A() {}
val x = foo()
val y = bar
bar = 239
val z: TA = ""
}
@@ -316,12 +316,12 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
KotlinTestUtils.assertEqualsToFile(new File(getTestDataDirectory(), "output.txt"), normalizeOutput(output));
}
@SuppressWarnings("deprecation")
private void doTestPreReleaseKotlinLibrary(
@NotNull CLICompiler<?> compiler,
@NotNull String libraryName,
@NotNull File destination,
@NotNull File result,
@NotNull File usageDestination,
@NotNull String... additionalOptions
) throws Exception {
// Compiles the library with the "pre-release" flag, then compiles a usage of this library in the release mode
@@ -337,7 +337,7 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
Pair<String, ExitCode> output;
try {
System.setProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY, "false");
output = compileKotlin(compiler, "source.kt", tmpdir, Arrays.asList(additionalOptions), result);
output = compileKotlin(compiler, "source.kt", usageDestination, Arrays.asList(additionalOptions), result);
}
finally {
System.clearProperty(TEST_IS_PRE_RELEASE_SYSTEM_PROPERTY);
@@ -459,19 +459,33 @@ public class CompileKotlinAgainstCustomBinariesTest extends TestCaseWithTmpdir {
public void testReleaseCompilerAgainstPreReleaseLibrary() throws Exception {
File destination = new File(tmpdir, "library.jar");
doTestPreReleaseKotlinLibrary(new K2JVMCompiler(), "library", destination, destination);
doTestPreReleaseKotlinLibrary(new K2JVMCompiler(), "library", destination, destination, tmpdir);
}
public void testReleaseCompilerAgainstPreReleaseLibraryJs() throws Exception {
doTestPreReleaseKotlinLibrary(new K2JSCompiler(), "library",
new File(tmpdir, "library.js"),
new File(tmpdir, "library.meta.js"));
doTestPreReleaseKotlinLibrary(
new K2JSCompiler(), "library",
new File(tmpdir, "library.js"), new File(tmpdir, "library.meta.js"),
new File(tmpdir, "usage.js")
);
}
public void testReleaseCompilerAgainstPreReleaseLibrarySkipVersionCheck() throws Exception {
File destination = new File(tmpdir, "library.jar");
doTestPreReleaseKotlinLibrary(new K2JVMCompiler(), "library", destination, destination,
"-Xskip-metadata-version-check");
doTestPreReleaseKotlinLibrary(
new K2JVMCompiler(), "library",
destination, destination, tmpdir,
"-Xskip-metadata-version-check"
);
}
public void testReleaseCompilerAgainstPreReleaseLibraryJsSkipVersionCheck() throws Exception {
doTestPreReleaseKotlinLibrary(
new K2JSCompiler(), "library",
new File(tmpdir, "library.js"), new File(tmpdir, "library.meta.js"),
new File(tmpdir, "usage.js"),
"-Xskip-metadata-version-check"
);
}
public void testWrongMetadataVersion() throws Exception {