Skip to content

Commit 2feff47

Browse files
committed
feat: Modularize project structure
This commit refactors the project into a modular architecture, separating concerns into `core` and `feature` modules, each with distinct `data`, `domain`, and `presentation` layers. This modularization improves scalability, maintainability, and build times. - **feat(project)**: Introduced a multi-module architecture with `core` and `feature` modules. - **feat(build)**: Configured Gradle build scripts (`build.gradle.kts`, `settings.gradle.kts`, `gradle/libs.versions.toml`) to support the new KMP module structure. - **feat(modules)**: Added boilerplate code, including `Platform` implementations, test files, `.gitignore`, and `AndroidManifest.xml` for each new module.
1 parent a7de040 commit 2feff47

241 files changed

Lines changed: 4743 additions & 1 deletion

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

β€Žbuild.gradle.ktsβ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ plugins {
55
alias(libs.plugins.composeMultiplatform) apply false
66
alias(libs.plugins.composeCompiler) apply false
77
alias(libs.plugins.kotlinMultiplatform) apply false
8+
alias(libs.plugins.android.kotlin.multiplatform.library) apply false
9+
alias(libs.plugins.android.lint) apply false
810
}

β€Žcore/data/.gitignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

β€Žcore/data/build.gradle.ktsβ€Ž

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
plugins {
2+
alias(libs.plugins.kotlinMultiplatform)
3+
alias(libs.plugins.android.kotlin.multiplatform.library)
4+
alias(libs.plugins.android.lint)
5+
}
6+
7+
kotlin {
8+
9+
// Target declarations - add or remove as needed below. These define
10+
// which platforms this KMP module supports.
11+
// See: https://kotlinlang.org/docs/multiplatform-discover-project.html#targets
12+
androidLibrary {
13+
namespace = "zed.rainxch.core.data"
14+
compileSdk {
15+
version = release(36) {
16+
minorApiLevel = 1
17+
}
18+
}
19+
minSdk = 26
20+
21+
withHostTestBuilder {
22+
}
23+
24+
withDeviceTestBuilder {
25+
sourceSetTreeName = "test"
26+
}.configure {
27+
instrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
28+
}
29+
}
30+
31+
// For iOS targets, this is also where you should
32+
// configure native binary output. For more information, see:
33+
// https://kotlinlang.org/docs/multiplatform-build-native-binaries.html#build-xcframeworks
34+
35+
// A step-by-step guide on how to include this library in an XCode
36+
// project can be found here:
37+
// https://developer.android.com/kotlin/multiplatform/migrate
38+
val xcfName = "core:dataKit"
39+
40+
iosX64 {
41+
binaries.framework {
42+
baseName = xcfName
43+
}
44+
}
45+
46+
iosArm64 {
47+
binaries.framework {
48+
baseName = xcfName
49+
}
50+
}
51+
52+
iosSimulatorArm64 {
53+
binaries.framework {
54+
baseName = xcfName
55+
}
56+
}
57+
58+
// Source set declarations.
59+
// Declaring a target automatically creates a source set with the same name. By default, the
60+
// Kotlin Gradle Plugin creates additional source sets that depend on each other, since it is
61+
// common to share sources between related targets.
62+
// See: https://kotlinlang.org/docs/multiplatform-hierarchy.html
63+
sourceSets {
64+
commonMain {
65+
dependencies {
66+
implementation(libs.kotlin.stdlib)
67+
// Add KMP dependencies here
68+
}
69+
}
70+
71+
commonTest {
72+
dependencies {
73+
implementation(libs.kotlin.test)
74+
}
75+
}
76+
77+
androidMain {
78+
dependencies {
79+
// Add Android-specific dependencies here. Note that this source set depends on
80+
// commonMain by default and will correctly pull the Android artifacts of any KMP
81+
// dependencies declared in commonMain.
82+
}
83+
}
84+
85+
getByName("androidDeviceTest") {
86+
dependencies {
87+
implementation(libs.androidx.runner)
88+
implementation(libs.androidx.core)
89+
implementation(libs.androidx.junit)
90+
}
91+
}
92+
93+
iosMain {
94+
dependencies {
95+
// Add iOS-specific dependencies here. This a source set created by Kotlin Gradle
96+
// Plugin (KGP) that each specific iOS target (e.g., iosX64) depends on as
97+
// part of KMP’s default source set hierarchy. Note that this source set depends
98+
// on common by default and will correctly pull the iOS artifacts of any
99+
// KMP dependencies declared in commonMain.
100+
}
101+
}
102+
}
103+
104+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package zed.rainxch.core.data
2+
3+
import androidx.test.platform.app.InstrumentationRegistry
4+
import androidx.test.ext.junit.runners.AndroidJUnit4
5+
6+
import org.junit.Test
7+
import org.junit.runner.RunWith
8+
9+
import org.junit.Assert.*
10+
11+
/**
12+
* Instrumented test, which will execute on an Android device.
13+
*
14+
* See [testing documentation](http://d.android.com/tools/testing).
15+
*/
16+
@RunWith(AndroidJUnit4::class)
17+
class ExampleInstrumentedTest {
18+
@Test
19+
fun useAppContext() {
20+
// Context of the app under test.
21+
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22+
assertEquals("zed.rainxch.core.data.test", appContext.packageName)
23+
}
24+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package zed.rainxch.core.data
2+
3+
import kotlin.test.Test
4+
import kotlin.test.assertEquals
5+
6+
/**
7+
* Example local unit test, which will execute on the development machine (host).
8+
*
9+
* See [testing documentation](http://d.android.com/tools/testing).
10+
*/
11+
class ExampleUnitTest {
12+
@Test
13+
fun addition_isCorrect() {
14+
assertEquals(4, 2 + 2)
15+
}
16+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
</manifest>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package zed.rainxch.core.data
2+
3+
actual fun platform() = "Android"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package zed.rainxch.core.data
2+
3+
expect fun platform(): String
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package zed.rainxch.core.data
2+
3+
actual fun platform() = "iOS"

β€Žcore/domain/.gitignoreβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

0 commit comments

Comments
Β (0)