Skip to content

Commit

Permalink
Merge pull request #171 from icerockdev/develop
Browse files Browse the repository at this point in the history
Release 0.12.0
  • Loading branch information
Alex009 committed Feb 25, 2022
2 parents 8af3cf1 + 9f90ff3 commit b4b2ed1
Show file tree
Hide file tree
Showing 185 changed files with 2,010 additions and 2,437 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/compilation-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,25 @@ on:

jobs:
test:
runs-on: macOS-latest

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
steps:
- uses: actions/checkout@v1
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build and test
run: ./gradlew build publishToMavenLocal
- name: Check build
run: ./run-check.sh "${{ matrix.os }}"
shell: bash
- name: Install pods
run: cd sample/ios-app && pod install
if: matrix.os == 'macOS-latest'
- name: build ios sample
run: cd sample/ios-app && xcodebuild -scheme TestProj -workspace TestProj.xcworkspace -configuration Debug -sdk iphonesimulator -arch x86_64 build CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | xcpretty
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
if: matrix.os == 'macOS-latest'
- name: Publish Test Report
uses: mikepenz/action-junit-report@v2
if: ${{ always() }}
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ on:
jobs:
publish:
name: Publish library at mavenCentral
runs-on: macOS-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, windows-latest, ubuntu-latest ]
env:
OSSRH_USER: ${{ secrets.OSSRH_USER }}
OSSRH_KEY: ${{ secrets.OSSRH_KEY }}
Expand All @@ -25,8 +28,10 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- name: Build and publish to mavenCentral
run: ./gradlew publish
- name: Build and publish
run: ./run-publish.sh "${{ matrix.os }}"
shell: bash

release:
name: Create release
needs: publish
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ build
Pods
xcuserdata
local.properties
local.gradle
local.gradle
kotlin-js-store/
6 changes: 6 additions & 0 deletions .idea/copyright/IceRock.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/copyright/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright 2022 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
#

# Path to sources
sonar.sources=.
sonar.inclusions=**/src/*Main/**/*,**/src/main/**/*,**/*.swift
sonar.exclusions=

# Path to tests
sonar.tests=.
sonar.test.inclusions=**/src/*Test/**/*
sonar.test.exclusions=
33 changes: 0 additions & 33 deletions MultiPlatformLibraryMvvm.podspec

This file was deleted.

