Skip to content

Commit 2edab74

Browse files
committed
refactor: setting of kotlin's jvmTarget
1 parent 4f8e7fa commit 2edab74

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

templates/project/app/build.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +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-
cordovaConfig.KOTLIN_JVM_TARGET = javaTarget
269-
}
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
270268

271269
kotlinOptions {
272-
jvmTarget = cordovaConfig.KOTLIN_JVM_TARGET
270+
jvmTarget = JavaLanguageVersion.of(cordovaConfig.KOTLIN_JVM_TARGET)
273271
}
274272
}
275273

0 commit comments

Comments
 (0)