Enable Kotlin support

This commit is contained in:
José Rebelo
2025-07-06 21:16:45 +01:00
parent 23f4488852
commit c9812aac54
3 changed files with 18 additions and 8 deletions
+3
View File
@@ -8,6 +8,9 @@
# Java class files # Java class files
*.class *.class
# Kotlin build files
/.kotlin
# Generated files # Generated files
bin/ bin/
gen/ gen/
+13 -8
View File
@@ -3,6 +3,8 @@ import java.nio.file.Files
plugins { plugins {
id 'com.android.application' id 'com.android.application'
id 'com.google.protobuf' id 'com.google.protobuf'
id 'kotlin-android'
id 'kotlin-parcelize'
} }
tasks.withType(Test).configureEach { tasks.withType(Test).configureEach {
@@ -78,6 +80,10 @@ android {
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17
} }
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
}
namespace = 'nodomain.freeyourgadget.gadgetbridge' namespace = 'nodomain.freeyourgadget.gadgetbridge'
defaultConfig { defaultConfig {
@@ -223,15 +229,18 @@ dependencies {
testImplementation "org.robolectric:robolectric:4.15.1" testImplementation "org.robolectric:robolectric:4.15.1"
testImplementation "org.hamcrest:hamcrest-library:3.0" testImplementation "org.hamcrest:hamcrest-library:3.0"
implementation 'androidx.core:core-ktx:1.16.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:2.2.0"
implementation "androidx.appcompat:appcompat:1.7.1" implementation "androidx.appcompat:appcompat:1.7.1"
implementation "androidx.preference:preference:1.2.1" implementation "androidx.preference:preference-ktx:1.2.1"
implementation "androidx.cardview:cardview:1.0.0" implementation "androidx.cardview:cardview:1.0.0"
implementation "androidx.recyclerview:recyclerview:1.4.0" implementation "androidx.recyclerview:recyclerview:1.4.0"
implementation "androidx.legacy:legacy-support-v4:1.0.0" implementation "androidx.legacy:legacy-support-v4:1.0.0"
implementation "androidx.gridlayout:gridlayout:1.1.0" implementation "androidx.gridlayout:gridlayout:1.1.0"
implementation "androidx.palette:palette:1.0.0" implementation "androidx.palette:palette-ktx:1.0.0"
implementation "androidx.activity:activity:1.10.1" implementation "androidx.activity:activity-ktx:1.10.1"
implementation "androidx.fragment:fragment:1.8.8" implementation "androidx.fragment:fragment-ktx:1.8.8"
implementation "androidx.viewpager2:viewpager2:1.1.0" implementation "androidx.viewpager2:viewpager2:1.1.0"
// Not latest version because of https://github.com/material-components/material-components-android/issues/3924 // Not latest version because of https://github.com/material-components/material-components-android/issues/3924
@@ -276,10 +285,6 @@ dependencies {
// Android SDK bundles org.json, but we need an actual implementation to replace the stubs in tests // Android SDK bundles org.json, but we need an actual implementation to replace the stubs in tests
testImplementation 'org.json:json:20250517' testImplementation 'org.json:json:20250517'
// Fix Duplicate class build error for conflicting kotlin-stdlib versions
// does not seem to be currently needed, as it uses the latest across all transitive
//implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
// Needed for Armenian transliteration // Needed for Armenian transliteration
implementation 'org.ahocorasick:ahocorasick:0.6.3' implementation 'org.ahocorasick:ahocorasick:0.6.3'
} }
+2
View File
@@ -1,6 +1,7 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '2.2.0'
repositories { repositories {
mavenCentral() mavenCentral()
google() google()
@@ -9,6 +10,7 @@ buildscript {
} }
} }
dependencies { dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:8.11.0' classpath 'com.android.tools.build:gradle:8.11.0'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.5' classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.5'