Skip to content

Commit

Permalink
Merge pull request #52 from ExNDY/#51-update-moko-resources
Browse files Browse the repository at this point in the history
#51 update moko resources
  • Loading branch information
Alex009 authored Sep 29, 2024
2 parents 7b43153 + 2c354e4 commit 35260f0
Show file tree
Hide file tree
Showing 19 changed files with 75 additions and 40 deletions.
17 changes: 7 additions & 10 deletions .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ jobs:
runs-on: macOS-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
- name: Build and publish local
run: ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64
- name: Install pods
run: cd sample/ios-app && pod install
- name: Check iOS
run: cd sample/ios-app && set -o pipefail && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty
java-version: 17
distribution: zulu
- name: Check
run: ./local-check.sh
9 changes: 5 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ jobs:
SIGNING_KEY: ${{ secrets.GPG_KEY_CONTENTS }}

steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 11
java-version: 17
distribution: zulu
- name: Publish
run: ./gradlew publish

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ on the platforms. Converts the exception class to an error object to display. Th
`SelectorErrorPresenter` - for selecting error presenter by some custom condition.

## Requirements
- Kotlin 1.9.0
- Gradle version 6.8+
- Android API 16+
- iOS version 11.0+
Expand All @@ -44,7 +45,7 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:errors:0.6.0")
commonMainApi("dev.icerock.moko:errors:0.8.0")
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ allprojects {
}

tasks.register("clean", Delete::class).configure {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}
2 changes: 1 addition & 1 deletion errors/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dependencies {
}

multiplatformResources {
multiplatformResourcesPackage = "dev.icerock.moko.errors"
resourcesPackage.set("dev.icerock.moko.errors")
}

tasks.withType<GenerateMultiplatformResourcesTask>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dev.icerock.moko.errors.ErrorEventListener
import dev.icerock.moko.errors.presenters.ErrorPresenter
import dev.icerock.moko.mvvm.dispatcher.EventsDispatcher
import platform.UIKit.UIViewController
import kotlin.experimental.ExperimentalNativeApi
import kotlin.native.ref.WeakReference

