Skip to content

Commit f72a0cf

Browse files
Merge pull request #70 from CodandoTV/issue-59/convert-to-kmp
[ISSUE-59] - Create Server Driven UI for KMP
2 parents 2a2da40 + a6264a6 commit f72a0cf

File tree

243 files changed

+4637
-1396
lines changed

Some content is hidden

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

243 files changed

+4637
-1396
lines changed

.github/actions/java/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "Java setup"
2+
description: "Setup Java"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- uses: actions/checkout@v4
8+
- name: set up JDK 17
9+
uses: actions/setup-java@v4
10+
with:
11+
java-version: "17"
12+
distribution: "temurin"
13+
cache: gradle

.github/workflows/pr.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ jobs:
1414
- name: Check out code
1515
uses: actions/checkout@v3
1616

17-
- name: Set up JDK 17
18-
uses: actions/setup-java@v3
19-
with:
20-
distribution: "temurin"
21-
java-version: "17"
17+
- uses: actions/checkout@v4
18+
- name: Setup Java
19+
uses: ./.github/actions/java
2220

2321
- name: Set up Android SDK
2422
uses: android-actions/setup-android@v2
@@ -40,11 +38,9 @@ jobs:
4038
- name: Check out code
4139
uses: actions/checkout@v3
4240

43-
- name: Set up JDK 17
44-
uses: actions/setup-java@v3
45-
with:
46-
distribution: "temurin"
47-
java-version: "17"
41+
- uses: actions/checkout@v4
42+
- name: Setup Java
43+
uses: ./.github/actions/java
4844

4945
- name: Run Unit Tests
5046
run: ./gradlew testDebugUnitTest --no-daemon

.github/workflows/publish.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ jobs:
2525
echo "ORG_GRADLE_PROJECT_signingInMemoryKey: $ORG_GRADLE_PROJECT_signingInMemoryKey"
2626
echo "ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: $ORG_GRADLE_PROJECT_signingInMemoryKeyPassword"
2727
echo "ORG_GRADLE_PROJECT_signingInMemoryKeyId: $ORG_GRADLE_PROJECT_signingInMemoryKeyId"
28-
./gradlew publish --no-daemon
28+
./gradlew \
29+
:craftd-core:publishAllPublicationsToMavenCentralRepository \
30+
:craftd-compose:publishAllPublicationsToMavenCentralRepository \
31+
:craftd-xml:publish \
32+
--no-daemon
2933
env:
3034
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }}
3135
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }}
@@ -34,6 +38,27 @@ jobs:
3438
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }}
3539
working-directory: android_kmp
3640

41+
tag:
42+
name: Update tags per module
43+
runs-on: ubuntu-latest
44+
needs: publish
45+
46+
strategy:
47+
matrix:
48+
module:
49+
- name: craftd-core
50+
prefix: kmp
51+
- name: craftd-compose
52+
prefix: kmp
53+
- name: craftd-xml
54+
prefix: android
55+
56+
steps:
57+
- name: Check out code
58+
uses: actions/checkout@v3
59+
with:
60+
fetch-depth: 0
61+
3762
- name: Setup Ruby
3863
uses: ruby/setup-ruby@v1
3964
with:
@@ -47,6 +72,4 @@ jobs:
4772
bundle install --jobs 4 --retry 3
4873
4974
- name: Update tag
50-
run: bundle exec fastlane update_tag
51-
env:
52-
PREFIX: "android"
75+
run: PREFIX=${{ matrix.module.prefix }} bundle exec fastlane update_tag

README.md

