Skip to content

Commit 1797fba

Browse files
authored
Migrate to kmp (#56)
* Create kmp structure project * Update agp to 8.8.2 * Fix shared module namespace * Fix detekt issues * Migrate whole project to KMP (android, iOS, wasmJs, desktop) * Refactor adaptive implementation by multiplatform api (window size class) * Refactor wasm-js * Update gitignore * Add yarn.lock file * Update libraries and fix run problems * Remove depends on in shared gradle module * Fix android platform tests * Remove un-used suppress * Update github actions * Remove swift install * Merge all github action configs * Fix iOS tests run * Fix relative path issue * Change schema of xcode build * Add xcode version * Specify xcode version * Revert iOS build scheme to Requestify * Add log for schemas * Change schema to iosApp * Change device for iosRun * Add kotlin kmp pre-build * Add a dummy to check ci * Change iOS gradle dependency * Revert "Remove depends on in shared gradle" * Remove ios-test job
1 parent 96ba19a commit 1797fba

138 files changed

Lines changed: 5547 additions & 418 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & Test
1+
name: Lint & Tests
22

33
on:
44
push:
@@ -32,7 +32,7 @@ jobs:
3232
- name: Static Analysis with lint
3333
run: ./gradlew clean lint
3434

35-
test:
35+
unit-test:
3636
runs-on: ubuntu-latest
3737
steps:
3838
- uses: actions/checkout@v3
@@ -45,11 +45,11 @@ jobs:
4545
- name: Grant execute permission for gradlew
4646
run: chmod +x gradlew
4747
- name: Run Tests with Gradle
48-
run: ./gradlew test
48+
run: ./gradlew allTests
4949

50-
androidTest:
50+
android-test:
5151
runs-on: ubuntu-latest
52-
timeout-minutes: 55
52+
timeout-minutes: 30
5353
strategy:
5454
matrix:
5555
api-level: [ 26, 30 ]
@@ -103,4 +103,4 @@ jobs:
103103
uses: actions/upload-artifact@v4
104104
with:
105105
name: test-reports-${{ matrix.api-level }}
106-
path: '**/build/reports/androidTests'
106+
path: '**/build/reports/androidTests'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ bin/
1313
gen/
1414
out/
1515
build/
16+
.kotlin
1617

1718
# Local configuration file (sdk path, etc)
1819
local.properties
File renamed without changes.
Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed
21
plugins {
32
alias(libs.plugins.androidApplication)
43
alias(libs.plugins.kotlinAndroid)
@@ -42,11 +41,11 @@ android {
4241
}
4342
}
4443
compileOptions {
45-
sourceCompatibility = JavaVersion.VERSION_1_8
46-
targetCompatibility = JavaVersion.VERSION_1_8
44+
sourceCompatibility = JavaVersion.VERSION_11
45+
targetCompatibility = JavaVersion.VERSION_11
4746
}
4847
kotlinOptions {
49-
jvmTarget = "1.8"
48+
jvmTarget = "11"
5049
}
5150
buildFeatures {
5251
compose = true
@@ -62,19 +61,11 @@ android {
6261
}
6362

6463
dependencies {
64+
implementation(project(":shared"))
6565

6666
implementation(libs.core.ktx)
67-
implementation(libs.lifecycle.runtime.ktx)
68-
implementation(libs.lifecycle.viewmodel.compose)
69-
implementation(libs.activity.compose)
70-
implementation(platform(libs.compose.bom))
71-
implementation(libs.ui)
72-
implementation(libs.ui.graphics)
73-
implementation(libs.ui.tooling.preview)
74-
implementation(libs.material3)
67+
implementation(libs.androidx.activity.compose)
7568
implementation(libs.coroutines)
76-
implementation(libs.androidx.window)
77-
implementation(libs.materialWindow)
7869
implementation(libs.navigation)
7970

8071
ksp(libs.kotlin.inject.ksp)
@@ -89,6 +80,5 @@ dependencies {
8980
androidTestImplementation(libs.espresso.core)
9081
androidTestImplementation(platform(libs.compose.bom))
9182
androidTestImplementation(libs.ui.test.junit4)
92-
debugImplementation(libs.ui.tooling)
9383
debugImplementation(libs.ui.test.manifest)
9484
}

app/src/androidTest/java/me/nasrabadiam/tictactoe/Helpers.kt renamed to androidApp/src/androidTest/java/me/nasrabadiam/tictactoe/Helpers.kt

File renamed without changes.

app/src/androidTest/java/me/nasrabadiam/tictactoe/NavigationTests.kt renamed to androidApp/src/androidTest/java/me/nasrabadiam/tictactoe/NavigationTests.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import androidx.compose.ui.test.hasContentDescription
55
import androidx.compose.ui.test.junit4.createComposeRule
66
import androidx.compose.ui.test.onNodeWithText
77
import androidx.compose.ui.test.performClick
8-
import androidx.lifecycle.SavedStateHandle
98
import me.nasrabadiam.tictactoe.game.GameUseCase
10-
import me.nasrabadiam.tictactoe.game.ui.GameViewModel
119
import me.nasrabadiam.tictactoe.home.HomeScreenTests.Companion.PLAY_WITH_A_FRIEND_BUTTON_TEXT
1210
import org.junit.Rule
1311
import org.junit.Test
@@ -18,11 +16,10 @@ class NavigationTests {
1816
val composeRule = createComposeRule()
1917

2018
private val gameUseCase = GameUseCase()
21-
private val gameViewModel = GameViewModel(gameUseCase, SavedStateHandle())
2219

2320
@Test
2421
fun whenClickedOnPlayWithAFriendShouldOpenGameScreenInSoloMode(): Unit = with(composeRule) {
25-
setContent { App(gameViewModel = { gameViewModel }) }
22+
setContent { App(gameUseCase = { gameUseCase }) }
2623
val playWithAFriendButton =
2724
onNode(hasContentDescription(PLAY_WITH_A_FRIEND_BUTTON_TEXT))
2825
playWithAFriendButton.performClick()
@@ -34,7 +31,7 @@ class NavigationTests {
3431

3532
@Test
3633
fun whenAppOpensShouldShowHomeRoute(): Unit = with(composeRule) {
37-
setContent { App(gameViewModel = { gameViewModel }) }
34+
setContent { App(gameUseCase = { gameUseCase }) }
3835
onNodeWithText(PLAY_WITH_A_FRIEND_BUTTON_TEXT).assertIsDisplayed()
3936
}
4037
}

0 commit comments

Comments
 (0)