From 14874078c01a2025c7ee7aaefbf29fb12e239d0f Mon Sep 17 00:00:00 2001 From: Agustin Grognetti Date: Mon, 8 Dec 2025 01:45:38 -0300 Subject: [PATCH] Add Kotlin to the project - Added the 'org.jetbrains.kotlin.android' plugin to all module build.gradle files and configured the Kotlin compiler JVM target to 1.8 in the root build.gradle. - Updated the buildscript to use Kotlin version 2.2.0 and included the Kotlin Gradle plugin classpath. --- build.gradle | 12 +++++++++++- contract-tests/build.gradle | 1 + example/build.gradle | 1 + launchdarkly-android-client-sdk/build.gradle | 1 + shared-test-code/build.gradle | 2 +- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index a7a1c579..48423ce0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,13 @@ -import java.time.Duration import com.android.build.gradle.BaseExtension +import org.jetbrains.kotlin.gradle.dsl.JvmTarget +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { + ext { + kotlin_version = '2.2.0' + } repositories { mavenCentral() google() @@ -14,6 +18,7 @@ buildscript { // For displaying method/field counts when building with Gradle: // https://github.com/KeepSafe/dexcount-gradle-plugin classpath("com.getkeepsafe.dexcount:dexcount-gradle-plugin:4.0.0") + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -71,6 +76,11 @@ subprojects { subproject -> plugins.withId("com.android.library") { configureAndroidModule(subproject) } + tasks.withType(KotlinCompile).configureEach { + compilerOptions { + jvmTarget = JvmTarget.JVM_1_8 + } + } tasks.withType(JavaCompile).configureEach { // enable deprecation checks options.compilerArgs += "-Xlint:deprecation" diff --git a/contract-tests/build.gradle b/contract-tests/build.gradle index dde0df0c..c716ab21 100644 --- a/contract-tests/build.gradle +++ b/contract-tests/build.gradle @@ -2,6 +2,7 @@ plugins { id("com.android.application") // make sure this line comes *after* you apply the Android plugin id("com.getkeepsafe.dexcount") + id 'org.jetbrains.kotlin.android' } android { diff --git a/example/build.gradle b/example/build.gradle index 797ab8d8..401e5acc 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -2,6 +2,7 @@ plugins { id("com.android.application") // make sure this line comes *after* you apply the Android plugin id("com.getkeepsafe.dexcount") + id 'org.jetbrains.kotlin.android' } android { diff --git a/launchdarkly-android-client-sdk/build.gradle b/launchdarkly-android-client-sdk/build.gradle index 5b1936f4..094a8324 100644 --- a/launchdarkly-android-client-sdk/build.gradle +++ b/launchdarkly-android-client-sdk/build.gradle @@ -3,6 +3,7 @@ plugins { id("signing") id("maven-publish") id("com.getkeepsafe.dexcount") + id 'org.jetbrains.kotlin.android' } group = "com.launchdarkly" diff --git a/shared-test-code/build.gradle b/shared-test-code/build.gradle index 4b3fe32e..15c8dd43 100644 --- a/shared-test-code/build.gradle +++ b/shared-test-code/build.gradle @@ -1,7 +1,7 @@ - plugins { id("com.android.library") id("com.getkeepsafe.dexcount") + id 'org.jetbrains.kotlin.android' } group = "com.launchdarkly"