Support JVM 8 target on Android
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
ext {
|
||||
isD8Enabled = project.findProperty('android.enableD8').toBoolean()
|
||||
}
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
@@ -58,6 +60,12 @@ android {
|
||||
resultsDir = "build/test/results"
|
||||
}
|
||||
|
||||
if (isD8Enabled) {
|
||||
compileOptions {
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
}
|
||||
}
|
||||
|
||||
flavorDimensions "box"
|
||||
|
||||
@@ -77,6 +85,17 @@ android {
|
||||
reflect0 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
|
||||
if (isD8Enabled) {
|
||||
jvm80 {
|
||||
dimension "box"
|
||||
}
|
||||
|
||||
reflectjvm80 {
|
||||
dimension "box"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ class CodegenTestsOnAndroidRunner private constructor(private val pathManager: P
|
||||
testCases.forEach { aCase -> suite.addTest(aCase) }
|
||||
Assert.assertNotEquals("There is no test results in report", 0, testCases.size.toLong())
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
} catch (e: Throwable) {
|
||||
throw RuntimeException("Can't parse test results in $reportFolder\n$resultOutput", e)
|
||||
}
|
||||
}
|
||||
|
||||
+6
-4
@@ -276,11 +276,13 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
if (fullFileText.contains("@file:JvmPackageName(")) continue
|
||||
// TODO: Support jvm assertions
|
||||
if (fullFileText.contains("// KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm")) continue
|
||||
val targets = InTextDirectivesUtils.findLinesWithPrefixesRemoved(fullFileText, "// JVM_TARGET:")
|
||||
.also { it.remove(JvmTarget.JVM_1_6.description) }
|
||||
|
||||
// TODO: support JVM 8 test with D8
|
||||
if (fullFileText.contains("// JVM_TARGET")) continue
|
||||
|
||||
val isJvm8Target = false
|
||||
val isJvm8Target =
|
||||
if (targets.isEmpty()) false
|
||||
else if (targets.contains(JvmTarget.JVM_1_8.description) && targets.size == 1) true
|
||||
else continue //TODO: support other targets on Android
|
||||
|
||||
// TODO: support SKIP_JDK6 on new platforms
|
||||
if (fullFileText.contains("// SKIP_JDK6")) continue
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_REFLECT
|
||||
// FULL_JDK
|
||||
|
||||
+4
@@ -1,6 +1,10 @@
|
||||
// KOTLIN_CONFIGURATION_FLAGS: +JVM.EMIT_JVM_TYPE_ANNOTATIONS
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
|
||||
// No virtual method getAnnotatedReturnType()Ljava/lang/reflect/AnnotatedType
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// WITH_REFLECT
|
||||
// FULL_JDK
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
+4
@@ -1,6 +1,10 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// JVM_TARGET: 1.8
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// NoSuchMethodError: java.util.List.stream
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// FULL_JDK
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: all-compatibility
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: all-compatibility
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_REFLECT
|
||||
// FULL_JDK
|
||||
@@ -50,5 +51,5 @@ fun checkNoMethod(clazz: Class<*>, name: String) {
|
||||
catch (e: NoSuchMethodException) {
|
||||
return
|
||||
}
|
||||
throw AssertionError("fail " + clazz)
|
||||
throw AssertionError("fail: method $name was found in " + clazz)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
|
||||
+1
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: all
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
Vendored
+1
@@ -1,6 +1,7 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
// FULL_JDK
|
||||
|
||||
+2
-1
@@ -2,6 +2,7 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
package test
|
||||
|
||||
interface Z {
|
||||
private fun privateFun() = { "OK" }
|
||||
@@ -49,7 +50,7 @@ fun box(): String {
|
||||
|
||||
val nested = Z.Nested::class.java
|
||||
val enclosingClass = nested.enclosingClass!!
|
||||
if (enclosingClass.name != "Z") return "fail 9: ${enclosingClass.name}"
|
||||
if (enclosingClass.name != "test.Z") return "fail 9: ${enclosingClass.name}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
|
||||
// java.lang.NoSuchMethodError: java.util.TreeMap.remove
|
||||
// IGNORE_BACKEND: ANDROID
|
||||
|
||||
// FULL_JDK
|
||||
// JVM_TARGET: 1.8
|
||||
|
||||
|
||||
Reference in New Issue
Block a user