actual interface ExceptionHandlerBinder {
Expand All @@ -33,8 +34,10 @@ actual class ExceptionHandlerBinderImpl<T : Any> actual constructor(
viewController: UIViewController,
private val errorPresenter: ErrorPresenter<T>
) : ErrorEventListener<T> {
@OptIn(ExperimentalNativeApi::class)
private val viewControllerRef = WeakReference(viewController)

@OptIn(ExperimentalNativeApi::class)
override fun showError(throwable: Throwable, data: T) {
val viewController = viewControllerRef.get() ?: return

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
org.gradle.jvmargs=-Xmx4096m
org.gradle.configureondemand=false
org.gradle.parallel=true
org.gradle.configuration-cache=true

kotlin.code.style=official
kotlin.mpp.androidSourceSetLayoutVersion=2
Expand Down
12 changes: 6 additions & 6 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[versions]
kotlinVersion = "1.8.10"
kotlinVersion = "1.9.25"
androidAppCompatVersion = "1.6.1"
materialDesignVersion = "1.8.0"
androidLifecycleVersion = "2.2.0"
androidCoreTestingVersion = "2.2.0"
coroutinesVersion = "1.6.4"
mokoMvvmVersion = "0.16.0"
mokoResourcesVersion = "0.21.2"
mokoErrorsVersion = "0.7.0"
mokoMvvmVersion = "0.16.1"
mokoResourcesVersion = "0.24.1"
mokoErrorsVersion = "0.8.0"

[libraries]
# android
Expand All @@ -30,6 +30,6 @@ androidCoreTesting = { module = "androidx.arch.core:core-testing", version.ref =

# gradle plugins
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "7.4.2" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "8.3.2" }
mokoResourcesGradlePlugin = { module = "dev.icerock.moko:resources-generator", version.ref = "mokoResourcesVersion" }
mokoGradlePlugin = { module = "dev.icerock.moko:moko-gradle-plugin", version = "0.3.0" }
mokoGradlePlugin = { module = "dev.icerock.moko:moko-gradle-plugin", version = "0.4.1" }
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Tue Apr 16 13:01:03 NOVT 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
37 changes: 37 additions & 0 deletions local-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#
# Copyright 2024 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
#

set -e

log() {
echo "\033[0;32m> $1\033[0m"
}

./gradlew detekt
log "detekt success"

./gradlew assembleDebug
log "android success"

./gradlew compileKotlinIosX64
log "ios success"

./gradlew build publishToMavenLocal
log "full build success"

if ! command -v xcodebuild &> /dev/null
then
log "xcodebuild could not be found, skip ios checks"
else
./gradlew syncMultiPlatformLibraryDebugFrameworkIosX64
log "sync success"

(
cd sample/ios-app &&
pod install &&
set -o pipefail &&
xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty
)
log "ios xcode success"
fi
4 changes: 2 additions & 2 deletions sample/ios-app/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ EXTERNAL SOURCES:
:path: "../mpp-library"

SPEC CHECKSUMS:
MultiPlatformLibrary: 2a9f43df7bd018c32611a2087c1e2ef74847394c
MultiPlatformLibrary: 050151f1b2e9b2dcfff0763bb625fb3a0a063076

PODFILE CHECKSUM: e8746dc30e9d53a96c59e8f821148cde03ea8c5b

COCOAPODS: 1.11.3
COCOAPODS: 1.15.2
4 changes: 2 additions & 2 deletions sample/ios-app/TestProj.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
287627FB1F319065007FA12B /* Sources */,
287627FC1F319065007FA12B /* Frameworks */,
287627FD1F319065007FA12B /* Resources */,
587327CC3950A42DF058CD2B /* [CP] Embed Pods Frameworks */,
C2E24025FF3D3E83F431EA5B /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -173,7 +173,7 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
587327CC3950A42DF058CD2B /* [CP] Embed Pods Frameworks */ = {
C2E24025FF3D3E83F431EA5B /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down
15 changes: 5 additions & 10 deletions sample/mpp-library/MultiPlatformLibrary.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ Pod::Spec.new do |spec|
'KOTLIN_FRAMEWORK_BUILD_TYPE[config=*elease]' => 'release',
'CURENT_SDK[sdk=iphoneos*]' => 'iphoneos',
'CURENT_SDK[sdk=iphonesimulator*]' => 'iphonesimulator',
'CURENT_SDK[sdk=macosx*]' => 'macos'
}

spec.script_phases = [
Expand All @@ -37,21 +36,17 @@ fi
if [ "$CURENT_SDK" == "iphoneos" ]; then
TARGET="Ios"
ARCH="Arm64"
elif [ "$CURENT_SDK" == "macos" ]; then
TARGET="Macos"
if [ "$NATIVE_ARCH" == "arm64" ]; then
ARCH="Arm64"
else
ARCH="X64"
fi
else
if [ "$NATIVE_ARCH" == "arm64" ]; then
elif [ "$CURENT_SDK" == "iphonesimulator" ]; then
if [ "$ARCHS" == "arm64" ]; then
TARGET="IosSimulator"
ARCH="Arm64"
else
TARGET="Ios"
ARCH="X64"
fi
else
echo "unsupported $CURENT_SDK"
exit 1
fi
MPP_PROJECT_ROOT="$SRCROOT/../../mpp-library"
Expand Down
2 changes: 1 addition & 1 deletion sample/mpp-library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ dependencies {
}

multiplatformResources {
multiplatformResourcesPackage = "com.icerockdev.library"
resourcesPackage.set("com.icerockdev.library")
}
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* Copyright 2020 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

enableFeaturePreview("VERSION_CATALOGS")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

dependencyResolutionManagement {
Expand Down

0 comments on commit 35260f0

Please sign in to comment.