Skip to content

Commit ece7911

Browse files
authored
Merge pull request #32 from icerockdev/develop
Release 0.4.0
2 parents bf43988 + 1474582 commit ece7911

28 files changed

+358
-337
lines changed

.github/workflows/compilation-check.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ jobs:
1212

1313
steps:
1414
- uses: actions/checkout@v1
15-
- name: Set up JDK 1.8
15+
- name: Set up JDK 11
1616
uses: actions/setup-java@v1
1717
with:
18-
java-version: 1.8
19-
- name: Check build
20-
run: ./gradlew detekt build publishToMavenLocal
18+
java-version: 11
19+
- name: Build and publish local
20+
run: ./gradlew build publishToMavenLocal syncMultiPlatformLibraryDebugFrameworkIosX64
21+
- name: Install pods
22+
run: cd sample/ios-app && pod install
23+
- name: Check iOS
24+
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

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121

2222
steps:
2323
- uses: actions/checkout@v1
24-
- name: Set up JDK 1.8
24+
- name: Set up JDK 11
2525
uses: actions/setup-java@v1
2626
with:
27-
java-version: 1.8
27+
java-version: 11
2828
- name: Publish
2929
run: ./gradlew publish
3030

@@ -41,6 +41,6 @@ jobs:
4141
with:
4242
commitish: ${{ github.ref }}
4343
tag_name: release/${{ github.event.inputs.version }}
44-
release_name: Release ${{ github.event.inputs.version }}
44+
release_name: ${{ github.event.inputs.version }}
4545
body: "Will be filled later"
4646
draft: true

README.md

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
![moko-errors](img/logo.png)
22

