Skip to content

Commit 040aa41

Browse files
committed
Refactor to multiplatform library
1 parent 71d89b3 commit 040aa41

File tree

52 files changed

+535
-310
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+535
-310
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: push
44

55
jobs:
66
lint:
7-
runs-on: ubuntu-latest
7+
runs-on: macos-latest
88
steps:
99
- name: "Checkout"
1010
uses: actions/checkout@v4
@@ -14,23 +14,10 @@ jobs:
1414
distribution: 'adopt'
1515
java-version: '17'
1616
- name: "lint"
17-
run: ./gradlew lint
18-
19-
ktlint:
20-
runs-on: ubuntu-latest
21-
steps:
22-
- name: "Checkout"
23-
uses: actions/checkout@v4
24-
- name: "Set up Java"
25-
uses: actions/setup-java@v4
26-
with:
27-
distribution: 'adopt'
28-
java-version: '17'
29-
- name: "ktlint"
30-
run: ./gradlew ktlintCheck
17+
run: ./gradlew lint ktlintCheck
3118

3219
test:
33-
runs-on: ubuntu-latest
20+
runs-on: macos-latest
3421
steps:
3522
- name: "Checkout"
3623
uses: actions/checkout@v4
@@ -43,7 +30,7 @@ jobs:
4330
run: ./gradlew test
4431

4532
check_coverage:
46-
runs-on: ubuntu-latest
33+
runs-on: macos-latest
4734
steps:
4835
- name: "Checkout"
4936
uses: actions/checkout@v4
@@ -53,10 +40,10 @@ jobs:
5340
distribution: 'adopt'
5441
java-version: '17'
5542
- name: "Check if coverage is satisfied"
56-
run: ./gradlew jacocoTestCoverageVerification
43+
run: ./gradlew koverVerify
5744

5845
api_validation:
59-
runs-on: ubuntu-latest
46+
runs-on: macos-latest
6047
steps:
6148
- name: "Checkout"
6249
uses: actions/checkout@v4
@@ -69,8 +56,8 @@ jobs:
6956
run: ./gradlew apiCheck
7057

7158
assemble:
72-
needs: [lint, ktlint, test, check_coverage]
73-
runs-on: ubuntu-latest
59+
needs: [lint, test, check_coverage]
60+
runs-on: macos-latest
7461
steps:
7562
- name: "Checkout"
7663
uses: actions/checkout@v4
@@ -84,7 +71,7 @@ jobs:
8471

8572
upload_coverage:
8673
needs: [assemble]
87-
runs-on: ubuntu-latest
74+
runs-on: macos-latest
8875
steps:
8976
- name: "Checkout"
9077
uses: actions/checkout@v4
@@ -94,10 +81,10 @@ jobs:
9481
distribution: 'adopt'
9582
java-version: '17'
9683
- name: "Create coverage reports"
97-
run: ./gradlew check jacocoTestReport
84+
run: ./gradlew koverXmlReport
9885
- name: "Upload coverage to codecov"
9986
uses: codecov/[email protected]
10087
with:
10188
token: ${{ secrets.CODECOV_TOKEN }}
102-
files: ./control-core/build/reports/jacoco/test/jacocoTestReport.xml
89+
files: ./control-core/build/reports/kover/report.xml
10390
fail_ci_if_error: true

.github/workflows/deploy-release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
all_checks:
10-
runs-on: ubuntu-latest
10+
runs-on: macos-latest
1111
steps:
1212
- name: "Checkout"
1313
uses: actions/checkout@v4
@@ -17,11 +17,11 @@ jobs:
1717
distribution: 'adopt'
1818
java-version: '17'
1919
- name: "Checks all the things"
20-
run: ./gradlew lint ktlintCheck test jacocoTestCoverageVerification apiCheck assemble
20+
run: ./gradlew lint ktlintCheck test koverVerify apiCheck assemble
2121

2222
publish:
2323
needs: [ all_checks ]
24-
runs-on: ubuntu-latest
24+
runs-on: macos-latest
2525
steps:
2626
- name: "Checkout"
2727
uses: actions/checkout@v4

.github/workflows/deploy-snapshot.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
all_checks:
10-
runs-on: ubuntu-latest
10+
runs-on: macos-latest
1111
steps:
1212
- name: "Checkout"
1313
uses: actions/checkout@v4
@@ -17,11 +17,11 @@ jobs:
1717
distribution: 'adopt'
1818
java-version: '17'
1919
- name: "Checks all the things"
20-
run: ./gradlew lint ktlintCheck test jacocoTestCoverageVerification apiCheck assemble
20+
run: ./gradlew lint ktlintCheck test koverVerify apiCheck assemble
2121

2222
publish:
2323
needs: [ all_checks ]
24-
runs-on: ubuntu-latest
24+
runs-on: macos-latest
2525
steps:
2626
- name: "Checkout"
2727
uses: actions/checkout@v4

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,5 @@ fabric.properties
199199

200200
# End of https://www.toptal.com/developers/gitignore/api/android,androidstudio,macos
201201

202-
*.salive
202+
*.salive
203+
.kotlin/

.idea/gradle.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# changelog
22

3-
## `[1.4.0]` - 2025-XX-XX
3+
## `[2.0.0]` - 2025-03-16
44

55
- Update Kotlin to `2.1.10`
66
- Update kotlinx.coroutines to `1.10.1`

