Skip to content

Commit

Permalink
Modified
Browse files Browse the repository at this point in the history
  • Loading branch information
syxc committed Apr 20, 2024
1 parent 98da539 commit 968baf3
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 57 deletions.
16 changes: 7 additions & 9 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,25 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{yml,yaml,md}]
indent_size = 2

[*.{js,ts,json,vue,jsx,html,css}]
indent_size = 2

[*.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
ktlint_code_style = android_studio
ktlint_standard_property-naming = disabled
ktlint_standard_backing-property-naming = disabled
ktlint_function_naming_ignore_when_annotated_with = Composable, Test

[*.md]
[*.{md,markdown}]
trim_trailing_whitespace = false

[{Makefile,.SRCINFO}]
[Makefile]
indent_style = tab
63 changes: 44 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,29 +1,54 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
@file:Suppress("UnstableApiUsage")

buildscript {
repositories {
gradlePluginPortal()
google {
content {
includeGroupByRegex(".*google.*")
includeGroupByRegex(".*android.*")
}
}
mavenCentral()
}
}

allprojects {
repositories {
google {
content {
includeGroupByRegex(".*google.*")
includeGroupByRegex(".*android.*")
}
}
mavenCentral()
}
}

@Suppress("DSL_SCOPE_VIOLATION")
plugins {
// trick: for the same plugin versions in all sub-modules
alias(libs.plugins.androidApplication) apply false
alias(libs.plugins.androidLibrary) apply false
alias(libs.plugins.kotlinAndroid) apply false
alias(libs.plugins.kotlinMultiplatform) apply false
alias(libs.plugins.kotlinCocoapods) apply false
alias(libs.plugins.android.application) apply false
alias(libs.plugins.android.library) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.cocoapods) apply false
}

subprojects {
project.configurations.configureEach {
// Whilst the compileSdk is < 34
// force the version of these dependencies
// we don't use them, but they are pulled in by the compose dependencies
resolutionStrategy {
force("androidx.emoji2:emoji2:1.3.0")
force("androidx.emoji2:emoji2-views:1.3.0")
force("androidx.emoji2:emoji2-views-helper:1.3.0")
}
project.configurations.configureEach {
// Whilst the compileSdk is < 34
// force the version of these dependencies
// we don't use them, but they are pulled in by the compose dependencies
resolutionStrategy {
// force("androidx.emoji2:emoji2:1.3.0")
// force("androidx.emoji2:emoji2-views:1.3.0")
// force("androidx.emoji2:emoji2-views-helper:1.3.0")
}
}
}

tasks {
register("clean", Delete::class) {
delete(rootProject.buildDir)
}
register("clean", Delete::class) {
delete(rootProject.layout.buildDirectory)
}
}
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Gradle
org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M"
org.gradle.jvmargs=-Xmx2g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
org.gradle.configuration-cache=true

# Kotlin
Expand All @@ -9,6 +11,7 @@ kotlin.code.style=official
# Android
android.useAndroidX=true
android.nonTransitiveRClass=true
android.suppressUnsupportedCompileSdk=34

# MPP
#kotlin.mpp.enableCInteropCommonization=true
46 changes: 29 additions & 17 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,36 +1,48 @@
[versions]
minSdk = "23"
targetSdk = "33"
compileSdk = "33"
compileSdk = "34"

kotlin = "1.9.23"
agp = "7.2.2"
kotlin = "1.9.22"
# For compileSdk => 33
compose = "1.5.4"
compose-compiler = "1.5.8"
compose-material3 = "1.1.2"
androidx-activityCompose = "1.7.2"

jetbrains-compose = "1.6.2"
compose-compiler = "1.5.11"
compose-material3 = "1.2.1"
androidx-activityCompose = "1.9.0"

# For AGP 4.0 to 7.2
desugar_jdk_libs = "1.1.9"

androidx-test-junit = "1.1.5"
junit = "4.13.2"

[plugins]
androidApplication = { id = "com.android.application", version.ref = "agp" }
androidLibrary = { id = "com.android.library", version.ref = "agp" }
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlinCocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-cocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" }

[libraries]
# -------- JetBrains Compose: https://github.com/JetBrains/compose-multiplatform/releases --------
jetbrains-compose-compiler = "org.jetbrains.compose.compiler:compiler:1.5.10.1"
jetbrains-compose-gradlePlugin = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "jetbrains-compose" }
jetbrains-compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "jetbrains-compose" }
jetbrains-compose-runtime-saveable = { module = "org.jetbrains.compose.runtime:runtime-saveable", version.ref = "jetbrains-compose" }
jetbrains-compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "jetbrains-compose" }
jetbrains-compose-ui = { module = "org.jetbrains.compose.ui:ui", version.ref = "jetbrains-compose" }
jetbrains-compose-ui-tooling = { module = "org.jetbrains.compose.ui:ui-tooling", version.ref = "jetbrains-compose" }
jetbrains-compose-ui-tooling-preview = { module = "org.jetbrains.compose.ui:ui-tooling-preview", version.ref = "jetbrains-compose" }
jetbrains-compose-material = { module = "org.jetbrains.compose.material:material", version.ref = "jetbrains-compose" }
jetbrains-compose-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "jetbrains-compose" }
jetbrains-compose-animation = { module = "org.jetbrains.compose.animation:animation-core", version.ref = "jetbrains-compose" }
jetbrains-components-resources = { module = "org.jetbrains.compose.components:components-resources", version.ref = "jetbrains-compose" }

androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" }
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
compose-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "compose" }
compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" }
compose-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" }

desugar_jdk_libs = { module = "com.android.tools:desugar_jdk_libs", version.ref = "desugar_jdk_libs" }

kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
androidx-test-junit = { module = "androidx.test.ext:junit-ktx", version.ref = "androidx-test-junit" }
junit = { module = "junit:junit", version.ref = "junit" }
27 changes: 16 additions & 11 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
@file:Suppress("UnstableApiUsage")

enableFeaturePreview("VERSION_CATALOGS")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")

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

dependencyResolutionManagement {
repositories {
google()
mavenCentral()
repositories {
gradlePluginPortal()
google {
content {
includeGroupByRegex(".*google.*")
includeGroupByRegex(".*android.*")
}
}
mavenCentral()
}
}

rootProject.name = "kmp-app-scaffold"

include(":kmp-app-shared")
include(":kmp-app-android-scaffold")

check(JavaVersion.current().isCompatibleWith(JavaVersion.VERSION_17)) {
"This project needs to be run with Java 17 or higher (found: ${JavaVersion.current()})."
}

0 comments on commit 968baf3

Please sign in to comment.