Skip to content

Commit

Permalink
Merge pull request #1 from ding1dingx/dev
Browse files Browse the repository at this point in the history
Upgrades the following dependencies
  • Loading branch information
syxc authored Sep 1, 2024
2 parents 9086880 + 8fe4268 commit 21d80ae
Show file tree
Hide file tree
Showing 29 changed files with 91 additions and 96 deletions.
5 changes: 2 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 110

[*.java]
ij_java_use_single_class_imports = true

[*.{kt,kts}]
ij_kotlin_imports_layout = *
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_allow_trailing_comma = true
ij_kotlin_allow_trailing_comma_on_call_site = true
ktlint_code_style = android_studio
ktlint_standard_property-naming = disabled
ktlint_standard_backing-property-naming = disabled
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Android CI

on:
pull_request: { }
workflow_dispatch: { }
pull_request: {}
workflow_dispatch: {}
push:
branches: [ 'master' ]
branches:
- 'master'
- 'main'
tags-ignore:
- '**'
paths-ignore:
Expand All @@ -19,6 +21,10 @@ on:
- docs
- iosApp

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx6g -Dfile.encoding=UTF-8 -Dorg.gradle.daemon=false -Dorg.gradle.vfs.watch=false -Dkotlin.incremental=false"

Expand All @@ -30,10 +36,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: set up JDK 17
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'

- name: Grant execute permission for gradlew
Expand Down
16 changes: 11 additions & 5 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: iOS CI

on:
pull_request: { }
workflow_dispatch: { }
pull_request: {}
workflow_dispatch: {}
push:
branches: [ 'master' ]
branches:
- 'master'
- 'main'
tags-ignore:
- '**'
paths-ignore:
Expand All @@ -19,6 +21,10 @@ on:
- docs
- androidApp

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx6g -Dfile.encoding=UTF-8 -Dorg.gradle.daemon=false -Dorg.gradle.vfs.watch=false -Dkotlin.incremental=false"

Expand All @@ -30,10 +36,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: set up JDK 17
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'corretto'

- name: Grant execute permission for gradlew
Expand Down
2 changes: 1 addition & 1 deletion .idea/kotlinc.xml

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

6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# kmp-app

