Skip to content

Commit 8d5d425

Browse files
committed
#796 add another reproducing sample
1 parent 48268de commit 8d5d425

File tree

43 files changed

+1440
-0
lines changed

Some content is hidden

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

43 files changed

+1440
-0
lines changed

.github/compilation-check-source.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,26 @@ jobs:
290290
- *publish_test_report
291291
- *upload_reports
292292

293+
check-kotlin-2-dynamic-sample:
294+
runs-on: ${{ matrix.os }}
295+
strategy:
296+
matrix:
297+
<<: *runner_matrix
298+
needs: build-library
299+
300+
steps:
301+
- *checkout
302+
- *setup_jdk
303+
- *setup_gradle
304+
- *cache_konan
305+
- *download_maven
306+
307+
- name: Sample - kotlin-2-dynamic-sample
308+
run: cd samples/kotlin-2-dynamic-sample && ./local-check.sh
309+
shell: bash
310+
311+
- *publish_test_report
312+
- *upload_reports
293313

294314
check-kotlin-2-tests:
295315
runs-on: ${{ matrix.os }}

.github/workflows/compilation-check.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,52 @@ jobs:
498498
with:
499499
name: code-coverage-report-${{ github.job }}-${{ matrix.os }}
500500
path: "**/build/reports/**/*"
501+
check-kotlin-2-dynamic-sample:
502+
runs-on: ${{ matrix.os }}
503+
strategy:
504+
matrix:
505+
os:
506+
- macOS-latest
507+
- windows-latest
508+
- ubuntu-latest
509+
needs: build-library
510+
steps:
511+
- uses: actions/checkout@v4
512+
- name: Set up JDK 17
513+
uses: actions/setup-java@v4
514+
with:
515+
java-version: 17
516+
distribution: zulu
517+
- name: Setup Gradle
518+
uses: gradle/gradle-build-action@v3
519+
with:
520+
cache-read-only: ${{ github.ref != 'refs/heads/master' && github.ref !=
521+
'refs/heads/develop' }}
522+
- name: Cache .konan
523+
uses: actions/cache@v4
524+
with:
525+
path: ~/.konan
526+
key: ${{ matrix.os }}-konan-${{ hashFiles('**/*.gradle*', 'gradle/**/*') }}
527+
- name: Download maven artifacts
528+
uses: actions/download-artifact@v4
529+
with:
530+
name: maven
531+
path: ~/.m2/repository/dev/icerock
532+
- name: Sample - kotlin-2-dynamic-sample
533+
run: cd samples/kotlin-2-dynamic-sample && ./local-check.sh
534+
shell: bash
535+
- name: Publish Test Report
536+
uses: mikepenz/action-junit-report@v4
537+
if: ${{ always() }}
538+
with:
539+
report_paths: "**/build/test-results/**/TEST-*.xml"
540+
github_token: ${{ secrets.GITHUB_TOKEN }}
541+
- name: Archive reports
542+
uses: actions/upload-artifact@v4
543+
if: ${{ always() }}
544+
with:
545+
name: code-coverage-report-${{ github.job }}-${{ matrix.os }}
546+
path: "**/build/reports/**/*"
501547
check-kotlin-2-tests:
502548
runs-on: ${{ matrix.os }}
503549
strategy:
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.iml
2+
.gradle
3+
.idea
4+
.DS_Store
5+
.kotlin
6+
build
7+
captures
8+
.externalNativeBuild
9+
.cxx
10+
local.properties
11+
xcuserdata
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Sample of mobile app with Kotlin 2.1, multimodule and dynamic framework
2+
3+
## Build
4+
5+
1. publish moko-resources to local maven - `./gradlew publishToMavenLocal` in `moko-resources` root
6+
2. build sample (in IDE or by `./gradlew build`)
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
plugins {
2+
alias(libs.plugins.androidApplication)
3+
alias(libs.plugins.kotlinAndroid)
4+
alias(libs.plugins.compose.compiler)
5+
}
6+
7+
android {
8+
namespace = "app.kotlin2sample.android"
9+
compileSdk = 34
10+
defaultConfig {
11+
applicationId = "app.kotlin2sample.android"
12+
minSdk = 26
13+
targetSdk = 34
14+
versionCode = 1
15+
versionName = "1.0"
16+
}
17+
buildFeatures {
18+
compose = true
19+
}
20+
packaging {
21+
resources {
22+
excludes += "/META-INF/{AL2.0,LGPL2.1}"
23+
}
24+
}
25+
buildTypes {
26+
getByName("release") {
27+
isMinifyEnabled = false
28+
}
29+
}
30+
compileOptions {
31+
sourceCompatibility = JavaVersion.VERSION_1_8
32+
targetCompatibility = JavaVersion.VERSION_1_8
33+
}
34+
kotlinOptions {
35+
jvmTarget = "1.8"
36+
}
37+
}
38+
39+
dependencies {
40+
implementation(projects.shared)
41+
implementation(libs.compose.ui)
42+
implementation(libs.compose.ui.tooling.preview)
43+
implementation(libs.compose.material3)
44+
implementation(libs.androidx.activity.compose)
45+
implementation(moko.resourcesCompose)
46+
debugImplementation(libs.compose.ui.tooling)
47+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application
5+
android:allowBackup="false"
6+
android:supportsRtl="true"
7+
android:theme="@style/AppTheme">
8+
<activity
9+
android:name="app.thirtyninth.compose.navigation.kotlin2sample.android.MainActivity"
10+
android:exported="true">
11+
<intent-filter>
12+
<action android:name="android.intent.action.MAIN" />
13+
<category android:name="android.intent.category.LAUNCHER" />
14+
</intent-filter>
15+
</activity>
16+
</application>
17+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package app.thirtyninth.compose.navigation.kotlin2sample.android
2+
3+
import android.os.Bundle
4+
import androidx.activity.ComponentActivity
5+
import androidx.activity.compose.setContent
6+
import androidx.compose.foundation.layout.Column
7+
import androidx.compose.foundation.layout.fillMaxSize
8+
import androidx.compose.material3.MaterialTheme
9+
import androidx.compose.material3.Surface
10+
import androidx.compose.material3.Text
11+
import androidx.compose.runtime.Composable
12+
import androidx.compose.ui.Modifier
13+
import androidx.compose.ui.res.stringResource
14+
import androidx.compose.ui.tooling.preview.Preview
15+
import app.kotlin2sample.Greeting
16+
import dev.icerock.moko.resources.compose.localized
17+
18+
class MainActivity : ComponentActivity() {
19+
override fun onCreate(savedInstanceState: Bundle?) {
20+
super.onCreate(savedInstanceState)
21+
setContent {
22+
MyApplicationTheme {
23+
Surface(
24+
modifier = Modifier.fillMaxSize(),
25+
color = MaterialTheme.colorScheme.background
26+
) {
27+
Column {
28+
GreetingView(Greeting().greet())
29+
Text(text = Greeting().getMR().localized())
30+
Text(text = stringResource(id = app.kotlin2sample.R.string.hello_world))
31+
}
32+
}
33+
}
34+
}
35+
}
36+
}
37+
38+
@Composable
39+
fun GreetingView(text: String) {
40+
Text(text = text)
41+
}
42+
43+
@Preview
44+
@Composable
45+
fun DefaultPreview() {
46+
MyApplicationTheme {
47+
GreetingView("Hello, Android!")
48+
}
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package app.thirtyninth.compose.navigation.kotlin2sample.android
2+
3+
import androidx.compose.foundation.isSystemInDarkTheme
4+
import androidx.compose.foundation.shape.RoundedCornerShape
5+
import androidx.compose.material3.MaterialTheme
6+
import androidx.compose.material3.Shapes
7+
import androidx.compose.material3.Typography
8+
import androidx.compose.material3.darkColorScheme
9+
import androidx.compose.material3.lightColorScheme
10+
import androidx.compose.runtime.Composable
11+
import androidx.compose.ui.graphics.Color
12+
import androidx.compose.ui.text.TextStyle
13+
import androidx.compose.ui.text.font.FontFamily
14+
import androidx.compose.ui.text.font.FontWeight
15+
import androidx.compose.ui.unit.dp
16+
import androidx.compose.ui.unit.sp
17+
18+
@Composable
19+
fun MyApplicationTheme(
20+
darkTheme: Boolean = isSystemInDarkTheme(),
21+
content: @Composable () -> Unit
22+
) {
23+
val colors = if (darkTheme) {
24+
darkColorScheme(
25+
primary = Color(0xFFBB86FC),
26+
secondary = Color(0xFF03DAC5),
27+
tertiary = Color(0xFF3700B3)
28+
)
29+
} else {
30+
lightColorScheme(
31+
primary = Color(0xFF6200EE),
32+
secondary = Color(0xFF03DAC5),
33+
tertiary = Color(0xFF3700B3)
34+
)
35+
}
36+
val typography = Typography(
37+
bodyMedium = TextStyle(
38+
fontFamily = FontFamily.Default,
39+
fontWeight = FontWeight.Normal,
40+
fontSize = 16.sp
41+
)
42+
)
43+
val shapes = Shapes(
44+
small = RoundedCornerShape(4.dp),
45+
medium = RoundedCornerShape(4.dp),
46+
large = RoundedCornerShape(0.dp)
47+
)
48+
49+
MaterialTheme(
50+
colorScheme = colors,
51+
typography = typography,
52+
shapes = shapes,
53+
content = content
54+
)
55+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<resources>
2+
<style name="AppTheme" parent="android:Theme.Material.NoActionBar"/>
3+
</resources>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
//trick: for the same plugin versions in all sub-modules
3+
alias(libs.plugins.androidApplication).apply(false)
4+
alias(libs.plugins.androidLibrary).apply(false)
5+
alias(libs.plugins.kotlinAndroid).apply(false)
6+
alias(libs.plugins.kotlinMultiplatform).apply(false)
7+
}
8+
9+
buildscript{
10+
dependencies {
11+
classpath(moko.resourcesGradlePlugin)
12+
}
13+
}

0 commit comments

Comments
 (0)