Skip to content

Commit

Permalink
Merge pull request #16 from stslex/dev
Browse files Browse the repository at this point in the history
setup cocoapods for ios build
  • Loading branch information
stslex authored Nov 30, 2023
2 parents 800884f + f33b671 commit 5c32e14
Show file tree
Hide file tree
Showing 26 changed files with 304 additions and 97 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Project Build Linux

on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:

jobs:

build-android:

runs-on: ubuntu-latest

steps:

- name: Checkout branch
uses: actions/checkout@v2

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew assembleAndroidTest

build-desktop:

runs-on: ubuntu-latest

steps:

- name: Checkout branch
uses: actions/checkout@v2

- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew desktopMainClasses desktopSourcesJar desktopTestClasses
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Project Build
name: Project Build MacOs

on:
push:
Expand Down Expand Up @@ -31,7 +31,4 @@ jobs:
xcode-version: latest-stable

- name: Build with Gradle
run: ./gradlew build

- name: Junit tests with Gradle
run: ./gradlew testDebugUnitTest
run: ./gradlew iosArm64Binaries
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ captures
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
.fleet
**/*.podspec
/iosApp/Podfile.lock
/iosApp/Pods
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ plugins {
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.jetbrainsKotlinAndroid) apply false
alias(libs.plugins.kotlinCocoapods).apply(false)
}
18 changes: 12 additions & 6 deletions composeApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidApplication)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinCocoapods)
}

kotlin {
Expand All @@ -17,12 +18,17 @@ kotlin {

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
iosX64()
iosArm64()
iosSimulatorArm64()

cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
podfile = project.file("../iosApp/Podfile")
framework {
baseName = "ComposeApp"
isStatic = true
}
Expand Down
18 changes: 11 additions & 7 deletions core/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinCocoapods)
}

kotlin {
Expand All @@ -15,14 +16,17 @@ kotlin {

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
podfile = project.file(project.rootProject.projectDir.path + "/iosApp/CorePodfile")
framework {
baseName = "core"
isStatic = true
}
}

Expand Down
20 changes: 12 additions & 8 deletions core/database/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinCocoapods)
kotlin("plugin.serialization") version "1.9.20"
}

Expand All @@ -16,14 +17,17 @@ kotlin {

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "database"
isStatic = true
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
podfile = project.file(project.rootProject.projectDir.path + "/iosApp/CoreDatabasePodfile")
framework {
baseName = "coreDatabase"
}
}

Expand Down
20 changes: 12 additions & 8 deletions core/network/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinCocoapods)
kotlin("plugin.serialization") version "1.9.20"
}

Expand All @@ -16,14 +17,17 @@ kotlin {

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "network"
isStatic = true
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
podfile = project.file(project.rootProject.projectDir.path + "/iosApp/CoreNetworkPodfile")
framework {
baseName = "coreNetwork"
}
}

Expand Down
20 changes: 12 additions & 8 deletions core/ui/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinCocoapods)
}

kotlin {
Expand All @@ -17,14 +18,17 @@ kotlin {

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "ui"
isStatic = true
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
podfile = project.file(project.rootProject.projectDir.path + "/iosApp/CoreUiPodfile")
framework {
baseName = "coreUi"
}
}

Expand Down
25 changes: 6 additions & 19 deletions core/ui/src/commonMain/kotlin/com/stslex/core/ui/mvi/BaseStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,45 +42,32 @@ abstract class BaseStore<S : State, E : Event, A : Action, N : Navigation>(
private val _event: MutableSharedFlow<E> = MutableSharedFlow()
val event: SharedFlow<E> = _event.asSharedFlow()

fun updateState(update: (S) -> S) {
protected fun updateState(update: (S) -> S) {
mutableState.update(update)
}

fun sendEvent(event: E) {
protected fun sendEvent(event: E) {
screenModelScope.launch(appDispatcher.default) {
this@BaseStore._event.emit(event)
}
}

fun navigate(event: N) {
protected fun navigate(event: N) {
router(event)
}

fun launch(
onError: suspend (Throwable) -> Unit = {},
onSuccess: suspend () -> Unit = {},
block: suspend CoroutineScope.() -> Unit,
): Job = screenModelScope.launch(appDispatcher.default) {
runCatching { block() }
.onSuccess { onSuccess() }
.onFailure {
Logger.exception(it)
onError(it)
}
}

fun <T> launch(
action: suspend CoroutineScope.() -> T,
protected fun <T> launch(
onError: suspend (Throwable) -> Unit = {},
onSuccess: (T) -> Unit,
action: suspend CoroutineScope.() -> T,
): Job = screenModelScope.launch(
context = exceptionHandler(onError) + appDispatcher.default,
block = {
onSuccess(action())
}
)

fun <T> Flow<T>.launchFlow(
protected fun <T> Flow<T>.launchFlow(
onError: suspend (cause: Throwable) -> Unit = {},
each: suspend (T) -> Unit
): Job = screenModelScope.launch(
Expand Down
20 changes: 12 additions & 8 deletions feature/feed/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinCocoapods)
}

kotlin {
Expand All @@ -15,14 +16,17 @@ kotlin {

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "feed"
isStatic = true
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
podfile = project.file(project.rootProject.projectDir.path + "/iosApp/FeatureFeedPodfile")
framework {
baseName = "featureFeed"
}
}

Expand Down
20 changes: 12 additions & 8 deletions feature/film/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ plugins {
alias(libs.plugins.kotlinMultiplatform)
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsCompose)
alias(libs.plugins.kotlinCocoapods)
}

kotlin {
Expand All @@ -15,14 +16,17 @@ kotlin {

jvm("desktop")

listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach {
it.binaries.framework {
baseName = "film"
isStatic = true
iosX64()
iosArm64()
iosSimulatorArm64()
cocoapods {
summary = "Some description for the Shared Module"
homepage = "Link to the Shared Module homepage"
version = "1.0"
ios.deploymentTarget = "16.0"
podfile = project.file(project.rootProject.projectDir.path + "/iosApp/FeatureFilmPodfile")
framework {
baseName = "featureFilm"
}
}

Expand Down
Loading

0 comments on commit 5c32e14

Please sign in to comment.