From 72b679a3fcd168f31b2a13d9b7431729a413a291 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Fortier Date: Wed, 6 Dec 2023 17:30:47 -0500 Subject: [PATCH] Update to Kotlin 1.9.21 (#55) --- Gemfile | 3 +-- Gemfile.lock | 29 ++++++++++++++++-------- README.md | 18 +++++++++++---- gradle/libs.versions.toml | 8 +++---- gradle/wrapper/gradle-wrapper.properties | 2 +- ios/Gemfile | 2 +- ios/Gemfile.lock | 28 ++++++++++++++++------- ios/Podfile.lock | 2 +- ios/iosApp/GreetingView.swift | 6 ++--- shared/Shared.podspec | 11 +++++++++ shared/build.gradle.kts | 29 +++++++++--------------- 11 files changed, 85 insertions(+), 53 deletions(-) diff --git a/Gemfile b/Gemfile index 0166ca6..db85755 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,4 @@ source 'https://rubygems.org' -gem 'cocoapods', '~> 1.13' +gem 'cocoapods', '~> 1.14' gem 'cocoapods-generate', '~> 2.2' -gem 'activesupport', '7.0.8' # Temporary workaround to fix cocoapods plugin crashing with v7.1.1 diff --git a/Gemfile.lock b/Gemfile.lock index 46fca56..25bbe7d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,10 +3,15 @@ GEM specs: CFPropertyList (3.0.6) rexml - activesupport (7.0.8) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) @@ -14,13 +19,15 @@ GEM httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) + base64 (0.2.0) + bigdecimal (3.1.4) claide (1.1.0) - cocoapods (1.13.0) + cocoapods (1.14.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.13.0) + cocoapods-core (= 1.14.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.6.0, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-trunk (>= 1.6.0, < 2.0) @@ -33,7 +40,7 @@ GEM nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.23.0, < 2.0) - cocoapods-core (1.13.0) + cocoapods-core (1.14.3) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -45,7 +52,7 @@ GEM typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) cocoapods-disable-podfile-validations (0.2.0) - cocoapods-downloader (1.6.3) + cocoapods-downloader (2.1) cocoapods-generate (2.2.4) cocoapods-disable-podfile-validations (>= 0.1.1, < 0.3.0) cocoapods-plugins (1.0.0) @@ -57,6 +64,9 @@ GEM cocoapods-try (1.2.0) colored2 (3.1.2) concurrent-ruby (1.2.2) + connection_pool (2.4.1) + drb (2.2.0) + ruby2_keywords escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) @@ -70,13 +80,15 @@ GEM json (2.6.3) minitest (5.20.0) molinillo (0.8.0) + mutex_m (0.2.0) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) public_suffix (4.0.7) rexml (3.2.6) ruby-macho (2.5.1) - typhoeus (1.4.0) + ruby2_keywords (0.0.5) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -92,8 +104,7 @@ PLATFORMS ruby DEPENDENCIES - activesupport (= 7.0.8) - cocoapods (~> 1.13) + cocoapods (~> 1.14) cocoapods-generate (~> 2.2) BUNDLED WITH diff --git a/README.md b/README.md index 897d1f8..bc4bebe 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@


This repository is the stable base upon which we build our Kotlin Multiplatform projects at Mirego.
We want to share it with the world so you can build awesome multiplatform applications too.

- + @@ -16,7 +16,7 @@ our [blog post](https://shift.mirego.com/en/boilerplate-projects). This boilerplate comes with batteries included, you’ll find: - A brand new [Kotlin Multiplatform](https://kotlinlang.org/docs/multiplatform.html) project using - [Kotlin 1.9.10](https://github.com/JetBrains/kotlin/releases/tag/v1.9.10) and + [Kotlin 1.9.21](https://github.com/JetBrains/kotlin/releases/tag/v1.9.21) and the [Cocoapods Plugin](https://kotlinlang.org/docs/native-cocoapods.html) - An Android app using [Jetpack Compose](https://developer.android.com/jetpack/compose) - An iOS app using [SwiftUI](https://developer.apple.com/xcode/swiftui) @@ -36,9 +36,12 @@ This boilerplate comes with batteries included, you’ll find: ## Usage There are 2 ways to use this boilerplate: -1. From the [`main` branch](https://github.com/mirego/kmp-boilerplate/tree/main) — This branch is the "lean" version, it does not contain any strongly opinionated + +1. From the [`main` branch](https://github.com/mirego/kmp-boilerplate/tree/main) — This branch is + the "lean" version, it does not contain any strongly opinionated libraries or tools. It is a good starting point if you want to build your own boilerplate. -2. From the [`main-full` branch](https://github.com/mirego/kmp-boilerplate/tree/main-full) — This branch contains all the opinionated libraries and tools +2. From the [`main-full` branch](https://github.com/mirego/kmp-boilerplate/tree/main-full) — This + branch contains all the opinionated libraries and tools described in the [Preferred libraries](#preferred-libraries) section. It is a good starting point if you want to quickly start building your app the _Mirego way_. @@ -97,7 +100,12 @@ started: ## OWASP Dependency-Check -[OWASP Dependency-Check](http://jeremylong.github.io/DependencyCheck/index.html) is installed as a Gradle plugin to scan your project to identify the use of known vulnerable components. It mainly checks for vulnerabilities in Gradle dependencies, but if [bundle-audit](https://github.com/rubysec/bundler-audit) is present on the system, it will also scan the Ruby Gems dependencies. It also has the capability to scan for Cocoapods/Swift Package Manager dependencies if executed on a macOS system. +[OWASP Dependency-Check](http://jeremylong.github.io/DependencyCheck/index.html) is installed as a +Gradle plugin to scan your project to identify the use of known vulnerable components. It mainly +checks for vulnerabilities in Gradle dependencies, but +if [bundle-audit](https://github.com/rubysec/bundler-audit) is present on the system, it will also +scan the Ruby Gems dependencies. It also has the capability to scan for Cocoapods/Swift Package +Manager dependencies if executed on a macOS system. ## License diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index dcc546c..b0f3e0b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] -androidComposeCompiler = "1.5.3" -androidGradlePlugin = "8.1.2" -androidxActivityCompose = "1.8.0" +androidComposeCompiler = "1.5.6" +androidGradlePlugin = "8.2.0" +androidxActivityCompose = "1.8.1" androidxAppcompat = "1.6.1" androidxComposeBom = "2023.10.01" -kotlin = "1.9.10" +kotlin = "1.9.21" kotlinxCoroutines = "1.7.3" kotlinxSerialization = "1.6.0" ktlint = "11.6.1" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 7cd02cf..6cbcc97 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Oct 12 13:41:45 EDT 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/ios/Gemfile b/ios/Gemfile index 0927832..116623c 100644 --- a/ios/Gemfile +++ b/ios/Gemfile @@ -1,3 +1,3 @@ source 'https://rubygems.org' -gem 'cocoapods', '~> 1.13' +gem 'cocoapods', '~> 1.14' diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock index 684e139..de785c8 100644 --- a/ios/Gemfile.lock +++ b/ios/Gemfile.lock @@ -3,10 +3,15 @@ GEM specs: CFPropertyList (3.0.6) rexml - activesupport (7.0.8) + activesupport (7.1.2) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) addressable (2.8.5) public_suffix (>= 2.0.2, < 6.0) @@ -14,13 +19,15 @@ GEM httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) atomos (0.1.3) + base64 (0.2.0) + bigdecimal (3.1.4) claide (1.1.0) - cocoapods (1.13.0) + cocoapods (1.14.3) addressable (~> 2.8) claide (>= 1.0.2, < 2.0) - cocoapods-core (= 1.13.0) + cocoapods-core (= 1.14.3) cocoapods-deintegrate (>= 1.0.3, < 2.0) - cocoapods-downloader (>= 1.6.0, < 2.0) + cocoapods-downloader (>= 2.1, < 3.0) cocoapods-plugins (>= 1.0.0, < 2.0) cocoapods-search (>= 1.0.0, < 2.0) cocoapods-trunk (>= 1.6.0, < 2.0) @@ -33,7 +40,7 @@ GEM nap (~> 1.0) ruby-macho (>= 2.3.0, < 3.0) xcodeproj (>= 1.23.0, < 2.0) - cocoapods-core (1.13.0) + cocoapods-core (1.14.3) activesupport (>= 5.0, < 8) addressable (~> 2.8) algoliasearch (~> 1.0) @@ -44,7 +51,7 @@ GEM public_suffix (~> 4.0) typhoeus (~> 1.0) cocoapods-deintegrate (1.0.5) - cocoapods-downloader (1.6.3) + cocoapods-downloader (2.1) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.1) @@ -54,6 +61,9 @@ GEM cocoapods-try (1.2.0) colored2 (3.1.2) concurrent-ruby (1.2.2) + connection_pool (2.4.1) + drb (2.2.0) + ruby2_keywords escape (0.0.4) ethon (0.16.0) ffi (>= 1.15.0) @@ -67,13 +77,15 @@ GEM json (2.6.3) minitest (5.20.0) molinillo (0.8.0) + mutex_m (0.2.0) nanaimo (0.3.0) nap (1.1.0) netrc (0.11.0) public_suffix (4.0.7) rexml (3.2.6) ruby-macho (2.5.1) - typhoeus (1.4.0) + ruby2_keywords (0.0.5) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) @@ -89,7 +101,7 @@ PLATFORMS arm64-darwin-23 DEPENDENCIES - cocoapods (~> 1.13) + cocoapods (~> 1.14) BUNDLED WITH 2.4.20 diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 67c3147..2389a29 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -20,4 +20,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 83ebf5d7b61ce65029f18160027c7392430ee27f -COCOAPODS: 1.13.0 +COCOAPODS: 1.14.3 diff --git a/ios/iosApp/GreetingView.swift b/ios/iosApp/GreetingView.swift index 36b0f57..321d1ed 100644 --- a/ios/iosApp/GreetingView.swift +++ b/ios/iosApp/GreetingView.swift @@ -10,8 +10,6 @@ struct GreetingView: View { } } -struct GreetingView_Previews: PreviewProvider { - static var previews: some View { - GreetingView() - } +#Preview { + GreetingView() } diff --git a/shared/Shared.podspec b/shared/Shared.podspec index 59d76af..9e1ee67 100644 --- a/shared/Shared.podspec +++ b/shared/Shared.podspec @@ -11,6 +11,17 @@ Pod::Spec.new do |spec| + if !Dir.exist?('build/cocoapods/framework/Shared.framework') || Dir.empty?('build/cocoapods/framework/Shared.framework') + raise " + + Kotlin framework 'Shared' doesn't exist yet, so a proper Xcode project can't be generated. + 'pod install' should be executed after running ':generateDummyFramework' Gradle task: + + ./gradlew :shared:generateDummyFramework + + Alternatively, proper pod installation is performed during Gradle sync in the IDE (if Podfile location is set)" + end + spec.pod_target_xcconfig = { 'KOTLIN_PROJECT_PATH' => ':shared', 'PRODUCT_MODULE_NAME' => 'Shared', diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 215619f..a2d40a9 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,5 +1,7 @@ @file:Suppress("UNUSED_VARIABLE") +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi + plugins { alias(libs.plugins.kotlin.multiplatform) alias(libs.plugins.kotlin.native.cocoapods) @@ -16,7 +18,8 @@ kotlin { androidTarget { publishAllLibraryVariants() } - ios() + iosX64() + iosArm64() iosSimulatorArm64() cocoapods { @@ -38,33 +41,24 @@ kotlin { } } - val commonMain by getting { + commonMain { dependencies { implementation(libs.kotlinx.coroutines.core) implementation(libs.kotlinx.serialization.json) } } - val commonTest by getting { + + commonTest { dependencies { implementation(kotlin("test")) implementation(libs.kotlinx.coroutines.test) } } - val androidMain by getting - val androidUnitTest by getting + } - val iosX64Main by getting - val iosArm64Main by getting - val iosSimulatorArm64Main by getting - val iosMain by getting { - iosSimulatorArm64Main.dependsOn(this) - } - val iosX64Test by getting - val iosArm64Test by getting - val iosSimulatorArm64Test by getting - val iosTest by getting { - iosSimulatorArm64Test.dependsOn(this) - } + @OptIn(ExperimentalKotlinGradlePluginApi::class) + compilerOptions { + freeCompilerArgs.add("-Xexpect-actual-classes") } } @@ -76,7 +70,6 @@ android { defaultConfig { minSdk = 21 } - compileOptions { sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17