40 changes: 18 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,18 @@ allprojects {
project build.gradle
```groovy
dependencies {
commonMainApi("dev.icerock.moko:mvvm-core:0.11.0") // only ViewModel, EventsDispatcher, Dispatchers.UI
commonMainApi("dev.icerock.moko:mvvm-livedata:0.11.0") // api mvvm-core, LiveData and extensions
commonMainApi("dev.icerock.moko:mvvm-state:0.11.0") // api mvvm-livedata, ResourceState class and extensions
commonMainApi("dev.icerock.moko:mvvm-core:0.12.0") // only ViewModel, EventsDispatcher, Dispatchers.UI
commonMainApi("dev.icerock.moko:mvvm-livedata:0.12.0") // api mvvm-core, LiveData and extensions
commonMainApi("dev.icerock.moko:mvvm-state:0.12.0") // api mvvm-livedata, ResourceState class and extensions
commonMainApi("dev.icerock.moko:mvvm-livedata-resources:0.12.0") // api mvvm-core, moko-resources, extensions for LiveData with moko-resources
androidMainApi("dev.icerock.moko:mvvm-livedata-material:0.11.0") // api mvvm-livedata, Material library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-glide:0.11.0") // api mvvm-livedata, Glide library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-swiperefresh:0.11.0") // api mvvm-livedata, SwipeRefreshLayout library android extensions
androidMainApi("dev.icerock.moko:mvvm-databinding:0.11.0") // api mvvm-livedata, DataBinding support for Android
androidMainApi("dev.icerock.moko:mvvm-viewbinding:0.11.0") // api mvvm-livedata, ViewBinding support for Android
androidMainApi("dev.icerock.moko:mvvm-livedata-material:0.12.0") // api mvvm-livedata, Material library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-glide:0.12.0") // api mvvm-livedata, Glide library android extensions
androidMainApi("dev.icerock.moko:mvvm-livedata-swiperefresh:0.12.0") // api mvvm-livedata, SwipeRefreshLayout library android extensions
androidMainApi("dev.icerock.moko:mvvm-databinding:0.12.0") // api mvvm-livedata, DataBinding support for Android
androidMainApi("dev.icerock.moko:mvvm-viewbinding:0.12.0") // api mvvm-livedata, ViewBinding support for Android
commonTestImplementation("dev.icerock.moko:mvvm-test:0.11.0") // test utilities
commonTestImplementation("dev.icerock.moko:mvvm-test:0.12.0") // test utilities
}
```

Expand All @@ -60,24 +61,19 @@ kotlin {
// export correct artifact to use all classes of library directly from Swift
targets.withType(org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget::class.java).all {
binaries.withType(org.jetbrains.kotlin.gradle.plugin.mpp.Framework::class.java).all {
export("dev.icerock.moko:mvvm-core:0.11.0")
export("dev.icerock.moko:mvvm-livedata:0.11.0")
export("dev.icerock.moko:mvvm-state:0.11.0")
export("dev.icerock.moko:mvvm-core:0.12.0")
export("dev.icerock.moko:mvvm-livedata:0.12.0")
export("dev.icerock.moko:mvvm-livedata-resources:0.12.0")
export("dev.icerock.moko:mvvm-state:0.12.0")
}
}
}
```

On iOS, in addition to the Kotlin library add in Podfile
```ruby
pod 'MultiPlatformLibraryMvvm', :git => 'https://github.com/icerockdev/moko-mvvm.git', :tag => 'release/0.11.0'
```
**`MultiPlatformLibraryMvvm` CocoaPod requires that the framework compiled from Kotlin be named
`MultiPlatformLibrary` and be connected as a CocoaPod `MultiPlatformLibrary`.
[Here](sample/ios-app/Podfile)'s an example.
To simplify integration with MultiPlatformFramework you can use [mobile-multiplatform-plugin](https://github.com/icerockdev/mobile-multiplatform-gradle-plugin)**
### KSwift

`MultiPlatformLibraryMvvm` CocoaPod contains the extension to `UIView`s for binding with `LiveData`.
For iOS we recommend use [moko-kswift](https://github.com/icerockdev/moko-kswift) with extensions
generation enabled. All `LiveData` to `UIView` bindings is extensions for UI elements.

## Documentation
Documentation generated by Dokka and available at https://icerockdev.github.io/moko-mvvm/
Expand All @@ -88,7 +84,7 @@ Let’s say we need a screen with a button click counter. To implement it we sho
#### common
In `commonMain` we can create a `ViewModel` like:
```kotlin
class SimpleViewModel() : ViewModel() {
class SimpleViewModel : ViewModel() {
private val _counter: MutableLiveData<Int> = MutableLiveData(0)
val counter: LiveData<String> = _counter.map { it.toString() }

Expand Down
58 changes: 24 additions & 34 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,57 +2,47 @@
* Copyright 2019 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

plugins {
id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.5.0"
}

buildscript {
repositories {
mavenCentral()
google()

gradlePluginPortal()
}

dependencies {
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20")

classpath(":mvvm-build-logic")
classpath(libs.kswiftGradlePlugin)
}
}

allprojects {
apply(plugin = "org.jetbrains.dokka")
plugins {
alias(libs.plugins.nexusPublish)
}

plugins.withId("org.gradle.maven-publish") {
group = "dev.icerock.moko"
version = libs.versions.mokoMvvmVersion.get()
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
username.set(System.getenv("OSSRH_USER"))
password.set(System.getenv("OSSRH_KEY"))
}
}
}

val sampleProjects: Set<Project> = project(":sample").allprojects

apiValidation {
ignoredPackages.add("dev.icerock.moko.mvvm.internal")

ignoredProjects.addAll(sampleProjects.map { it.name })
}
val mokoVersion = libs.versions.mokoMvvmVersion.get()
allprojects {
group = "dev.icerock.moko"
version = mokoVersion

tasks.register("clean", Delete::class).configure {
group = "build"
delete(rootProject.buildDir)
configurations.configureEach {
resolutionStrategy {
force(rootProject.libs.coroutines)
}
}
}

tasks.withType<org.jetbrains.dokka.gradle.DokkaMultiModuleTask>().all {
removeChildTasks(sampleProjects.plus(project(":mvvm")))

doLast {
val dir = outputDirectory.get()
val from = File(dir, "-modules.html")
val to = File(dir, "index.html")

from.renameTo(to)

dir.renameTo(file("docs"))
}
// temporary fix for Apple Silicon (remove after 1.6.20 update)
rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin> {
rootProject.the<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension>().nodeVersion =
"16.0.0"
}
48 changes: 31 additions & 17 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
[versions]
kotlinVersion = "1.5.20"
androidAppCompatVersion = "1.2.0"
materialDesignVersion = "1.2.1"
kotlinVersion = "1.6.10"
androidLifecycleVersion = "2.2.0"
androidCoreTestingVersion = "2.1.0"
glideVersion = "4.11.0"
swipeRefreshVersion = "1.1.0"
dokkaVersion = "1.4.20"
coroutinesVersion = "1.5.0-native-mt"
mokoResourcesVersion = "0.16.0"
mokoTestVersion = "0.4.0"
mokoMvvmVersion = "0.11.0"
coroutinesVersion = "1.6.0-native-mt"
mokoResourcesVersion = "0.18.0"
mokoTestVersion = "0.6.1"
mokoMvvmVersion = "0.12.0"
mokoKSwiftVersion = "0.4.0"

[libraries]
appCompat = { module = "androidx.appcompat:appcompat", version.ref = "androidAppCompatVersion" }
material = { module = "com.google.android.material:material", version.ref = "materialDesignVersion" }
# android
appCompat = { module = "androidx.appcompat:appcompat", version = "1.2.0" }
material = { module = "com.google.android.material:material", version = "1.2.1" }
lifecycle = { module = "androidx.lifecycle:lifecycle-extensions", version.ref = "androidLifecycleVersion" }
androidViewModel = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androidLifecycleVersion" }
androidLiveData = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androidLifecycleVersion" }
glide = { module = "com.github.bumptech.glide:glide", version.ref = "glideVersion" }
swipeRefresh = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "swipeRefreshVersion" }
glide = { module = "com.github.bumptech.glide:glide", version = "4.11.0" }
swipeRefresh = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version = "1.1.0" }

# coroutines
coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutinesVersion" }
coroutinesTest = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutinesVersion" }

# moko
mokoResources = { module = "dev.icerock.moko:resources", version.ref = "mokoResourcesVersion" }
mokoTest = { module = "dev.icerock.moko:test-core", version.ref = "mokoTestVersion" }
mokoKSwift = { module = "dev.icerock.moko:kswift-runtime", version.ref = "mokoKSwiftVersion"}

# tests
kotlinTestJUnit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlinVersion" }
androidCoreTesting = { module = "androidx.arch.core:core-testing", version.ref = "androidCoreTestingVersion" }
coroutinesTest = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutinesVersion" }
androidCoreTesting = { module = "androidx.arch.core:core-testing", version = "2.1.0" }

# gradle plugins
dokkaGradlePlugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "kotlinVersion" }
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinVersion" }
mobileMultiplatformGradlePlugin = { module = "dev.icerock:mobile-multiplatform", version = "0.13.0" }
androidGradlePlugin = { module = "com.android.tools.build:gradle", version = "7.0.4" }
detektGradlePlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version = "1.19.0" }
kswiftGradlePlugin = { module = "dev.icerock.moko:kswift-gradle-plugin", version.ref = "mokoKSwiftVersion" }

[plugins]
nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version = "1.1.0" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
9 changes: 4 additions & 5 deletions mvvm-build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ plugins {
repositories {
mavenCentral()
google()

gradlePluginPortal()
}

dependencies {
api("dev.icerock:mobile-multiplatform:0.12.0")
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20")
api("com.android.tools.build:gradle:4.2.1")
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0")
api(libs.mobileMultiplatformGradlePlugin)
api(libs.kotlinGradlePlugin)
api(libs.androidGradlePlugin)
api(libs.detektGradlePlugin)
}
18 changes: 18 additions & 0 deletions mvvm-build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2022 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
*/

enableFeaturePreview("VERSION_CATALOGS")

dependencyResolutionManagement {
repositories {
mavenCentral()
google()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
Loading

0 comments on commit b4b2ed1

Please sign in to comment.