Skip to content

Commit 38b606b

Browse files
authored
Update update-cocoa.sh to also update the sample podspec and run pod update (#490)
* Update * Update
1 parent 5269f77 commit 38b606b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

scripts/update-cocoa.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ cd $(dirname "$0")/../
55
config_file='buildSrc/src/main/java/Config.kt'
66
podspec_file='sentry-kotlin-multiplatform/sentry_kotlin_multiplatform.podspec'
77
plugin_properties_file='sentry-kotlin-multiplatform-gradle-plugin/gradle.properties'
8+
sample_podspec_file='sentry-samples/kmp-app-cocoapods/shared/shared.podspec'
9+
sample_ios_app_dir='sentry-samples/kmp-app-cocoapods/iosApp'
810

911
config_content=$(cat $config_file)
1012
podspec_content=$(cat $podspec_file)
1113
plugin_properties_content=$(cat $plugin_properties_file)
14+
sample_podspec_content=$(cat $sample_podspec_file)
1215

1316
config_regex='(sentryCocoaVersion *= *)"([0-9\.]+)"'
1417
podspec_regex="('Sentry', *)'([0-9\.]+)'"
@@ -39,6 +42,14 @@ fi
3942
plugin_properties_whole_match=${BASH_REMATCH[0]}
4043
plugin_properties_var_name=${BASH_REMATCH[1]}
4144

45+
if ! [[ $sample_podspec_content =~ $podspec_regex ]]; then
46+
echo "Failed to find the Cocoa version in $sample_podspec_file"
47+
exit 1
48+
fi
49+
50+
sample_podspec_whole_match=${BASH_REMATCH[0]}
51+
sample_podspec_var_name=${BASH_REMATCH[1]}
52+
4253
case $1 in
4354
get-version)
4455
# We only require to return the version number of one of the files
@@ -59,6 +70,14 @@ set-version)
5970
# Update the version in the plugin properties file
6071
newValue="${plugin_properties_var_name}$2"
6172
echo "${plugin_properties_content/${plugin_properties_whole_match}/$newValue}" >$plugin_properties_file
73+
74+
# Update the version in the sample podspec file
75+
newValue="${sample_podspec_var_name}'$2'"
76+
echo "${sample_podspec_content/${sample_podspec_whole_match}/$newValue}" >$sample_podspec_file
77+
78+
# Run pod update in the sample iOS app directory to update Podfile.lock
79+
echo "Running pod update in $sample_ios_app_dir..."
80+
(cd $sample_ios_app_dir && pod update)
6281
;;
6382
*)
6483
echo "Unknown argument $1"

0 commit comments

Comments
 (0)