Append the git HEAD short ID to the build version for snapshot builds.

This commit is contained in:
Kyle Neideck 2017-02-19 15:14:34 +11:00
parent 60e1b3564b
commit 32723ff04b
No known key found for this signature in database
GPG key ID: CAA8D9B8E39EC18C
2 changed files with 15 additions and 5 deletions

View file

@ -62,8 +62,4 @@ script:
- if ls -la "/Library/LaunchDaemons/com.bearisdriving.BGM.XPCHelper.plist"; then false; fi
# Post on IRC when Travis builds finish.
notifications:
irc:
channels:
- "irc.freenode.org#backgroundmusic"
use_notice: true
skip_join: true
irc: "irc.freenode.org#backgroundmusic"

View file

@ -568,6 +568,7 @@
1CB8B3321BBA75EF000E2DD1 /* Sources */,
1CB8B3331BBA75EF000E2DD1 /* Frameworks */,
1CB8B3341BBA75EF000E2DD1 /* Resources */,
1CD440581E593DDD0064E0BC /* ShellScript */,
);
buildRules = (
);
@ -748,6 +749,19 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
1CD440581E593DDD0064E0BC /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "# Append the git HEAD short ID to the build version for snapshot builds. Thanks to\n# Václav Slavík for the initial version of this: http://stackoverflow.com/a/26354117/1091063\n# TODO: Update CFBundleVersion as well?\nTAG=$(/usr/bin/git tag --points-at HEAD 2>/dev/null)\nif [[ $? -eq 0 ]] && [[ \"${TAG}\" == \"\" ]]; then # If HEAD isn't tagged, this is a snapshot build.\n HEAD=$(/usr/bin/git rev-list HEAD --max-count=1 --abbrev-commit)\n INFO_PLIST=\"${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}\"\n if [[ \"${CONFIGURATION}\" != \"Release\" ]]; then\n TYPE=\"DEBUG\"\n else\n TYPE=\"SNAPSHOT\"\n fi\n if [[ -f \"$INFO_PLIST\" ]]; then\n CURRENT_VERSION=$(/usr/libexec/PlistBuddy -c \"Print :CFBundleShortVersionString\" \"${INFO_PLIST}\")\n BASE_VERSION=$(/usr/libexec/PlistBuddy -c \"Print :BGMBundleVersionBase\" \"${INFO_PLIST}\" 2>/dev/null)\n if [[ $? -ne 0 ]] || [[ \"${BASE_VERSION}\" == \"\" ]]; then\n BASE_VERSION=\"${CURRENT_VERSION}\"\n /usr/libexec/PlistBuddy -c \"Add :BGMBundleVersionBase string ${BASE_VERSION}\" \"${INFO_PLIST}\"\n fi\n NEW_VERSION=\"${BASE_VERSION}-${TYPE}-${HEAD}\"\n if [[ \"${NEW_VERSION}\" != \"${CURRENT_VERSION}\" ]]; then # Only touch the file if we need to.\n /usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString ${NEW_VERSION}\" \"${INFO_PLIST}\"\n fi\n fi\nfi";
};
276972891CAFCE91007A2F7C /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 8;