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.trove4j"] = "1.0.20181211"
|
||||
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"
|
||||
extra["versions.kotlinx-collections-immutable"] = immutablesVersion
|
||||
extra["versions.kotlinx-collections-immutable-jvm"] = immutablesVersion
|
||||
|
||||
+2
@@ -2,6 +2,8 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
// IGNORE_DEXING
|
||||
// ^ https://issuetracker.google.com/issues/182339153
|
||||
|
||||
// FILE: Java.java
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// ^ D8 merges method references with empty closure created by 'invokedynamic'
|
||||
// FILE: test.kt
|
||||
|
||||
fun checkNotEqual(x: Any, y: Any) {
|
||||
if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal")
|
||||
fun checkNotEqual(marker: String, x: Any, y: Any) {
|
||||
if (x == y || y == x) throw AssertionError("$marker: $x and $y should NOT be equal")
|
||||
}
|
||||
|
||||
private fun id(f: Runnable): Any = f
|
||||
@@ -15,15 +17,15 @@ fun adapted2(vararg s: String): String = s[0]
|
||||
|
||||
fun box(): String {
|
||||
// Since 1.0, SAM wrappers for Java do not implement equals/hashCode
|
||||
checkNotEqual(id(::target1), id(::target1))
|
||||
checkNotEqual(id(::target1), target1FromOtherFile())
|
||||
checkNotEqual(id(::target1), id(::target2))
|
||||
checkNotEqual("id(::target1), id(::target1)", id(::target1), id(::target1))
|
||||
checkNotEqual("id(::target1), target1FromOtherFile()", id(::target1), target1FromOtherFile())
|
||||
checkNotEqual("id(::target1), id(::target2)", id(::target1), id(::target2))
|
||||
|
||||
checkNotEqual(id(::adapted1), id(::adapted1))
|
||||
checkNotEqual(id(::adapted1), adapted1FromOtherFile())
|
||||
checkNotEqual(id(::adapted2), id(::adapted2))
|
||||
checkNotEqual(id(::adapted2), adapted2FromOtherFile())
|
||||
checkNotEqual(id(::adapted1), id(::adapted2))
|
||||
checkNotEqual("id(::adapted1), id(::adapted1)", id(::adapted1), id(::adapted1))
|
||||
checkNotEqual("id(::adapted1), adapted1FromOtherFile()", id(::adapted1), adapted1FromOtherFile())
|
||||
checkNotEqual("id(::adapted2), id(::adapted2)", id(::adapted2), id(::adapted2))
|
||||
checkNotEqual("id(::adapted2), adapted2FromOtherFile()", id(::adapted2), adapted2FromOtherFile())
|
||||
checkNotEqual("id(::adapted1), id(::adapted2)", id(::adapted1), id(::adapted2))
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// ^ D8 merges method references with empty closure created by 'invokedynamic'
|
||||
|
||||
fun checkNotEqual(x: Any, y: Any) {
|
||||
if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal")
|
||||
fun checkNotEqual(marker: String, x: Any, y: Any) {
|
||||
if (x == y || y == x) throw AssertionError("$marker: $x and $y should NOT be equal")
|
||||
}
|
||||
|
||||
private fun id(f: Runnable): Any = f
|
||||
@@ -12,17 +14,17 @@ fun box(): String {
|
||||
fun local1() {}
|
||||
fun local2() {}
|
||||
|
||||
checkNotEqual(id(::local1), id(::local1))
|
||||
checkNotEqual(id(::local1), id(::local2))
|
||||
checkNotEqual("id(::local1), id(::local1)", id(::local1), id(::local1))
|
||||
checkNotEqual("id(::local1), id(::local2)", id(::local1), id(::local2))
|
||||
|
||||
fun String.localExt() {}
|
||||
|
||||
checkNotEqual(id("A"::localExt), id("A"::localExt))
|
||||
checkNotEqual(id("A"::localExt), id("B"::localExt))
|
||||
checkNotEqual("id(\"A\"::localExt), id(\"A\"::localExt)", id("A"::localExt), id("A"::localExt))
|
||||
checkNotEqual("id(\"A\"::localExt), id(\"B\"::localExt)", id("A"::localExt), id("B"::localExt))
|
||||
|
||||
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"
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// FULL_JDK
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_DEXING
|
||||
// ^ 2.1.75 fails with AssertionError (2.0.88 doesn't). TODO: investigate in more detail.
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
+16
-2
@@ -6,6 +6,8 @@
|
||||
package org.jetbrains.kotlin.test.backend.handlers
|
||||
|
||||
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.IGNORE_DEXING
|
||||
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.TestModule
|
||||
import org.jetbrains.kotlin.test.services.TestServices
|
||||
import org.jetbrains.kotlin.test.services.jvm.compiledClassesManager
|
||||
|
||||
class DxCheckerHandler(testServices: TestServices) : JvmBinaryArtifactHandler(testServices) {
|
||||
override val directivesContainers: List<DirectivesContainer>
|
||||
@@ -20,12 +23,23 @@ class DxCheckerHandler(testServices: TestServices) : JvmBinaryArtifactHandler(te
|
||||
|
||||
override fun processModule(module: TestModule, info: BinaryArtifacts.Jvm) {
|
||||
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 {
|
||||
D8Checker.check(info.classFileFactory)
|
||||
} catch (e: Throwable) {
|
||||
if (reportProblems) {
|
||||
if (!GeneratorsFileUtil.isTeamCityBuild &&
|
||||
module.targetBackend !in module.directives[CodegenTestDirectives.IGNORE_BACKEND]
|
||||
) {
|
||||
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())
|
||||
} catch (_: Throwable) {
|
||||
// In FIR we have factory which can't print bytecode
|
||||
|
||||
@@ -27,22 +27,21 @@ public class D8Checker {
|
||||
|
||||
public static void check(ClassFileFactory outputFiles) {
|
||||
if (!RUN_D8_CHECKER) return;
|
||||
runD8(builder -> addOutputFiles(builder, outputFiles));
|
||||
}
|
||||
|
||||
runD8(builder -> {
|
||||
for (OutputFile file : ClassFileUtilsKt.getClassFiles(outputFiles)) {
|
||||
byte[] bytes = file.asByteArray();
|
||||
builder.addClassProgramData(bytes, new PathOrigin(Paths.get(file.getRelativePath())));
|
||||
}
|
||||
});
|
||||
private static void addOutputFiles(D8Command.Builder builder, ClassFileFactory outputFiles) {
|
||||
for (OutputFile file : ClassFileUtilsKt.getClassFiles(outputFiles)) {
|
||||
byte[] bytes = file.asByteArray();
|
||||
builder.addClassProgramData(bytes, new PathOrigin(Paths.get(file.getRelativePath())));
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkFilesWithD8(Collection<Pair<byte[], String>> classFiles) {
|
||||
if (!RUN_D8_CHECKER) return;
|
||||
runD8(builder -> {
|
||||
classFiles.forEach(pair -> {
|
||||
builder.addClassProgramData(pair.getFirst(), new PathOrigin(Paths.get(pair.getSecond())));
|
||||
});
|
||||
});
|
||||
runD8(builder -> classFiles.forEach(
|
||||
pair -> 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.
|
||||
@@ -82,8 +81,7 @@ public class D8Checker {
|
||||
StringWriter writer = new StringWriter();
|
||||
try (PrintWriter printWriter = new PrintWriter(writer)) {
|
||||
e.printStackTrace(printWriter);
|
||||
String stackTrace = writer.toString();
|
||||
return stackTrace;
|
||||
return writer.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user