Skip to content

Commit c434e49

Browse files
authored
build: Add Kotlin to the project (#317)
- 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. **Requirements** - [ ] I have added test coverage for new or changed functionality - [ ] I have followed the repository's [pull request submission guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests) - [ ] I have validated my changes against all supported platform versions **Describe the solution you've provided** I've added the Kotlin plugin and the configuration needed to be able to add Kotlin code in future PRs <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds Kotlin support to all modules and configures the Kotlin Gradle plugin with JVM target 1.8 in the root build. > > - **Build/Gradle**: > - Add Kotlin Gradle plugin (`kotlin_version = 2.2.0`) and classpath in root `build.gradle`. > - Configure `KotlinCompile` tasks with `jvmTarget = 1.8` for all subprojects. > - Apply `org.jetbrains.kotlin.android` plugin to `contract-tests`, `example`, `launchdarkly-android-client-sdk`, and `shared-test-code` modules. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 1487407. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
2 parents c447d32 + 1487407 commit c434e49

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

build.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
import java.time.Duration
21
import com.android.build.gradle.BaseExtension
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
34

45
// Top-level build file where you can add configuration options common to all sub-projects/modules.
56

67
buildscript {
8+
ext {
9+
kotlin_version = '2.2.0'
10+
}
711
repositories {
812
mavenCentral()
913
google()
@@ -14,6 +18,7 @@ buildscript {
1418
// For displaying method/field counts when building with Gradle:
1519
// https://github.com/KeepSafe/dexcount-gradle-plugin
1620
classpath("com.getkeepsafe.dexcount:dexcount-gradle-plugin:4.0.0")
21+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1722

1823
// NOTE: Do not place your application dependencies here; they belong
1924
// in the individual module build.gradle files
@@ -71,6 +76,11 @@ subprojects { subproject ->
7176
plugins.withId("com.android.library") {
7277
configureAndroidModule(subproject)
7378
}
79+
tasks.withType(KotlinCompile).configureEach {
80+
compilerOptions {
81+
jvmTarget = JvmTarget.JVM_1_8
82+
}
83+
}
7484
tasks.withType(JavaCompile).configureEach {
7585
// enable deprecation checks
7686
options.compilerArgs += "-Xlint:deprecation"

contract-tests/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id("com.android.application")
33
// make sure this line comes *after* you apply the Android plugin
44
id("com.getkeepsafe.dexcount")
5+
id 'org.jetbrains.kotlin.android'
56
}
67

78
android {

example/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ plugins {
22
id("com.android.application")
33
// make sure this line comes *after* you apply the Android plugin
44
id("com.getkeepsafe.dexcount")
5+
id 'org.jetbrains.kotlin.android'
56
}
67

78
android {

launchdarkly-android-client-sdk/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ plugins {
33
id("signing")
44
id("maven-publish")
55
id("com.getkeepsafe.dexcount")
6+
id 'org.jetbrains.kotlin.android'
67
}
78

89
group = "com.launchdarkly"

shared-test-code/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
21
plugins {
32
id("com.android.library")
43
id("com.getkeepsafe.dexcount")
4+
id 'org.jetbrains.kotlin.android'
55
}
66

77
group = "com.launchdarkly"

0 commit comments

Comments
 (0)