![kotlin-version](https://img.shields.io/badge/kotlin-2.0.0-blue)
[![Android CI](https://github.com/syxc/kmp-app/actions/workflows/android.yml/badge.svg)](https://github.com/syxc/kmp-app/actions/workflows/android.yml)
[![iOS CI](https://github.com/syxc/kmp-app/actions/workflows/ios.yml/badge.svg)](https://github.com/syxc/kmp-app/actions/workflows/ios.yml)
![kotlin-version](https://img.shields.io/badge/kotlin-2.0.20-blue)
[![Android CI](https://github.com/ding1dingx/kmp-app/actions/workflows/android.yml/badge.svg)](https://github.com/ding1dingx/kmp-app/actions/workflows/android.yml)
[![iOS CI](https://github.com/ding1dingx/kmp-app/actions/workflows/ios.yml/badge.svg)](https://github.com/ding1dingx/kmp-app/actions/workflows/ios.yml)

- [redwood](https://github.com/cashapp/redwood)
- [moko-resources](https://github.com/icerockdev/moko-resources)
Expand Down
2 changes: 1 addition & 1 deletion androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ android {
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
"proguard-rules.pro",
)
}

Expand Down
12 changes: 6 additions & 6 deletions androidApp/src/main/java/com/jithub/app/android/AppTheme.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,32 @@ fun AppTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable ()
darkColorScheme(
primary = Color(0xFFBB86FC),
secondary = Color(0xFF03DAC5),
tertiary = Color(0xFF3700B3)
tertiary = Color(0xFF3700B3),
)
} else {
lightColorScheme(
primary = Color(0xFF6200EE),
secondary = Color(0xFF03DAC5),
tertiary = Color(0xFF3700B3)
tertiary = Color(0xFF3700B3),
)
}
val typography = Typography(
bodyMedium = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp
)
fontSize = 16.sp,
),
)
val shapes = Shapes(
small = RoundedCornerShape(4.dp),
medium = RoundedCornerShape(4.dp),
large = RoundedCornerShape(0.dp)
large = RoundedCornerShape(0.dp),
)

MaterialTheme(
colorScheme = colors,
typography = typography,
shapes = shapes,
content = content
content = content,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MainActivity : ComponentActivity() {

val widgetSystem = SchemaWidgetSystem(
Schema = ComposeUiWidgetFactory,
RedwoodLayout = ComposeUiRedwoodLayoutWidgetFactory()
RedwoodLayout = ComposeUiRedwoodLayoutWidgetFactory(),
)

setContent {
Expand Down
1 change: 1 addition & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {

repositories {
mavenCentral()
gradlePluginPortal()
google()
}

Expand Down
38 changes: 19 additions & 19 deletions build-logic/convention/src/main/kotlin/BuildSupportPlugin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@ class BuildSupportPlugin : BasePlugin() {
}
targetExclude(
"**/build/**/*.java",
"${rootProject.rootDir}/spotless/**"
"${rootProject.rootDir}/spotless/**",
)
toggleOffOn("@formatter:off", "@formatter:on")
importOrder()
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
// https://github.com/palantir/palantir-java-format
palantirJavaFormat("2.47.0").style("GOOGLE").formatJavadoc(true)
palantirJavaFormat("2.50.0").style("GOOGLE").formatJavadoc(true)
formatAnnotations()
licenseHeaderFile(rootProject.file("spotless/copyright.txt"))
}
Expand All @@ -68,13 +68,13 @@ class BuildSupportPlugin : BasePlugin() {
"**/build/**/*.kt",
"${rootProject.rootDir}/spotless/**",
"**/src/commonMain/kotlin/Greeting.kt",
"**/src/wasmJsMain/kotlin/Platform.wasmJs.kt"
"**/src/wasmJsMain/kotlin/Platform.wasmJs.kt",
)
ktlint(ktlintVersion).customRuleSets(
// https://github.com/mrmans0n/compose-rules
listOf("io.nlopez.compose.rules:ktlint:0.4.5")
listOf("io.nlopez.compose.rules:ktlint:0.4.11"),
).setEditorConfigPath(
"${rootProject.rootDir}/.editorconfig"
"${rootProject.rootDir}/.editorconfig",
).editorConfigOverride(
mapOf(
"android" to "true",
Expand All @@ -84,8 +84,8 @@ class BuildSupportPlugin : BasePlugin() {
// Making something an expression body should be a choice around readability.
"ktlint_standard_function-expression-body" to "disabled",
"ktlint_function_naming_ignore_when_annotated_with" to "Composable",
"ktlint_compose_compositionlocal-allowlist" to "disabled"
)
"ktlint_compose_compositionlocal-allowlist" to "disabled",
),
)
licenseHeaderFile(rootProject.file("spotless/copyright.txt"))
}
Expand All @@ -94,7 +94,7 @@ class BuildSupportPlugin : BasePlugin() {
target("**/*.gradle.kts")
targetExclude(
"**/build/**/*.kts",
"${rootProject.rootDir}/spotless/**"
"${rootProject.rootDir}/spotless/**",
)
ktlint(ktlintVersion).setEditorConfigPath("${rootProject.rootDir}/.editorconfig")
// Look for the first line that doesn't have a block comment (assumed to be the license)
Expand All @@ -109,7 +109,7 @@ class BuildSupportPlugin : BasePlugin() {
"**/.kotlin/**/*.xml",
"**/build/**/*.xml",
"**/lint-config/**/*.xml",
"${rootProject.rootDir}/spotless/**"
"${rootProject.rootDir}/spotless/**",
)
indentWithSpaces(2)
trimTrailingWhitespace()
Expand Down Expand Up @@ -166,8 +166,8 @@ class BuildSupportPlugin : BasePlugin() {
// Enable experimental compose APIs
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.lifecycle.compose.ExperimentalLifecycleComposeApi",
"-opt-in=androidx.compose.animation.ExperimentalSharedTransitionApi"
)
"-opt-in=androidx.compose.animation.ExperimentalSharedTransitionApi",
),
)

jvmTarget.set(Versions.jvmTarget)
Expand Down Expand Up @@ -231,8 +231,8 @@ class BuildSupportPlugin : BasePlugin() {
// https://kotlinlang.org/docs/whatsnew13.html#progressive-mode
"-progressive",
// https://kotlinlang.org/docs/multiplatform-expect-actual.html#expected-and-actual-classes
"-Xexpect-actual-classes"
)
"-Xexpect-actual-classes",
),
)
}
}
Expand All @@ -241,8 +241,8 @@ class BuildSupportPlugin : BasePlugin() {
compilerOptions {
freeCompilerArgs.set(
freeCompilerArgs.getOrElse(emptyList()) + listOf(
"-Xjvm-default=all"
)
"-Xjvm-default=all",
),
)
jvmTarget.set(Versions.jvmTarget)
}
Expand All @@ -266,8 +266,8 @@ class BuildSupportPlugin : BasePlugin() {
compilerOptions {
freeCompilerArgs.set(
freeCompilerArgs.getOrElse(emptyList()) + listOf(
"-Xjdk-release=${Versions.javaVersion}"
)
"-Xjdk-release=${Versions.javaVersion}",
),
)
}
}
Expand Down Expand Up @@ -297,8 +297,8 @@ class BuildSupportPlugin : BasePlugin() {
"-Xklib-enable-signature-clash-checks=false",
// Translate capturing lambdas into anonymous JS functions rather than hoisting parameters
// and creating a named sibling function. Only affects targets which produce actual JS.
"-Xir-generate-inline-anonymous-functions"
)
"-Xir-generate-inline-anonymous-functions",
),
)
}
}
Expand Down
12 changes: 4 additions & 8 deletions build-logic/convention/src/main/kotlin/Configuration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ object Versions {
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 2401

// jvmToolchain
// const val jdkVersion = 17

// starting with AGP 7.4.0 we need to target JVM 11 bytecode
val javaVersion = JavaVersion.VERSION_11
val jvmTarget = JvmTarget.JVM_11
val javaVersion = JavaVersion.VERSION_1_8
val jvmTarget = JvmTarget.JVM_1_8
}

