Initial commit

This commit is contained in:
2025-09-26 11:00:51 -03:00
parent 7f3ee661a5
commit c6f1764a9d
10 changed files with 94 additions and 0 deletions

1
features/common/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

View File

@@ -0,0 +1,37 @@
plugins {
alias(libs.plugins.kotlinDevKit)
alias(libs.plugins.composeDevKit)
}
kotlin {
androidLibrary {
withHostTestBuilder {
}
withDeviceTestBuilder {
sourceSetTreeName = "test"
}.configure {
instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
}
sourceSets {
commonMain {
dependencies {
// Add KMP-specific dependencies here.
}
}
androidMain {
dependencies {
// Add Android-specific dependencies here.
}
}
iosMain {
dependencies {
// Add iOS-specific dependencies here.
}
}
}
}

View File

@@ -0,0 +1,21 @@
package dev.carlosmartino.common
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Test
import org.junit.runner.RunWith
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("dev.carlosmartino.common.test", appContext.packageName)
}
}

View File

@@ -0,0 +1,16 @@
package dev.carlosmartino.common
import kotlin.test.Test
import kotlin.test.assertEquals
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>

View File

@@ -0,0 +1,3 @@
package dev.carlosmartino.common
actual fun platform() = "Android"

View File

@@ -0,0 +1,3 @@
package dev.carlosmartino.common
expect fun platform(): String

View File

@@ -0,0 +1,3 @@
package dev.carlosmartino.common
actual fun platform() = "iOS"

View File

@@ -28,6 +28,8 @@ multiplatform-settings = "1.3.0"
moko-permissions = "0.20.1" moko-permissions = "0.20.1"
# Testing # Testing
junit = "4.13.2" junit = "4.13.2"
runner = "1.5.2"
core = "1.5.0"
[libraries] [libraries]
# Platform specific libraries # Platform specific libraries
@@ -43,6 +45,7 @@ kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serializa
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime"} kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "kotlinx-datetime"}
kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" }
compose-multiplatform-navigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "compose-multiplatform-navigation" } compose-multiplatform-navigation = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "compose-multiplatform-navigation" }
# Koin - Dependency Injection # Koin - Dependency Injection
@@ -83,6 +86,8 @@ kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotl
kotlin-testJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } kotlin-testJunit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
androidx-testExt-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-testExt" } androidx-testExt-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-testExt" }
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" } androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "androidx-espresso" }
androidx-runner = { group = "androidx.test", name = "runner", version.ref = "runner" }
androidx-core = { group = "androidx.test", name = "core", version.ref = "core" }
[plugins] [plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" } androidApplication = { id = "com.android.application", version.ref = "agp" }

View File

@@ -33,3 +33,4 @@ include(":app:composeApp")
include(":bedrock:designsystem") include(":bedrock:designsystem")
include(":bedrock:common") include(":bedrock:common")
include(":bedrock:navigation") include(":bedrock:navigation")
include(":common")