3-
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/errors) ](https://repo1.maven.org/maven2/dev/icerock/moko/errors) ![kotlin-version](https://img.shields.io/badge/kotlin-1.4.31-orange)
4-
3+
[![GitHub license](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0) [![Download](https://img.shields.io/maven-central/v/dev.icerock.moko/errors) ](https://repo1.maven.org/maven2/dev/icerock/moko/errors) ![kotlin-version](https://kotlin-version.aws.icerock.dev/kotlin-version?group=dev.icerock.moko&name=errors)
54
# Mobile Kotlin errors
65
This is a Kotlin MultiPlatform library that provides automatic exception handling and
76
automatic error displaying to a screen.
87

98
## Table of Contents
109
- [Features](#features)
1110
- [Requirements](#requirements)
12-
- [Versions](#versions)
1311
- [Installation](#installation)
1412
- [Usage](#usage)
1513
- [Samples](#samples)
@@ -29,23 +27,9 @@ on the platforms. Converts the exception class to an error object to display. Th
2927
`SelectorErrorPresenter` - for selecting error presenter by some custom condition.
3028

3129
## Requirements
32-
- Gradle version 6.0+
30+
- Gradle version 6.8+
3331
- Android API 16+
34-
- iOS version 9.0+
35-
36-
## Versions
37-
### Bintray
38-
- kotlin 1.3.72
39-
- 0.1.0
40-
- 0.2.0
41-
- 0.2.1
42-
- kotlin 1.4.0
43-
- 0.3.0
44-
- kotlin 1.4.21
45-
- 0.3.1
46-
### mavenCentral
47-
- kotlin 1.4.31
48-
- 0.3.2
32+
- iOS version 11.0+
4933

5034
## Installation
5135
root build.gradle
@@ -60,7 +44,7 @@ allprojects {
6044
project build.gradle
6145
```groovy
6246
dependencies {
63-
commonMainApi("dev.icerock.moko:errors:0.3.2")
47+
commonMainApi("dev.icerock.moko:errors:0.4.0")
6448
}
6549
```
6650

@@ -181,14 +165,15 @@ fun onSendRequest() {
181165
}
182166
```
183167

184-
Also you can add some custom `catch` handlers for `ExceptionHandler`:
168+
Also you can add some custom `catch` handlers for `ExceptionHandler` that work as a catch in the
169+
try/catch operator:
185170

186171
```kotlin
187172
fun onSendRequest() {
188173
viewModelScope.launch {
189174
exceptionHandler.handle {
190175
serverRequest()
191-
}.catch<IllegalArgumentException> { // Specifying a specific exception class
176+
}.catch<IllegalArgumentException> { // Specifying exception class
192177
// Some custom handler code
193178
false // true - cancels ErrorPresenter; false - allows execution of ErrorsPresenter
194179
}.execute() // Starts code execution in `handle` lambda

build.gradle.kts

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,20 @@ buildscript {
1111
}
1212

1313
dependencies {
14-
plugin(Deps.Plugins.mokoResources)
15-
}
16-
}
14+
classpath("dev.icerock.moko:resources-generator:0.16.0")
1715

18-
plugins {
19-
plugin(Deps.Plugins.detekt).apply(false)
16+
classpath(":errors-build-logic")
17+
}
2018
}
2119

2220
allprojects {
23-
repositories {
24-
mavenCentral()
25-
google()
26-
27-
jcenter {
28-
content {
29-
includeGroup("org.jetbrains.trove4j")
30-
includeGroup("org.jetbrains.kotlinx")
31-
}
32-
}
33-
}
34-
35-
plugins.withId(Deps.Plugins.androidLibrary.id) {
36-
configure<com.android.build.gradle.LibraryExtension> {
37-
compileSdkVersion(Deps.Android.compileSdk)
3821

39-
defaultConfig {
40-
minSdkVersion(Deps.Android.minSdk)
41-
targetSdkVersion(Deps.Android.targetSdk)
42-
}
22+
allprojects {
23+
plugins.withId("org.gradle.maven-publish") {
24+
group = "dev.icerock.moko"
25+
version = libs.versions.mokoErrorsVersion.get()
4326
}
4427
}
45-
46-
apply(plugin = Deps.Plugins.detekt.id)
47-
48-
configure<io.gitlab.arturbosch.detekt.extensions.DetektExtension> {
49-
input.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin")
50-
}
51-
52-
dependencies {
53-
"detektPlugins"(Deps.Libs.Detekt.detektFormatting)
54-
}
5528
}
5629

5730
tasks.register("clean", Delete::class).configure {

buildSrc/build.gradle.kts

Lines changed: 0 additions & 24 deletions
This file was deleted.

buildSrc/src/main/kotlin/Deps.kt

Lines changed: 0 additions & 85 deletions
This file was deleted.

errors-build-logic/build.gradle.kts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
google()
8+
9+
gradlePluginPortal()
10+
}
11+
12+
dependencies {
13+
api("dev.icerock:mobile-multiplatform:0.12.0")
14+
api("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20")
15+
api("com.android.tools.build:gradle:4.2.1")
16+
api("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.15.0")
17+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
plugins {
6+
id("com.android.application")
7+
id("android-base-convention")
8+
id("kotlin-android")
9+
}
10+
11+
android {
12+
dexOptions {
13+
javaMaxHeapSize = "2g"
14+
}
15+
16+
buildTypes {
17+
getByName("release") {
18+
isMinifyEnabled = true
19+
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
20+
}
21+
getByName("debug") {
22+
isDebuggable = true
23+
applicationIdSuffix = ".debug"
24+
}
25+
}
26+
27+
packagingOptions {
28+
exclude("META-INF/*.kotlin_module")
29+
exclude("META-INF/AL2.0")
30+
exclude("META-INF/LGPL2.1")
31+
}
32+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
import com.android.build.gradle.BaseExtension
6+
7+
configure<BaseExtension> {
8+
compileSdkVersion(30)
9+
10+
defaultConfig {
11+
minSdkVersion(16)
12+
targetSdkVersion(30)
13+
}
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
plugins {
6+
id("com.android.library")
7+
id("kotlin-android")
8+
id("android-base-convention")
9+
}
10+
11+
android {
12+
sourceSets.all { java.srcDir("src/$name/kotlin") }
13+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
plugins {
6+
id("publication-convention")
7+
}
8+
9+
afterEvaluate {
10+
publishing.publications {
11+
create("release", MavenPublication::class.java) {
12+
from(components.getByName("release"))
13+
}
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
plugins {
6+
id("io.gitlab.arturbosch.detekt")
7+
}
8+
9+
detekt {
10+
input.setFrom("src/commonMain/kotlin", "src/androidMain/kotlin", "src/iosMain/kotlin", "src/main/kotlin")
11+
}
12+
13+
dependencies {
14+
"detektPlugins"("io.gitlab.arturbosch.detekt:detekt-formatting:1.15.0")
15+
}

0 commit comments

Comments
 (0)