Skip to content

Commit

Permalink
upload-symbols: Retrieve version from dynamically replaced plist
Browse files Browse the repository at this point in the history
  • Loading branch information
KenjiTakahashi committed Nov 30, 2021
1 parent 4afb570 commit eb77413
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions xcode-upload-symbols/upload-symbols.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,22 @@ fi
url=${BUGFENDER_SYMBOLICATION_URL:-https://dashboard.bugfender.com/}
[[ "$url" != */ ]] && url="$url/"

version=$(/usr/libexec/PlistBuddy -c 'Print CFBundleShortVersionString' "$INFOPLIST_FILE")
build=$(/usr/libexec/PlistBuddy -c 'Print CFBundleVersion' "$INFOPLIST_FILE")
function getValue() {
local value=$(/usr/libexec/PlistBuddy -c "Print $1" "$INFOPLIST_FILE")
# Assuming that nobody uses version string that actually looks
# like variable substitution (i.e. `$(<value>)`)
if [[ "$value" == \$\(*\) ]]; then
local envValue=${value:2:${#value}-3} # Cut off $() wrapping
envValue=${!envValue} # Get env var by name
if [ -n "$envValue" ]; then
value="$envValue"
fi
fi
echo "$value"
}

version="$(getValue 'CFBundleShortVersionString')"
build="$(getValue 'CFBundleVersion')"

dsympath="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME"
if [ -f "$dsympath" ] && [ ! -s "$dsympath" ]; then
Expand Down

0 comments on commit eb77413

Please sign in to comment.