@@ -261,33 +261,13 @@ android {
261261 }
262262
263263 if (cordovaConfig. IS_GRADLE_PLUGIN_KOTLIN_ENABLED ) {
264- if (cordovaConfig. KOTLIN_JVM_TARGET == null ) {
265- // If the value is null, fallback to JAVA_TARGET_COMPATIBILITY,
266- // as they generally should be equal
267- def javaTarget = JavaLanguageVersion . of(cordovaConfig. JAVA_TARGET_COMPATIBILITY )
268-
269- // check if javaTarget is <= 8; if so, we need to prefix it with "1."
270- // Starting with 9 and later, the value can be used as is.
271- if (javaTarget. compareTo(JavaLanguageVersion . of(8 )) <= 0 ) {
272- javaTarget = " 1." + javaTarget
273- }
274-
275- cordovaConfig. KOTLIN_JVM_TARGET = javaTarget
276- }
277-
278- // Similar to above, check if kotlin target is <= 8, if so prefix it.
279- // This allows the user to use consistent set of values in config.xml
280- // Rather than having to be aware whether the "1."" prefix is needed.
281- // This check is only done if the value isn't already prefixed with 1.
282- if (
283- ! cordovaConfig. KOTLIN_JVM_TARGET . startsWith(" 1." ) &&
284- JavaLanguageVersion . of(cordovaConfig. KOTLIN_JVM_TARGET ). compareTo(JavaLanguageVersion . of(8 )) <= 0
285- ) {
286- cordovaConfig. KOTLIN_JVM_TARGET = " 1." + cordovaConfig. KOTLIN_JVM_TARGET
287- }
264+ // If KOTLIN_JVM_TARGET is null, fallback to JAVA_TARGET_COMPATIBILITY,
265+ // as they generally should be equal
266+ cordovaConfig. KOTLIN_JVM_TARGET = cordovaConfig. KOTLIN_JVM_TARGET ?:
267+ cordovaConfig. JAVA_TARGET_COMPATIBILITY
288268
289269 kotlinOptions {
290- jvmTarget = cordovaConfig. KOTLIN_JVM_TARGET
270+ jvmTarget = JavaLanguageVersion . of( cordovaConfig. KOTLIN_JVM_TARGET )
291271 }
292272 }
293273
0 commit comments