From b9ac2b9ff72aa74dab29c2c24240feb424541f33 Mon Sep 17 00:00:00 2001 From: Joaquim Verges Date: Sun, 16 Jan 2022 18:46:44 -0800 Subject: [PATCH] upgrade kotlin and compose --- buildSrc/build.gradle.kts | 2 +- buildSrc/src/main/kotlin/Versions.kt | 4 ++-- .../helium/core/retained/RetainedBlocks.kt | 3 +++ .../multiplatform_app/common/common.podspec | 19 +++++++++---------- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 14db149..b3bcd67 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -9,5 +9,5 @@ repositories { dependencies { implementation("com.android.tools.build:gradle:7.0.2") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31") } diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt index dccee16..79b0093 100644 --- a/buildSrc/src/main/kotlin/Versions.kt +++ b/buildSrc/src/main/kotlin/Versions.kt @@ -7,7 +7,7 @@ object Versions { const val targetSdk = 30 // kotlin std - const val kotlin = "1.5.21" + const val kotlin = "1.5.31" const val coroutines = "1.5.0" // test @@ -27,7 +27,7 @@ object Versions { const val constraint_layout = "2.0.0" const val material_lib = "1.2.0-alpha05" const val navigation = "2.3.1" - const val compose = "1.0.2" + const val compose = "1.0.5" const val compose_activity = "1.3.0" const val compose_constraint_layout = "1.0.0-beta02" const val accompanist = "0.15.0" diff --git a/helium-core/src/androidMain/kotlin/com/joaquimverges/helium/core/retained/RetainedBlocks.kt b/helium-core/src/androidMain/kotlin/com/joaquimverges/helium/core/retained/RetainedBlocks.kt index f2c4733..272dbbb 100644 --- a/helium-core/src/androidMain/kotlin/com/joaquimverges/helium/core/retained/RetainedBlocks.kt +++ b/helium-core/src/androidMain/kotlin/com/joaquimverges/helium/core/retained/RetainedBlocks.kt @@ -31,6 +31,9 @@ inline fun Context.getRetainedLogicBlock(): P { is FragmentActivity -> { ViewModelProvider(this)[P::class.java] } + is ComponentActivity -> { + ViewModelProvider(this)[P::class.java] + } is Fragment -> { ViewModelProvider(this)[P::class.java] } diff --git a/samples/multiplatform_app/common/common.podspec b/samples/multiplatform_app/common/common.podspec index ea8ca55..db5e745 100644 --- a/samples/multiplatform_app/common/common.podspec +++ b/samples/multiplatform_app/common/common.podspec @@ -7,7 +7,6 @@ Pod::Spec.new do |spec| spec.license = '' spec.summary = 'Common code for multiplatform news app' - spec.static_framework = true spec.vendored_frameworks = "build/cocoapods/framework/NewsCommon.framework" spec.libraries = "c++" spec.module_name = "#{spec.name}_umbrella" @@ -17,13 +16,8 @@ Pod::Spec.new do |spec| spec.pod_target_xcconfig = { - 'KOTLIN_TARGET[sdk=iphonesimulator*]' => 'ios_x64', - 'KOTLIN_TARGET[sdk=iphoneos*]' => 'ios_arm', - 'KOTLIN_TARGET[sdk=watchsimulator*]' => 'watchos_x64', - 'KOTLIN_TARGET[sdk=watchos*]' => 'watchos_arm', - 'KOTLIN_TARGET[sdk=appletvsimulator*]' => 'tvos_x64', - 'KOTLIN_TARGET[sdk=appletvos*]' => 'tvos_arm64', - 'KOTLIN_TARGET[sdk=macosx*]' => 'macos_x64' + 'KOTLIN_PROJECT_PATH' => ':samples:multiplatform_app:common', + 'PRODUCT_MODULE_NAME' => 'common', } spec.script_phases = [ @@ -32,10 +26,15 @@ Pod::Spec.new do |spec| :execution_position => :before_compile, :shell_path => '/bin/sh', :script => <<-SCRIPT + if [ "YES" = "$COCOAPODS_SKIP_KOTLIN_BUILD" ]; then + echo "Skipping Gradle build task invocation due to COCOAPODS_SKIP_KOTLIN_BUILD environment variable set to \"YES\"" + exit 0 + fi set -ev REPO_ROOT="$PODS_TARGET_SRCROOT" - "$REPO_ROOT/../../../gradlew" -p "$REPO_ROOT" :samples:multiplatform_app:common:syncFramework \ - -Pkotlin.native.cocoapods.target=$KOTLIN_TARGET \ + "$REPO_ROOT/../../../gradlew" -p "$REPO_ROOT" $KOTLIN_PROJECT_PATH:syncFramework \ + -Pkotlin.native.cocoapods.platform=$PLATFORM_NAME \ + -Pkotlin.native.cocoapods.archs="$ARCHS" \ -Pkotlin.native.cocoapods.configuration=$CONFIGURATION \ -Pkotlin.native.cocoapods.cflags="$OTHER_CFLAGS" \ -Pkotlin.native.cocoapods.paths.headers="$HEADER_SEARCH_PATHS" \