// packaging-resources-excludes
object Resources {
val excludes = listOf(
"DebugProbesKt.bin",
"kotlin-tooling-metadata.json",
// "kotlin-tooling-metadata.json",
"kotlin/**",
// Only exclude *.version files in release mode as debug mode requires these files for layout inspector to work.
// "META-INF/*.version",
Expand All @@ -40,6 +36,6 @@ object Resources {
"META-INF/INDEX.LIST",
"META-INF/*.kotlin_module",
// assets/sentry-external-modules.txt
"**/sentry-external-modules.txt"
"**/sentry-external-modules.txt",
)
}
8 changes: 5 additions & 3 deletions build-logic/convention/src/main/kotlin/ProjectExt.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ internal fun Project.lintConfigure(): Lint.() -> Unit = {
// lintConfig = rootProject.file("lint-config/lint-default.xml")
}

internal fun PluginContainer.hasKotlinComposePlugin() = hasPlugin("org.jetbrains.kotlin.plugin.compose")
internal fun PluginContainer.hasKotlinComposePlugin() =
hasPlugin("org.jetbrains.kotlin.plugin.compose")

/**
* Configure Compose-specific options
Expand All @@ -26,7 +27,7 @@ internal fun PluginContainer.hasKotlinComposePlugin() = hasPlugin("org.jetbrains
*/
fun Project.configureAndroidCompose(
commonExtension: CommonExtension<*, *, *, *, *>,
hasRedwood: Boolean = true
hasRedwood: Boolean = true,
) {
if (!plugins.hasKotlinComposePlugin()) {
pluginManager.apply("org.jetbrains.kotlin.plugin.compose")
Expand All @@ -40,7 +41,8 @@ fun Project.configureAndroidCompose(
}

extensions.configure<ComposeCompilerGradlePluginExtension> {
enableStrongSkippingMode.set(true)
// Strong skipping mode enabled by default
// https://kotlinlang.org/docs/whatsnew2020.html#strong-skipping-mode-enabled-by-default
reportsDestination.set(layout.buildDirectory.dir("compose_compiler"))
}
}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ allprojects {
subprojects {
afterEvaluate {
tasks.withType<JavaCompile> {
dependsOn(tasks.getByName("spotlessApply"))
// dependsOn(tasks.getByName("spotlessApply"))
}
}
}
Expand Down
Loading

0 comments on commit 21d80ae

Please sign in to comment.