Lines changed: 10 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ Take a look at [CraftD: Server Driven UI for All Platforms](https://medium.com/c
1818
## Features
1919
### 🔗 Compatibility
2020

21-
| Tech | Support |
22-
|---------------------------------|:--------------------:|
23-
| View System - Android |**Supported** |
24-
| Jetpack Compose - Android |**Supported** |
25-
| Widget - Flutter |**Supported** |
26-
| SwiftUi - iOS |**Supported** |
27-
| Jetpack Compose - Multiplatform | ⚒️ **In Progress** |
21+
| Tech | Support |
22+
|---------------------------------|:-------------------:|
23+
| View System - Android | **Supported** |
24+
| Jetpack Compose - Android | **Supported** |
25+
| Widget - Flutter | **Supported** |
26+
| SwiftUi - iOS | **Supported** |
27+
| Jetpack Compose - Multiplatform | **Supported** |
2828

2929
### Components that already exist in the library
3030

@@ -34,65 +34,13 @@ Take a look at [CraftD: Server Driven UI for All Platforms](https://medium.com/c
3434
| Text | X | X | X | X |
3535
| CheckBox | X | - | - | X |
3636

37-
### Create your custom component( android compose example )
38-
39-
```kotlin
40-
@JsonIgnoreProperties(ignoreUnknown = true)
41-
@Immutable
42-
@Stable
43-
data class CheckBoxProperties(
44-
@JsonProperty("text") val text: String? = null,
45-
... rest of your properties
46-
)
47-
48-
```
49-
50-
#### Add your Component json object in Dymanic.json
51-
```json
52-
{
53-
"key": "CraftDCheckBox",
54-
"value": {
55-
... place your properties
56-
}
57-
}
58-
59-
```
60-
61-
#### Create your Component
62-
```kotlin
63-
@Composable
64-
fun CraftDCheckBox(
65-
checkboxProperties: CheckBoxProperties,
66-
modifier: Modifier = Modifier,
67-
onChecked: (Boolean) -> Unit
68-
) {
69-
... place your code
70-
}
71-
```
72-
73-
#### Create your Component Builder
74-
```kotlin
75-
class CraftDCheckBoxBuilder(
76-
override val key: String = CraftDComponentKey.CHECK_BOX_COMPONENT.key
77-
) :
78-
CraftDBuilder {
79-
@Composable
80-
override fun craft(model: SimpleProperties, listener: CraftDViewListener) {
81-
val checkBoxProperties = model.value.convertToVO<CheckBoxProperties>()
82-
CraftDCheckBox(checkBoxProperties) {
83-
checkBoxProperties.actionProperties?.let { listener.invoke(it) }
84-
}
85-
}
86-
}
87-
```
88-
8937
More details check our [documentation](https://codandotv.gitbook.io/craftd)
9038

9139

9240
### Samples
93-
| [Android Compose](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/compose) | [Android View System](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/xml) | [iOS SwiftUI](https://github.com/CodandoTV/CraftD/tree/main/ios/sample/CraftDSample) | [Flutter](https://github.com/CodandoTV/CraftD/tree/main/flutter/sample/lib) |
94-
|----------|----------|----------|----------|
95-
| <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/user-attachments/assets/c8c653b2-1289-4437-85f2-f940d5135f27" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/dfabfda7-6501-4763-b040-3ee9fbf2a2be" width="200" height="400" /> |
41+
| [Android Compose / Compose MultiPlatform](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/compose) | [Android View System](https://github.com/CodandoTV/CraftD/tree/main/android_kmp/app-sample/src/main/java/com/github/codandotv/craftd/app_sample/presentation/xml) | [iOS SwiftUI](https://github.com/CodandoTV/CraftD/tree/main/ios/sample/CraftDSample) | [Flutter](https://github.com/CodandoTV/CraftD/tree/main/flutter/sample/lib) |
42+
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|----------|----------|
43+
| <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/aa31d0a2-a998-402c-b2c2-4de5088ee30f" width="200" height="400" /> | <img src="https://github.com/user-attachments/assets/c8c653b2-1289-4437-85f2-f940d5135f27" width="200" height="400" /> | <img src="https://github.com/CodandoTV/CraftD/assets/7690931/dfabfda7-6501-4763-b040-3ee9fbf2a2be" width="200" height="400" /> |
9644

9745

9846
### Credits

android_kmp/.gitignore

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# =========================================
2+
# Kotlin Multiplatform / Compose Multiplatform
3+
# =========================================
4+
5+
# Build system
6+
/build/
7+
.gradle/
8+
local.properties
9+
!gradle/wrapper/gradle-wrapper.jar
10+
.gradle-cache/
11+
.gradle/
12+
.gradle.kts.cached
13+
.gradle/configuration-cache/
14+
.kotlinc/
15+
.kotlin
16+
17+
# IDEs
18+
.idea/
19+
*.iml
20+
*.ipr
21+
*.iws
22+
.vscode/
23+
*.sw?
24+
*.swo
25+
*.orig
26+
27+
# Kotlin/Java
28+
out/
29+
bin/
30+
classes/
31+
*.class
32+
*.log
33+
*.tmp
34+
*.lock
35+
*.hprof
36+
37+
# Compose Multiplatform generated resources
38+
composeApp/build/
39+
composeApp/.kotlin/
40+
composeApp/.compose-cache/
41+
composeApp/.cache/
42+
composeApp/compose-resources/
43+
44+
# KMP common artifacts
45+
common/build/
46+
shared/build/
47+
**/build/
48+
**/.kotlin/
49+
**/.kotlin-js-store/
50+
**/.gradle/
51+
**/.idea_modules/
52+
53+
# Android
54+
captures/
55+
*.apk
56+
*.ap_
57+
*.aab
58+
*.dex
59+
*.class
60+
*.keystore
61+
*.jks
62+
*.so
63+
*.aar
64+
*.iml
65+
**/local.properties
66+
**/generated/
67+
**/outputs/
68+
**/reports/
69+
**/release/
70+
**/debug/
71+
72+
# iOS
73+
xcuserdata/
74+
DerivedData/
75+
build/XCFrameworks/
76+
*.xcodeproj/*
77+
!*.xcodeproj/project.pbxproj
78+
!*.xcodeproj/xcshareddata/
79+
*.xcworkspace/
80+
!*.xcworkspace/contents.xcworkspacedata
81+
Pods/
82+
*.pbxuser
83+
*.mode1v3
84+
*.mode2v3
85+
*.perspectivev3
86+
*.xcuserstate
87+
.DS_Store
88+
89+
# Native (K/N)
90+
.konan/
91+
**/bin/
92+
**/obj/
93+
**/native/
94+
95+
# Packaging / Distribution
96+
*.zip
97+
*.tar
98+
*.tar.gz
99+
*.tgz
100+
*.jar
101+
*.war
102+
*.ear
103+
*.klib
104+
*.xcframework
105+
*.framework
106+
107+
# Temporary files
108+
*.tmp
109+
*.bak
110+
*.orig
111+
*.swp
112+
*.swo
113+
*.rej
114+
*.sublime-workspace
115+
*.sublime-project
116+
117+
# Environment / Credentials
118+
.env
119+
.env.*
120+
*.key
121+
*.pem
122+
*.p12
123+
*.keystore
124+
*.jks
125+
secrets.properties
126+
signing.properties
127+
128+
# OS files
129+
.DS_Store
130+
Thumbs.db
131+
ehthumbs.db
132+
Desktop.ini
133+
134+
# =========================================
135+
# Optional: ignore intermediate build logic
136+
# =========================================
137+
build-logic/.gradle/
138+
build-logic/build/
139+
gradle.properties

android_kmp/KMP-Sample/.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
*.iml
2+
.kotlin
3+
.gradle
4+
**/build/
5+
xcuserdata
6+
!src/**/build/
7+
local.properties
8+
.idea
9+
.DS_Store
10+
captures
11+
.externalNativeBuild
12+
.cxx
13+
*.xcodeproj/*
14+
!*.xcodeproj/project.pbxproj
15+
!*.xcodeproj/xcshareddata/
16+
!*.xcodeproj/project.xcworkspace/
17+
!*.xcworkspace/contents.xcworkspacedata
18+
**/xcshareddata/WorkspaceSettings.xcsettings
19+
node_modules/

android_kmp/KMP-Sample/README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
This is a Kotlin Multiplatform project targeting Android, iOS.
2+
3+
* [/composeApp](./composeApp/src) is for code that will be shared across your Compose Multiplatform applications.
4+
It contains several subfolders:
5+
- [commonMain](./composeApp/src/commonMain/kotlin) is for code that’s common for all targets.
6+
- Other folders are for Kotlin code that will be compiled for only the platform indicated in the folder name.
7+
For example, if you want to use Apple’s CoreCrypto for the iOS part of your Kotlin app,
8+
the [iosMain](./composeApp/src/iosMain/kotlin) folder would be the right place for such calls.
9+
Similarly, if you want to edit the Desktop (JVM) specific part, the [jvmMain](./composeApp/src/jvmMain/kotlin)
10+
folder is the appropriate location.
11+
12+
* [/iosApp](./iosApp/iosApp) contains iOS applications. Even if you’re sharing your UI with Compose Multiplatform,
13+
you need this entry point for your iOS app. This is also where you should add SwiftUI code for your project.
14+
15+
### Build and Run Android Application
16+
17+
To build and run the development version of the Android app, use the run configuration from the run widget
18+
in your IDE’s toolbar or build it directly from the terminal:
19+
- on macOS/Linux
20+
```shell
21+
./gradlew :composeApp:assembleDebug
22+
```
23+
- on Windows
24+
```shell
25+
.\gradlew.bat :composeApp:assembleDebug
26+
```
27+
28+
### Build and Run iOS Application
29+
30+
To build and run the development version of the iOS app, use the run configuration from the run widget
31+
in your IDE’s toolbar or open the [/iosApp](./iosApp) directory in Xcode and run it from there.
32+
33+
---
34+
35+
Learn more about [Kotlin Multiplatform](https://www.jetbrains.com/help/kotlin-multiplatform-dev/get-started.html)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
alias(libs.plugins.androidApplication) apply false
3+
alias(libs.plugins.androidLibrary) apply false
4+
alias(libs.plugins.composeMultiplatform) apply false
5+
alias(libs.plugins.composeCompiler) apply false
6+
alias(libs.plugins.kotlinMultiplatform) apply false
7+
}

0 commit comments

Comments
 (0)