From 589bc7cf0819367e8acd3f23e008880cdca0146c Mon Sep 17 00:00:00 2001 From: Johannes Weiss Date: Thu, 13 Feb 2020 07:32:11 +0000 Subject: [PATCH] improve pod updater script (#1391) Motivation: Somewhere in github or Cocoapods, there seems to be a problem that if you push a pod A and quickly after a pod B that depends on A with exactly the version you just pushed, the validation sometimes fails claiming that the right version of A is not available. The workaround is to wait a bit and to call `pod repo update`. The modifications in this PR alleviate this problem somewhat, it now calls `pod repo update` by itself and should it still go wrong, there's a new `-f` (from) option that can be used to skip over all pods until the one that failed last. Example scripts/build_podspecs.sh -u -f SwiftNIO 2.13.1 Modifications: - update the pod repo often - provide a skipping option to skip over earlier repos in case something still goes wrong Result: Easier way to update the pods. --- scripts/build_podspecs.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/build_podspecs.sh b/scripts/build_podspecs.sh index 42891ca76..3e13d78a2 100755 --- a/scripts/build_podspecs.sh +++ b/scripts/build_podspecs.sh @@ -20,15 +20,21 @@ function usage() { echo echo "OPTIONS:" echo " -u: Additionally, upload the podspecs as they are generated" + echo " -f: Skip over all targets before the specified target" } OPTIND=1 upload=false -while getopts ":u" opt; do +skip_until="" + +while getopts ":uf:" opt; do case $opt in u) upload=true ;; + f) + skip_until="$OPTARG" + ;; \?) usage exit 1 @@ -59,6 +65,14 @@ for target in "${targets[@]}"; do if [[ "$target" == "_NIO1APIShims" ]]; then continue fi + + if [[ -n "$skip_until" && "$target" != "$skip_until" ]]; then + echo "Skipping $target" + continue + elif [[ "$skip_until" == "$target" ]]; then + skip_until="" + fi + echo "Building podspec for $target" dependencies=() @@ -97,6 +111,7 @@ Pod::Spec.new do |s| end EOF + pod repo update # last chance of getting the latest versions of previous pushed pods if $upload; then echo "Uploading ${tmpfile}/${target}.podspec" pod trunk push "${tmpfile}/${target}.podspec"