mirror of
https://github.com/kyleneideck/BackgroundMusic
synced 2024-11-10 06:34:22 +00:00
Fix BGMDriver and BGMXPCHelper's version strings for SNAPSHOT builds.
And DEBUG builds. The "-SNAPSHOT-abc0123" suffix was only being added to the version string for BGMApp.
This commit is contained in:
parent
63b458abdc
commit
23ecf7e46e
3 changed files with 135 additions and 5 deletions
|
@ -256,6 +256,7 @@
|
|||
19FE799A86A285DD9423D164 /* BGMStatusBarItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGMStatusBarItem.h; sourceTree = "<group>"; };
|
||||
19FE7DE5E3BA0046ED2BC3C6 /* BGMPlayThroughRTLogger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BGMPlayThroughRTLogger.cpp; sourceTree = "<group>"; };
|
||||
19FE7FDAEBC3F0DB8C99823B /* BGMVolumeChangeListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGMVolumeChangeListener.h; sourceTree = "<group>"; };
|
||||
1C09150723F010FB001EB0E1 /* set-version.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-version.sh"; sourceTree = "<group>"; };
|
||||
1C0BD0A31BF1A8E6004F4CF5 /* BGMAutoPauseMusicPrefs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMAutoPauseMusicPrefs.h; path = Preferences/BGMAutoPauseMusicPrefs.h; sourceTree = "<group>"; };
|
||||
1C0BD0A41BF1A8E6004F4CF5 /* BGMAutoPauseMusicPrefs.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = BGMAutoPauseMusicPrefs.mm; path = Preferences/BGMAutoPauseMusicPrefs.mm; sourceTree = "<group>"; };
|
||||
1C0BD0A61BF1B029004F4CF5 /* BGMPreferencesMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BGMPreferencesMenu.h; path = Preferences/BGMPreferencesMenu.h; sourceTree = "<group>"; };
|
||||
|
@ -485,6 +486,15 @@
|
|||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
1C09150623F010FB001EB0E1 /* Scripts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1C09150723F010FB001EB0E1 /* set-version.sh */,
|
||||
);
|
||||
name = Scripts;
|
||||
path = ../SharedSource/Scripts;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1C0BD0A21BF1A827004F4CF5 /* Preferences Menu */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -558,6 +568,7 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
27D643B41C9FABBD00737F6E /* BGM_Types.h */,
|
||||
1C09150623F010FB001EB0E1 /* Scripts */,
|
||||
2771700F1CA0C83B00AB34B4 /* BGM_Utils.h */,
|
||||
27FB8C2E1DE468320084DB9D /* BGM_Utils.cpp */,
|
||||
27D643C41C9FBE5600737F6E /* BGM_TestUtils.h */,
|
||||
|
@ -851,7 +862,7 @@
|
|||
1CB8B3321BBA75EF000E2DD1 /* Sources */,
|
||||
1CB8B3331BBA75EF000E2DD1 /* Frameworks */,
|
||||
1CB8B3341BBA75EF000E2DD1 /* Resources */,
|
||||
1CD440581E593DDD0064E0BC /* ShellScript */,
|
||||
1CD440581E593DDD0064E0BC /* Run Script - set-version.sh */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -887,7 +898,8 @@
|
|||
27379B8B1C7F57DA0084A24C /* Sources */,
|
||||
27379B8C1C7F57DA0084A24C /* Frameworks */,
|
||||
27379B8D1C7F57DA0084A24C /* Resources */,
|
||||
276972891CAFCE91007A2F7C /* ShellScript */,
|
||||
1C09150923F0208F001EB0E1 /* Run Script - set-version.sh */,
|
||||
276972891CAFCE91007A2F7C /* Run Script - post_install.sh */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -1042,26 +1054,46 @@
|
|||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
1CD440581E593DDD0064E0BC /* ShellScript */ = {
|
||||
1C09150923F0208F001EB0E1 /* Run Script - set-version.sh */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script - set-version.sh";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Append the git HEAD short ID to the build version for SNAPSHOT and DEBUG builds.\n\"$SRCROOT/../SharedSource/Scripts/set-version.sh\"\n";
|
||||
};
|
||||
1CD440581E593DDD0064E0BC /* Run Script - set-version.sh */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script - set-version.sh";
|
||||
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?\n\n# If HEAD isn't tagged, or has \"SNAPSHOT\" or \"DEBUG\" in the tag name, this is a snapshot build.\n# If HEAD is tagged more than once, use the most recent.\nTAG=$(/usr/bin/git tag --points-at HEAD --sort='-taggerdate' 2>/dev/null | head -n 1)\nif [[ $? -eq 0 ]] && ( [[ \"${TAG}\" == \"\" ]] || \\\n [[ \"${TAG}\" =~ .*SNAPSHOT.* ]] || \\\n [[ \"${TAG}\" =~ .*DEBUG.* ]] ); then\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\n";
|
||||
shellScript = "# Append the git HEAD short ID to the build version for SNAPSHOT and DEBUG builds.\n\"$SRCROOT/../SharedSource/Scripts/set-version.sh\"\n";
|
||||
};
|
||||
276972891CAFCE91007A2F7C /* ShellScript */ = {
|
||||
276972891CAFCE91007A2F7C /* Run Script - post_install.sh */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 8;
|
||||
files = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script - post_install.sh";
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
19FE7B8CE9148B3D8D7517C6 /* BGM_Control.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BGM_Control.h; sourceTree = "<group>"; };
|
||||
19FE7BC3396C4E50D21E1BC8 /* BGM_Control.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BGM_Control.cpp; sourceTree = "<group>"; };
|
||||
19FE7E6DC2A1B61211D74782 /* BGM_MuteControl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BGM_MuteControl.cpp; sourceTree = "<group>"; };
|
||||
1C09150523F010E8001EB0E1 /* set-version.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "set-version.sh"; sourceTree = "<group>"; };
|
||||
1C0CB6A61C4E06C00084C15A /* CAAtomicStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CAAtomicStack.h; path = PublicUtility/CAAtomicStack.h; sourceTree = "<group>"; };
|
||||
1C0CB6A71C4E06F70084C15A /* CAAtomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CAAtomic.h; path = PublicUtility/CAAtomic.h; sourceTree = "<group>"; };
|
||||
1C0CB6A91C50A3AF0084C15A /* CAAutoDisposer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CAAutoDisposer.h; path = PublicUtility/CAAutoDisposer.h; sourceTree = "<group>"; };
|
||||
|
@ -203,6 +204,15 @@
|
|||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
1C09150423F010E8001EB0E1 /* Scripts */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1C09150523F010E8001EB0E1 /* set-version.sh */,
|
||||
);
|
||||
name = Scripts;
|
||||
path = ../SharedSource/Scripts;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1C0CB6AF1C642C600084C15A /* DeviceClients */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -352,6 +362,7 @@
|
|||
27D643B71C9FABF600737F6E /* BGM_Types.h */,
|
||||
2771700E1CA0C16200AB34B4 /* BGM_Utils.h */,
|
||||
275343BC1DE9B44900DF3858 /* BGM_Utils.cpp */,
|
||||
1C09150423F010E8001EB0E1 /* Scripts */,
|
||||
27D643C21C9FBC5800737F6E /* BGM_TestUtils.h */,
|
||||
27D643B81C9FABF600737F6E /* BGMXPCProtocols.h */,
|
||||
);
|
||||
|
@ -396,6 +407,7 @@
|
|||
1CB8B3601BBBB78D000E2DD1 /* Sources */,
|
||||
1CB8B3611BBBB78D000E2DD1 /* Frameworks */,
|
||||
1CB8B3621BBBB78D000E2DD1 /* Resources */,
|
||||
1C09150823F01E6D001EB0E1 /* Run Script - set-version.sh */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
|
@ -483,6 +495,27 @@
|
|||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
1C09150823F01E6D001EB0E1 /* Run Script - set-version.sh */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
);
|
||||
name = "Run Script - set-version.sh";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Append the git HEAD short ID to the build version for SNAPSHOT and DEBUG builds.\n\"$SRCROOT/../SharedSource/Scripts/set-version.sh\"\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
1C8034D61BDD073B00668E00 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
|
|
65
SharedSource/Scripts/set-version.sh
Executable file
65
SharedSource/Scripts/set-version.sh
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
|
||||
# This file is part of Background Music.
|
||||
#
|
||||
# Background Music is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 2 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# Background Music is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Background Music. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#
|
||||
# set-version.sh
|
||||
# SharedSource
|
||||
#
|
||||
# Copyright © 2020 Kyle Neideck
|
||||
#
|
||||
# Append the git HEAD short ID to the build version for SNAPSHOT and DEBUG builds. For example,
|
||||
# this might change the version string from "0.4.0" to "0.4.0-SNAPSHOT-abc0123".
|
||||
#
|
||||
# Thanks to Václav Slavík for the initial version of this:
|
||||
# <http://stackoverflow.com/a/26354117/1091063>.
|
||||
#
|
||||
# TODO: Update CFBundleVersion as well?
|
||||
#
|
||||
|
||||
# If HEAD isn't tagged, or has "SNAPSHOT" or "DEBUG" in the tag name, this is a snapshot build.
|
||||
# If HEAD is tagged more than once, use the most recent.
|
||||
TAG=$(/usr/bin/git tag --points-at HEAD --sort='-taggerdate' 2>/dev/null | head -n 1)
|
||||
|
||||
if [[ $? -eq 0 ]] && ( [[ "${TAG}" == "" ]] || \
|
||||
[[ "${TAG}" =~ .*SNAPSHOT.* ]] || \
|
||||
[[ "${TAG}" =~ .*DEBUG.* ]] ); then
|
||||
head_short_id=$(/usr/bin/git rev-list HEAD --max-count=1 --abbrev-commit)
|
||||
info_plist="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
|
||||
|
||||
if [[ "${CONFIGURATION}" != "Release" ]]; then
|
||||
build_type="DEBUG"
|
||||
else
|
||||
build_type="SNAPSHOT"
|
||||
fi
|
||||
|
||||
if [[ -f "$info_plist" ]]; then
|
||||
current_version=$(/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "${info_plist}")
|
||||
base_version=$(/usr/libexec/PlistBuddy -c "Print :BGMBundleVersionBase" "${info_plist}" 2>/dev/null)
|
||||
|
||||
if [[ $? -ne 0 ]] || [[ "${base_version}" == "" ]]; then
|
||||
base_version="${current_version}"
|
||||
/usr/libexec/PlistBuddy -c "Add :BGMBundleVersionBase string ${base_version}" "${info_plist}"
|
||||
fi
|
||||
|
||||
new_version="${base_version}-${build_type}-${head_short_id}"
|
||||
|
||||
if [[ "${new_version}" != "${current_version}" ]]; then # Only touch the file if we need to.
|
||||
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${new_version}" "${info_plist}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Reference in a new issue