Skip to content

Commit

Permalink
Add support for kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed Jan 28, 2023
1 parent 8e3592e commit b58ca21
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Documentation/technical/Kotlin_Policy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
### Kotlin Policy

xDrip supports both Java and Kotlin source files.

New class files in Java or Kotlin are accepted but there is no intention to convert existing Java files to Kotlin.

Kotlin classes should be mindful to maintain as much java compatibility as possible where they may need to interact with existing classes.

Overhead in terms of additional libraries and any performance related issues (such as threading and component lifecycle) should be carefully monitored.
7 changes: 6 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ buildscript {
apply plugin: 'com.android.application'
apply from: 'token-replace.gradle'
apply from: '../common.gradle'
apply plugin: 'kotlin-android'

if (project.file('local.gradle').exists()) {
apply from: 'local.gradle'
Expand Down Expand Up @@ -160,6 +161,7 @@ android {
exclude 'META-INF/NOTICE'
exclude 'org/apache/http/version.properties'
exclude 'org/apache/http/client/version.properties'
//exclude 'META-INF/androidx.core_core.version'
exclude 'META-INF/com.android.tools/proguard/coroutines.pro'
exclude 'META-INF/ASL2.0'
}
Expand Down Expand Up @@ -259,6 +261,9 @@ dependencies {
exclude group: 'androidx.core', module: 'core' // fix INotificationSideChannel // android.support.v4.app
}

//implementation 'androidx.core:core-ktx:1.9.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.7.21'

implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v13:26.1.0'
Expand Down Expand Up @@ -336,7 +341,7 @@ dependencies {
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.objenesis:objenesis:2.5.1'
testImplementation 'org.hamcrest:hamcrest-library:1.3'
testImplementation "org.robolectric:robolectric:4.2.1"
testImplementation "org.robolectric:robolectric:4.4.1"
testImplementation "com.google.truth:truth:1.1.3"

testImplementation 'org.mockito:mockito-core:2.4.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.eveningoutpost.dexdrip.utils.framework

/**
* JamOrHam
*
* Simple test to ensure compilation success
*/

class TestKot {

companion object {
@JvmStatic
fun compileOkay() : Boolean {
return true;
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.eveningoutpost.dexdrip.utils.framework

import org.junit.Assert.*

import org.junit.Test

class TestKotTest {

@Test
fun compileOkayTest() {
assert(TestKot.compileOkay())

}
}
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ buildscript {
classpath 'com.google.gms:google-services:4.3.3'
classpath 'com.github.jamorham:ReplaceTokenPreprocessor:1.5'
classpath 'com.google.android.gms:oss-licenses-plugin:0.9.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21"

apply plugin: 'java'
apply plugin: 'maven'
Expand Down

0 comments on commit b58ca21

Please sign in to comment.