README.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@ repositories {
1919
mavenCentral()
2020
}
2121
22-
dependencies {
23-
implementation("at.florianschuster.control:control-core:$version")
22+
kotlin {
23+
sourceSets {
24+
commonMain {
25+
dependencies {
26+
implementation("at.florianschuster.control:control-core:$version")
27+
}
28+
}
29+
}
2430
}
2531
```
2632

@@ -30,7 +36,10 @@ see [changelog](https://github.com/floschu/control/blob/develop/CHANGELOG.md) f
3036

3137
<p align="center"><img alt="flow" width="500" src=".media/udf.png"></p>
3238

33-
A [Controller](control-core/src/main/kotlin/at/florianschuster/control/Controller.kt) is an ui-independent class that controls the state of a view. The role of a `Controller` is to separate business-logic from view-logic. A `Controller` has no dependency to the view, so it can easily be unit tested.
39+
A [Controller](control-core/src/main/kotlin/at/florianschuster/control/Controller.kt) is an
40+
ui-independent class that controls the state of a view. The role of a `Controller` is to separate
41+
business-logic from view-logic. A `Controller` has no dependency to the view, so it can easily be
42+
unit tested.
3443

3544
## info & documentation
3645

@@ -44,8 +53,9 @@ A [Controller](control-core/src/main/kotlin/at/florianschuster/control/Controlle
4453

4554
## examples
4655

47-
* [kotlin-counter](examples/kotlin-counter): most basic kotlin example. uses `Controller`.
48-
* [android-counter](examples/android-counter): android counter example built with [jetpack compose](https://developer.android.com/jetpack/compose).
56+
* [kotlin-counter](examples/kotlin-counter): most basic kotlin example. uses `Controller`.
57+
* [android-counter](examples/android-counter): android counter example built
58+
with [jetpack compose](https://developer.android.com/jetpack/compose).
4959

5060
## author
5161

build.gradle.kts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import kotlinx.validation.ExperimentalBCVApi
2+
13
plugins {
2-
alias(libs.plugins.ktlint)
3-
alias(libs.plugins.dokka)
44
alias(libs.plugins.binary.compatibility.validator)
5-
jacoco
5+
alias(libs.plugins.ktlint)
6+
alias(libs.plugins.kover)
67
`maven-publish`
78
signing
89
alias(libs.plugins.kotlin.multiplatform) apply false
@@ -14,6 +15,8 @@ plugins {
1415
// ---- api-validation --- //
1516

1617
apiValidation {
18+
@OptIn(ExperimentalBCVApi::class)
19+
klib { enabled = true }
1720
ignoredProjects.addAll(
1821
listOf(
1922
"kotlin-counter",
@@ -23,19 +26,3 @@ apiValidation {
2326
}
2427

2528
// ---- end api-validation --- //
26-
27-
// ---- jacoco --- //
28-
29-
subprojects {
30-
configurations.all {
31-
resolutionStrategy {
32-
eachDependency {
33-
if (requested.group == "org.jacoco") {
34-
useVersion("0.8.12")
35-
}
36-
}
37-
}
38-
}
39-
}
40-
41-
// ---- end jacoco --- //

control-core/api/control-core.api

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,33 @@ public final class at/florianschuster/control/ControllerLog$Custom : at/florians
4949

5050
public final class at/florianschuster/control/ControllerLog$None : at/florianschuster/control/ControllerLog {
5151
public static final field INSTANCE Lat/florianschuster/control/ControllerLog$None;
52+
public fun equals (Ljava/lang/Object;)Z
53+
public fun hashCode ()I
54+
public fun toString ()Ljava/lang/String;
5255
}
5356

5457
public final class at/florianschuster/control/ControllerLog$Println : at/florianschuster/control/ControllerLog {
5558
public static final field INSTANCE Lat/florianschuster/control/ControllerLog$Println;
59+
public fun equals (Ljava/lang/Object;)Z
60+
public fun hashCode ()I
61+
public fun toString ()Ljava/lang/String;
5662
}
5763

5864
public abstract class at/florianschuster/control/ControllerStart {
5965
}
6066

6167
public final class at/florianschuster/control/ControllerStart$Immediately : at/florianschuster/control/ControllerStart {
6268
public static final field INSTANCE Lat/florianschuster/control/ControllerStart$Immediately;
69+
public fun equals (Ljava/lang/Object;)Z
70+
public fun hashCode ()I
71+
public fun toString ()Ljava/lang/String;
6372
}
6473

6574
public final class at/florianschuster/control/ControllerStart$Lazy : at/florianschuster/control/ControllerStart {
6675
public static final field INSTANCE Lat/florianschuster/control/ControllerStart$Lazy;
76+
public fun equals (Ljava/lang/Object;)Z
77+
public fun hashCode ()I
78+
public fun toString ()Ljava/lang/String;
6779
}
6880

6981
public abstract interface class at/florianschuster/control/ControllerStub : at/florianschuster/control/Controller {
@@ -120,6 +132,9 @@ public final class at/florianschuster/control/TakeUntilKt {
120132
public static synthetic fun takeUntil$default (Lkotlinx/coroutines/flow/Flow;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
121133
}
122134

135+
public abstract interface annotation class at/florianschuster/control/TestOnlyStub : java/lang/annotation/Annotation {
136+
}
137+
123138
public abstract interface class at/florianschuster/control/TransformerContext {
124139
}
125140

0 commit comments

Comments
 (0)