Skip to content

Commit

Permalink
improve pod updater script (#1391)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
weissi authored Feb 13, 2020
1 parent bfde40c commit 589bc7c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/build_podspecs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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=()
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 589bc7c

Please sign in to comment.