Skip to content

Commit

Permalink
Merge pull request #1011 from angelix/ave-fix-kotlin
Browse files Browse the repository at this point in the history
Enable Atomicfu transformations & instrumented tests
  • Loading branch information
roeierez authored Jun 19, 2024
2 parents 88d83e1 + bddfe06 commit 7c002aa
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
2 changes: 2 additions & 0 deletions libs/sdk-bindings/bindings-kotlin-multiplatform/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ gen-external-apklibs

# End of https://www.toptal.com/developers/gitignore/api/android

.kotlin/

breez-sdk-kmp/src/androiddMain/jniLibs/
breez-sdk-kmp/src/jvmMain/jniLibs/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,21 @@ kotlin {
}

val jvmMain by getting {
dependsOn(commonMain)
dependencies {
implementation(libs.jna)
}
}

val androidMain by getting {
dependsOn(commonMain)
dependencies {
implementation("${libs.jna.get()}@aar")
implementation(libs.atomicfu)
}
}

val androidInstrumentedTest by getting {
dependencies {
implementation(libs.test.junit.ktx)
implementation(libs.test.runner)
}
}
}
Expand All @@ -90,6 +94,9 @@ android {
defaultConfig {
minSdk = 21
consumerProguardFiles("consumer-rules.pro")

testApplicationId = "technology.breez.test"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}

compileOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import androidx.test.ext.junit.runners.AndroidJUnit4
import breez_sdk.LogEntry
import breez_sdk.LogStream
import breez_sdk.setLogStream
import org.junit.Test
import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class InstrumentedTest {
@Test
fun simpleTest() {
setLogStream(object : LogStream {
override fun log(l: LogEntry) {
println(l.line)
}
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ kotlin.code.style=official
android.useAndroidX=true
android.nonTransitiveRClass=true

#Atomicfu
# for JVM IR transformation
kotlinx.atomicfu.enableJvmIrTransformation=true
# for Native IR transformation
kotlinx.atomicfu.enableNativeIrTransformation=true

#MPP
kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.androidSourceSetLayoutVersion=2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
[versions]
atomicfu = "0.24.0"
android-gradle-plugin = "8.4.1"
android-gradle-plugin = "8.4.2"
jna = "5.14.0"
junit = "1.1.5"
kotlin = "1.9.24"
kotlinx-datetime = "0.6.0"
okio = "3.9.0"
test-junit-ktx = "1.1.5"
test-runner = "1.5.2"

[libraries]
atomicfu = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu" }
android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "android-gradle-plugin" }
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junit" }
jna = { module = "net.java.dev.jna:jna", version.ref = "jna" }
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime" }
okio = { module = "com.squareup.okio:okio", version.ref = "okio" }
test-junit-ktx = { group = "androidx.test.ext", name = "junit-ktx", version.ref = "test-junit-ktx" }
test-runner = { module = "androidx.test:runner", version.ref = "test-runner" }

[plugins]
androidLibrary = { id = "com.android.library", version.ref = "android-gradle-plugin" }
Expand Down

0 comments on commit 7c002aa

Please sign in to comment.