Bump d8 used in box tests to 2.1.75
This commit is contained in:
committed by
TeamCityServer
parent
737fbe271f
commit
0cca07fa19
+1
-1
@@ -182,7 +182,7 @@ extra["versions.jflex"] = "1.7.0"
|
|||||||
extra["versions.markdown"] = "0.1.25"
|
extra["versions.markdown"] = "0.1.25"
|
||||||
extra["versions.trove4j"] = "1.0.20181211"
|
extra["versions.trove4j"] = "1.0.20181211"
|
||||||
extra["versions.completion-ranking-kotlin"] = "0.1.3"
|
extra["versions.completion-ranking-kotlin"] = "0.1.3"
|
||||||
extra["versions.r8"] = "2.0.88"
|
extra["versions.r8"] = "2.1.75"
|
||||||
val immutablesVersion = "0.3.1"
|
val immutablesVersion = "0.3.1"
|
||||||
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
|
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
|
||||||
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||||
|
|||||||
+2
@@ -2,6 +2,8 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
// WITH_RUNTIME
|
// WITH_RUNTIME
|
||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
|
// IGNORE_DEXING
|
||||||
|
// ^ https://issuetracker.google.com/issues/182339153
|
||||||
|
|
||||||
// FILE: Java.java
|
// FILE: Java.java
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
// IGNORE_BACKEND: ANDROID
|
||||||
|
// ^ D8 merges method references with empty closure created by 'invokedynamic'
|
||||||
// FILE: test.kt
|
// FILE: test.kt
|
||||||
|
|
||||||
fun checkNotEqual(x: Any, y: Any) {
|
fun checkNotEqual(marker: String, x: Any, y: Any) {
|
||||||
if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal")
|
if (x == y || y == x) throw AssertionError("$marker: $x and $y should NOT be equal")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun id(f: Runnable): Any = f
|
private fun id(f: Runnable): Any = f
|
||||||
@@ -15,15 +17,15 @@ fun adapted2(vararg s: String): String = s[0]
|
|||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
// Since 1.0, SAM wrappers for Java do not implement equals/hashCode
|
// Since 1.0, SAM wrappers for Java do not implement equals/hashCode
|
||||||
checkNotEqual(id(::target1), id(::target1))
|
checkNotEqual("id(::target1), id(::target1)", id(::target1), id(::target1))
|
||||||
checkNotEqual(id(::target1), target1FromOtherFile())
|
checkNotEqual("id(::target1), target1FromOtherFile()", id(::target1), target1FromOtherFile())
|
||||||
checkNotEqual(id(::target1), id(::target2))
|
checkNotEqual("id(::target1), id(::target2)", id(::target1), id(::target2))
|
||||||
|
|
||||||
checkNotEqual(id(::adapted1), id(::adapted1))
|
checkNotEqual("id(::adapted1), id(::adapted1)", id(::adapted1), id(::adapted1))
|
||||||
checkNotEqual(id(::adapted1), adapted1FromOtherFile())
|
checkNotEqual("id(::adapted1), adapted1FromOtherFile()", id(::adapted1), adapted1FromOtherFile())
|
||||||
checkNotEqual(id(::adapted2), id(::adapted2))
|
checkNotEqual("id(::adapted2), id(::adapted2)", id(::adapted2), id(::adapted2))
|
||||||
checkNotEqual(id(::adapted2), adapted2FromOtherFile())
|
checkNotEqual("id(::adapted2), adapted2FromOtherFile()", id(::adapted2), adapted2FromOtherFile())
|
||||||
checkNotEqual(id(::adapted1), id(::adapted2))
|
checkNotEqual("id(::adapted1), id(::adapted2)", id(::adapted1), id(::adapted2))
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
// IGNORE_BACKEND: ANDROID
|
||||||
|
// ^ D8 merges method references with empty closure created by 'invokedynamic'
|
||||||
|
|
||||||
fun checkNotEqual(x: Any, y: Any) {
|
fun checkNotEqual(marker: String, x: Any, y: Any) {
|
||||||
if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal")
|
if (x == y || y == x) throw AssertionError("$marker: $x and $y should NOT be equal")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun id(f: Runnable): Any = f
|
private fun id(f: Runnable): Any = f
|
||||||
@@ -12,17 +14,17 @@ fun box(): String {
|
|||||||
fun local1() {}
|
fun local1() {}
|
||||||
fun local2() {}
|
fun local2() {}
|
||||||
|
|
||||||
checkNotEqual(id(::local1), id(::local1))
|
checkNotEqual("id(::local1), id(::local1)", id(::local1), id(::local1))
|
||||||
checkNotEqual(id(::local1), id(::local2))
|
checkNotEqual("id(::local1), id(::local2)", id(::local1), id(::local2))
|
||||||
|
|
||||||
fun String.localExt() {}
|
fun String.localExt() {}
|
||||||
|
|
||||||
checkNotEqual(id("A"::localExt), id("A"::localExt))
|
checkNotEqual("id(\"A\"::localExt), id(\"A\"::localExt)", id("A"::localExt), id("A"::localExt))
|
||||||
checkNotEqual(id("A"::localExt), id("B"::localExt))
|
checkNotEqual("id(\"A\"::localExt), id(\"B\"::localExt)", id("A"::localExt), id("B"::localExt))
|
||||||
|
|
||||||
fun adapted(default: String? = "", vararg va: Int): Int = 0
|
fun adapted(default: String? = "", vararg va: Int): Int = 0
|
||||||
|
|
||||||
checkNotEqual(id(::adapted), id(::adapted))
|
checkNotEqual("id(::adapted), id(::adapted)", id(::adapted), id(::adapted))
|
||||||
|
|
||||||
return "OK"
|
return "OK"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
// FULL_JDK
|
// FULL_JDK
|
||||||
// TARGET_BACKEND: JVM
|
// TARGET_BACKEND: JVM
|
||||||
|
// IGNORE_DEXING
|
||||||
|
// ^ 2.1.75 fails with AssertionError (2.0.88 doesn't). TODO: investigate in more detail.
|
||||||
// FILE: 1.kt
|
// FILE: 1.kt
|
||||||
|
|
||||||
package test
|
package test
|
||||||
|
|||||||
+16
-2
@@ -6,6 +6,8 @@
|
|||||||
package org.jetbrains.kotlin.test.backend.handlers
|
package org.jetbrains.kotlin.test.backend.handlers
|
||||||
|
|
||||||
import org.jetbrains.kotlin.codegen.D8Checker
|
import org.jetbrains.kotlin.codegen.D8Checker
|
||||||
|
import org.jetbrains.kotlin.codegen.getClassFiles
|
||||||
|
import org.jetbrains.kotlin.generators.util.GeneratorsFileUtil
|
||||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives
|
||||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_DEXING
|
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.IGNORE_DEXING
|
||||||
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.RUN_DEX_CHECKER
|
import org.jetbrains.kotlin.test.directives.CodegenTestDirectives.RUN_DEX_CHECKER
|
||||||
@@ -13,6 +15,7 @@ import org.jetbrains.kotlin.test.directives.model.DirectivesContainer
|
|||||||
import org.jetbrains.kotlin.test.model.BinaryArtifacts
|
import org.jetbrains.kotlin.test.model.BinaryArtifacts
|
||||||
import org.jetbrains.kotlin.test.model.TestModule
|
import org.jetbrains.kotlin.test.model.TestModule
|
||||||
import org.jetbrains.kotlin.test.services.TestServices
|
import org.jetbrains.kotlin.test.services.TestServices
|
||||||
|
import org.jetbrains.kotlin.test.services.jvm.compiledClassesManager
|
||||||
|
|
||||||
class DxCheckerHandler(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) {
|
class DxCheckerHandler(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) {
|
||||||
override val directivesContainers: List<DirectivesContainer>
|
override val directivesContainers: List<DirectivesContainer>
|
||||||
@@ -20,12 +23,23 @@ class DxCheckerHandler(testServices: TestServices) : JvmBinaryArtifactHandler(te
|
|||||||
|
|
||||||
override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) {
|
override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) {
|
||||||
if (RUN_DEX_CHECKER !in module.directives || IGNORE_DEXING in module.directives) return
|
if (RUN_DEX_CHECKER !in module.directives || IGNORE_DEXING in module.directives) return
|
||||||
val reportProblems = module.targetBackend !in module.directives[CodegenTestDirectives.IGNORE_BACKEND]
|
val compiledClassesManager = testServices.compiledClassesManager
|
||||||
try {
|
try {
|
||||||
D8Checker.check(info.classFileFactory)
|
D8Checker.check(info.classFileFactory)
|
||||||
} catch (e: Throwable) {
|
} catch (e: Throwable) {
|
||||||
if (reportProblems) {
|
if (!GeneratorsFileUtil.isTeamCityBuild &&
|
||||||
|
module.targetBackend !in module.directives[CodegenTestDirectives.IGNORE_BACKEND]
|
||||||
|
) {
|
||||||
try {
|
try {
|
||||||
|
val javaDir = compiledClassesManager.getCompiledJavaDirForModule(module)
|
||||||
|
if (javaDir != null) {
|
||||||
|
println("Compiled Java files: ${javaDir.absolutePath}")
|
||||||
|
}
|
||||||
|
val kotlinDir = compiledClassesManager.getCompiledKotlinDirForModule(module)
|
||||||
|
println("Compiled Kotlin files: ${kotlinDir.absolutePath}")
|
||||||
|
info.classFileFactory.getClassFiles().forEach {
|
||||||
|
println(" * ${it.relativePath}")
|
||||||
|
}
|
||||||
println(info.classFileFactory.createText())
|
println(info.classFileFactory.createText())
|
||||||
} catch (_: Throwable) {
|
} catch (_: Throwable) {
|
||||||
// In FIR we have factory which can't print bytecode
|
// In FIR we have factory which can't print bytecode
|
||||||
|
|||||||
@@ -27,22 +27,21 @@ public class D8Checker {
|
|||||||
|
|
||||||
public static void check(ClassFileFactory outputFiles) {
|
public static void check(ClassFileFactory outputFiles) {
|
||||||
if (!RUN_D8_CHECKER) return;
|
if (!RUN_D8_CHECKER) return;
|
||||||
|
runD8(builder -> addOutputFiles(builder, outputFiles));
|
||||||
|
}
|
||||||
|
|
||||||
runD8(builder -> {
|
private static void addOutputFiles(D8Command.Builder builder, ClassFileFactory outputFiles) {
|
||||||
for (OutputFile file : ClassFileUtilsKt.getClassFiles(outputFiles)) {
|
for (OutputFile file : ClassFileUtilsKt.getClassFiles(outputFiles)) {
|
||||||
byte[] bytes = file.asByteArray();
|
byte[] bytes = file.asByteArray();
|
||||||
builder.addClassProgramData(bytes, new PathOrigin(Paths.get(file.getRelativePath())));
|
builder.addClassProgramData(bytes, new PathOrigin(Paths.get(file.getRelativePath())));
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void checkFilesWithD8(Collection<Pair<byte[], String>> classFiles) {
|
public static void checkFilesWithD8(Collection<Pair<byte[], String>> classFiles) {
|
||||||
if (!RUN_D8_CHECKER) return;
|
if (!RUN_D8_CHECKER) return;
|
||||||
runD8(builder -> {
|
runD8(builder -> classFiles.forEach(
|
||||||
classFiles.forEach(pair -> {
|
pair -> builder.addClassProgramData(pair.getFirst(), new PathOrigin(Paths.get(pair.getSecond())))
|
||||||
builder.addClassProgramData(pair.getFirst(), new PathOrigin(Paths.get(pair.getSecond())));
|
));
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compilation with D8 should proceed with no output. There should be no info, warnings, or errors.
|
// Compilation with D8 should proceed with no output. There should be no info, warnings, or errors.
|
||||||
@@ -82,8 +81,7 @@ public class D8Checker {
|
|||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
try (PrintWriter printWriter = new PrintWriter(writer)) {
|
try (PrintWriter printWriter = new PrintWriter(writer)) {
|
||||||
e.printStackTrace(printWriter);
|
e.printStackTrace(printWriter);
|
||||||
String stackTrace = writer.toString();
|
return writer.toString();
|
||||||
return stackTrace;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user