diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..b890b8cb --- /dev/null +++ b/.editorconfig @@ -0,0 +1,44 @@ +# https://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 2 + +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.{java,kt,kts,scala,rs,xml,kt.spec,kts.spec}] +indent_size = 4 + +[*.{kt,kts}] +ktlint_code_style = ktlint_official +ktlint_ignore_back_ticked_identifier = true + +ktlint_standard = enabled + +# Experimental rules run by default run on the ktlint code base itself. Experimental rules should not be released if +# we are not pleased ourselves with the results on the ktlint code base. +ktlint_experimental = enabled + +# Trailing comma +ij_kotlin_allow_trailing_comma=true +ij_kotlin_allow_trailing_comma_on_call_site=true + +# Don't allow any wildcard imports +ij_kotlin_packages_to_use_import_on_demand = unset +ij_kotlin_name_count_to_use_star_import = 2147483647 +ij_kotlin_name_count_to_use_star_import_for_members = 2147483647 + +ktlint_standard_filename = disabled +ktlint_standard_argument-list-wrapping = disabled +ktlint_standard_trailing-comma-on-call-site = disabled +ktlint_standard_trailing-comma-on-declaration-site = disabled +ktlint_experimental_comment-wrapping = disabled +ktlint_experimental_function-naming = disabled +ktlint_experimental_property-naming = disabled + +[*.md] +trim_trailing_whitespace = false diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 6cd55422..0d5f2a73 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -127,4 +127,10 @@ android { "META-INF/*.version", )) } +} + +kotlin { + jvmToolchain { + languageVersion.set(JavaLanguageVersion.of(Config.androidJvmTarget.majorVersion)) + } } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 24cd4a30..3df06b1f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,6 +22,7 @@ plugins { alias(libs.plugins.ktorfit) apply false alias(libs.plugins.aboutLibraries) apply false alias(libs.plugins.versions) + id("com.louiscad.complete-kotlin") version "1.1.0" } allprojects { @@ -46,6 +47,9 @@ tasks.withType { kotlinOptions { + if (name.contains("android", true)) { + jvmTarget = Config.androidJvmTarget.toString() + } if (project.hasProperty("generateComposeCompilerMetrics")) { freeCompilerArgs = freeCompilerArgs + listOf( "-P", @@ -120,17 +124,6 @@ subprojects { } } } - plugins.withType { - configure { - experimentalRules = true - disabledRules = arrayOf( - "filename", - "experimental:argument-list-wrapping", - "experimental:trailing-comma", - "experimental:comment-wrapping" - ) - } - } plugins.withType { configure { @@ -141,6 +134,13 @@ subprojects { } } + plugins.withType { + configure { + version = libs.versions.ktorfit.get() + logging = project.hasProperty("debugApp") + } + } + plugins.withType { configure { toolVersion = "0.8.7" diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index e6bce779..a6dee92f 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -121,6 +121,8 @@ tasks { } registerTachideskTasks(project) + + getByName("formatKotlinMain").dependsOn("kspKotlin") } kotlin { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0ad2321e..2ea776c9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,14 +1,14 @@ [versions] # Kotlin -kotlin = "1.8.0" +kotlin = "1.8.10" coroutines = "1.6.4" # Serialization -json = "1.4.1" +json = "1.5.0" # Compose -composeGradle = "1.3.0" -composeCompiler = "1.4.0" +composeGradle = "1.3.1" +composeCompiler = "1.4.2" composeAndroidRuntime = "1.3.3" composeAndroidFoundation = "1.3.1" composeAndroidUI = "1.3.3" @@ -23,32 +23,33 @@ imageloader = "1.2.8" materialDialogs = "0.9.2" # Android -androidGradle = "7.4.1" +androidGradle = "7.4.2" core = "1.9.0" appCompat = "1.7.0-alpha02" -activityCompose = "1.6.1" -work = "2.8.0" +activityCompose = "1.7.0" +work = "2.8.1" # Android Lifecycle -lifecycle = "2.6.0-beta01" +lifecycle = "2.6.1" # Swing darklaf = "3.0.2" # Ksp -ksp = "1.8.0-1.0.9" +ksp = "1.8.10-1.0.9" # Dependency Injection kotlinInject = "0.6.1" # Network -ktor = "2.2.3" -ktorfit = "1.0.0-beta18" +ktor = "2.2.4" +ktorfit = "1.0.1" +ktorfitCompiler = "1.0.0" # Logging -slf4j = "2.0.6" -log4j = "2.19.0" -kmlogging = "1.2.1" +slf4j = "2.0.7" +log4j = "2.20.0" +kmlogging = "1.3.0" # Storage okio = "3.3.0" @@ -59,23 +60,23 @@ multiplatformSettings = "1.0.0-alpha01" # Utility desugarJdkLibs = "2.0.2" -aboutLibraries = "10.6.0" +aboutLibraries = "10.6.1" dateTime = "0.4.0" immutableCollections = "0.3.5" kds = "3.4.0" # Localization -moko = "0.20.1" +moko = "0.21.1" # BuildConfigs buildconfig = "3.1.0" buildkonfig = "0.13.3" # Linter -kotlinter = "3.13.0" +kotlinter = "3.14.0" # Version updates -versions = "0.45.0" +versions = "0.46.0" # Optimizer proguard = "7.2.2" @@ -177,39 +178,39 @@ proguard = { module = "com.guardsquare:proguard-gradle", version.ref = "proguard [plugins] # Kotlin -kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin"} -kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin"} -kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin"} -kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin"} +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } # Android -android-library = { id = "com.android.library", version.ref = "androidGradle"} -android-application = { id = "com.android.application", version.ref = "androidGradle"} +android-library = { id = "com.android.library", version.ref = "androidGradle" } +android-application = { id = "com.android.application", version.ref = "androidGradle" } # Compose -compose = { id = "org.jetbrains.compose", version.ref = "composeGradle"} +compose = { id = "org.jetbrains.compose", version.ref = "composeGradle" } # Ksp -ksp = { id = "com.google.devtools.ksp", version.ref = "ksp"} +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } # Network -ktorfit = { id = "de.jensklingenberg.ktorfit", version = "1.0.0"} +ktorfit = { id = "de.jensklingenberg.ktorfit", version.ref = "ktorfitCompiler" } # Localization -moko-gradle = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko"} +moko-gradle = { id = "dev.icerock.mobile.multiplatform-resources", version.ref = "moko" } # BuildConfigs -buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig"} -buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfig"} +buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" } +buildkonfig = { id = "com.codingfeline.buildkonfig", version.ref = "buildkonfig" } # Linter -kotlinter = { id = "org.jmailen.kotlinter", version.ref = "kotlinter"} +kotlinter = { id = "org.jmailen.kotlinter", version.ref = "kotlinter" } # Version updates -versions = { id = "com.github.ben-manes.versions", version.ref = "versions"} +versions = { id = "com.github.ben-manes.versions", version.ref = "versions" } # Utility -aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries"} +aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries" } [bundles] compose-android = [ diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 41d9927a..249e5832 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661e..e1bef7e8 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 1b6c7873..a69d9cb6 100755 --- a/gradlew +++ b/gradlew @@ -205,6 +205,12 @@ set -- \ org.gradle.wrapper.GradleWrapperMain \ "$@" +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + # Use "xargs" to parse quoted args. # # With -n1 it outputs one arg per line, with the quotes and backslashes removed. diff --git a/gradlew.bat b/gradlew.bat index 107acd32..f127cfd4 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/i18n/build.gradle.kts b/i18n/build.gradle.kts index 3b890253..665ad999 100644 --- a/i18n/build.gradle.kts +++ b/i18n/build.gradle.kts @@ -49,6 +49,9 @@ kotlin { tasks { registerLocalizationTask(project) + + getByName("desktopProcessResources") + .dependsOn("generateMRcommonMain", "generateMRdesktopMain") } multiplatformResources { diff --git a/settings.gradle.kts b/settings.gradle.kts index a01bcb5f..6ce2ee83 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -26,5 +26,4 @@ include("android") include("desktop") include("ios") -enableFeaturePreview("VERSION_CATALOGS") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")