-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from oikvpqya/dev/kmp-pr
feat: KMP (Kotlin Multiplatform) support
- Loading branch information
Showing
68 changed files
with
4,196 additions
and
908 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
push: | ||
paths-ignore: | ||
- '**.md' | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/actions/setup-gradle@v4 | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew assemble --no-daemon | ||
|
||
- name: Upload Debug APK | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: debug-apk | ||
path: | | ||
app/build/outputs/apk/debug/app-debug.apk | ||
- name: Upload Release APK | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-apk | ||
path: | | ||
app/build/outputs/apk/release/app-release.apk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,109 @@ | ||
import org.jetbrains.compose.desktop.application.dsl.TargetFormat | ||
|
||
plugins { | ||
id 'com.android.application' | ||
id 'kotlin-android' | ||
alias libs.plugins.android.application | ||
alias libs.plugins.compose.compiler | ||
alias libs.plugins.jetbrains.compose | ||
alias libs.plugins.kotlin.multiplatform | ||
alias libs.plugins.kotlin.serialization | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
androidTarget() | ||
jvm("desktop") | ||
|
||
wasmJs { | ||
moduleName = "composeApp" | ||
browser { | ||
commonWebpackConfig { | ||
outputFileName = "composeApp.js" | ||
} | ||
} | ||
binaries.executable() | ||
} | ||
|
||
sourceSets { | ||
androidMain { | ||
dependencies { | ||
implementation libs.androidx.core.ktx | ||
implementation libs.androidx.activity.compose | ||
implementation libs.squareup.okio | ||
implementation libs.xxfast.kstore.file | ||
} | ||
} | ||
|
||
commonMain { | ||
dependencies { | ||
implementation compose.material | ||
implementation compose.ui | ||
implementation libs.androidx.lifecycle.viewmodel.compose | ||
implementation libs.kotlinx.coroutines.core | ||
implementation libs.kotlinx.serialization.json | ||
implementation libs.xxfast.kstore.common | ||
} | ||
} | ||
|
||
desktopMain { | ||
dependencies { | ||
implementation compose.desktop.currentOs | ||
implementation libs.harawata.appdirs | ||
implementation libs.kotlinx.coroutines.swing | ||
implementation libs.squareup.okio | ||
implementation libs.xxfast.kstore.file | ||
} | ||
} | ||
|
||
wasmJsMain { | ||
dependencies { | ||
implementation libs.xxfast.kstore.storage | ||
} | ||
} | ||
} | ||
} | ||
|
||
android { | ||
compileSdkVersion 30 | ||
buildToolsVersion "30.0.2" | ||
compileSdk 34 | ||
namespace "com.alexjlockwood.twentyfortyeightcompose" | ||
|
||
defaultConfig { | ||
applicationId "com.alexjlockwood.twentyfortyeightcompose" | ||
minSdkVersion 21 | ||
targetSdkVersion 30 | ||
minSdk 21 | ||
targetSdk 34 | ||
versionCode 1 | ||
versionName "1.0" | ||
versionName "1.0.0" | ||
} | ||
|
||
buildTypes { | ||
debug { | ||
applicationIdSuffix ".debug" | ||
} | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
minifyEnabled true | ||
shrinkResources true | ||
signingConfig signingConfigs.getByName("debug") | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_8 | ||
targetCompatibility JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
allWarningsAsErrors = true | ||
jvmTarget = '1.8' | ||
useIR = true | ||
} | ||
|
||
buildFeatures { | ||
compose true | ||
} | ||
composeOptions { | ||
kotlinCompilerExtensionVersion compose_version | ||
kotlinCompilerVersion kotlin_version | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" | ||
implementation 'androidx.activity:activity-ktx:1.1.0' | ||
implementation 'androidx.core:core-ktx:1.3.2' | ||
implementation 'androidx.appcompat:appcompat:1.2.0' | ||
implementation 'com.google.android.material:material:1.2.1' | ||
implementation "androidx.compose.ui:ui:$compose_version" | ||
implementation "androidx.compose.material:material:$compose_version" | ||
implementation "androidx.compose.ui:ui-tooling:$compose_version" | ||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.0-rc01' | ||
implementation 'com.google.code.gson:gson:2.8.6' | ||
} | ||
compose { | ||
desktop { | ||
application { | ||
mainClass = "MainKt" | ||
|
||
nativeDistributions { | ||
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) | ||
packageName = "com.alexjlockwood.twentyfortyeightcompose" | ||
packageVersion = "1.0.0" | ||
} | ||
} | ||
} | ||
|
||
experimental { | ||
web.application {} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
app/src/androidMain/kotlin/com/alexjlockwood/twentyfortyeight/MainActivity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.alexjlockwood.twentyfortyeight | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.compose.setContent | ||
import com.alexjlockwood.twentyfortyeight.domain.UserData | ||
import com.alexjlockwood.twentyfortyeight.repository.GameRepository | ||
import com.alexjlockwood.twentyfortyeight.repository.USER_DATA_FILE_NAME | ||
import io.github.xxfast.kstore.file.storeOf | ||
import okio.Path.Companion.toPath | ||
|
||
class MainActivity : ComponentActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
val filesDir = application.filesDir.absolutePath.toPath() | ||
val store = storeOf(file = filesDir.resolve(USER_DATA_FILE_NAME), default = UserData.EMPTY_USER_DATA) | ||
|
||
setContent { | ||
App( | ||
repository = GameRepository(store), | ||
) | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<resources> | ||
<style name="AppTheme" parent="@android:style/Theme.Material.Light.NoActionBar"> | ||
<item name="android:statusBarColor">#303f9f</item> | ||
</style> | ||
</resources> |
File renamed without changes.
Oops, something went wrong.