Set a date based version number for now.

This commit is contained in:
Jeroen Leenarts 2018-09-26 09:30:14 +02:00
parent 2dc9392904
commit ab6afdab39
2 changed files with 9 additions and 2 deletions

View File

@ -1,14 +1,20 @@
#!/bin/bash #!/bin/bash
git=$(sh /etc/profile; which git) git=$(sh /etc/profile; which git)
date=$(sh /etc/profile; which date)
number_of_commits=$("$git" rev-list HEAD --count) number_of_commits=$("$git" rev-list HEAD --count)
date_timestamp=$("$date" +%Y%m%d)
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH" target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist" dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"
for plist in "$target_plist" "$dsym_plist"; do for plist in "$target_plist" "$dsym_plist"; do
if [ -f "$plist" ]; then if [ -f "$plist" ]; then
echo $date_timestamp
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${number_of_commits}" "$plist" /usr/libexec/PlistBuddy -c "Set :CFBundleVersion ${number_of_commits}" "$plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString 0.0.${date_timestamp}" "$plist"
fi fi
done done
@ -17,6 +23,7 @@ settings_root_plist="$TARGET_BUILD_DIR/WireGuard.app/Settings.bundle/Root.plist"
if [ -f "$settings_root_plist" ]; then if [ -f "$settings_root_plist" ]; then
settingsVersion="`agvtool what-marketing-version -terse1`(${number_of_commits})" settingsVersion="`agvtool what-marketing-version -terse1`(${number_of_commits})"
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $settingsVersion" "$settings_root_plist" /usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue $settingsVersion" "$settings_root_plist"
/usr/libexec/PlistBuddy -c "Set :PreferenceSpecifiers:1:DefaultValue 0.0.$date_timestamp" "$settings_root_plist"
else else
echo "Could not find: $settings_root_plist" echo "Could not find: $settings_root_plist"
exit 1 exit 1

View File

@ -534,7 +534,7 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = $SRCROOT/Scripts/set_build_number.sh; shellScript = "$SRCROOT/Scripts/set_build_number.sh\n";
}; };
6F743EFD0F63EA8C605CE349 /* [CP] Embed Pods Frameworks */ = { 6F743EFD0F63EA8C605CE349 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;