From 0383d0333ecb900844c3464241a5d172730d7402 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 25 Jul 2022 10:15:48 -0400 Subject: [PATCH 1/4] Add build date (i.e. version) into Info.plist. --- .../Clock Signal.xcodeproj/project.pbxproj | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 89dc7e632..bdc4c240a 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -5000,6 +5000,7 @@ isa = PBXNativeTarget; buildConfigurationList = 4BB73EC61B587A5100552FC2 /* Build configuration list for PBXNativeTarget "Clock Signal" */; buildPhases = ( + 4B2D26A8288EDAFB00F27D66 /* ShellScript */, 4BB73E9A1B587A5100552FC2 /* Sources */, 4BB73E9B1B587A5100552FC2 /* Frameworks */, 4BB73E9C1B587A5100552FC2 /* Resources */, @@ -5467,6 +5468,26 @@ }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 4B2D26A8288EDAFB00F27D66 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "#!/bin/bash\nbuildNumber=$(date -u \"+%Y-%M-%d\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n"; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 4B055A661FAE763F0060FFFF /* Sources */ = { isa = PBXSourcesBuildPhase; From 8679854c91188ec718e203ae36fd78daad888342 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 25 Jul 2022 10:21:25 -0400 Subject: [PATCH 2/4] Update copyright year, use valid version numbers. --- OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index bdc4c240a..1b7d593bb 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -5484,7 +5484,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#!/bin/bash\nbuildNumber=$(date -u \"+%Y-%M-%d\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n"; + shellScript = "#!/bin/bash\nbuildNumber=$(date -u \"+%Y.%M.%d\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $buildNumber\" \"$INFOPLIST_FILE\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\nbuildYear=$(date -u \"+%Y\")\n/usr/libexec/PlistBuddy -c \"Set :NSHumanReadableCopyright Copyright 2015–$buildYear Thomas Harte. All rights reserved.\" \"$INFOPLIST_FILE\"\n"; }; /* End PBXShellScriptBuildPhase section */ From f2041629861686f45103791eb58c6edd5bf62826 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 25 Jul 2022 10:33:15 -0400 Subject: [PATCH 3/4] Use valid version numbers, only for archive builds. --- OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 1b7d593bb..487092e8c 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -5000,7 +5000,7 @@ isa = PBXNativeTarget; buildConfigurationList = 4BB73EC61B587A5100552FC2 /* Build configuration list for PBXNativeTarget "Clock Signal" */; buildPhases = ( - 4B2D26A8288EDAFB00F27D66 /* ShellScript */, + 4B2D26A8288EDAFB00F27D66 /* Set Archive Version Number */, 4BB73E9A1B587A5100552FC2 /* Sources */, 4BB73E9B1B587A5100552FC2 /* Frameworks */, 4BB73E9C1B587A5100552FC2 /* Resources */, @@ -5469,7 +5469,7 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 4B2D26A8288EDAFB00F27D66 /* ShellScript */ = { + 4B2D26A8288EDAFB00F27D66 /* Set Archive Version Number */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; files = ( @@ -5478,13 +5478,14 @@ ); inputPaths = ( ); + name = "Set Archive Version Number"; outputFileListPaths = ( ); outputPaths = ( ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#!/bin/bash\nbuildNumber=$(date -u \"+%Y.%M.%d\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $buildNumber\" \"$INFOPLIST_FILE\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\nbuildYear=$(date -u \"+%Y\")\n/usr/libexec/PlistBuddy -c \"Set :NSHumanReadableCopyright Copyright 2015–$buildYear Thomas Harte. All rights reserved.\" \"$INFOPLIST_FILE\"\n"; + shellScript = "#!/bin/bash\n\n# Change fields only for archive builds; this helps to avoid source control pollution.\nif [ $CI_XCODEBUILD_ACTION != 'archive' ]; then\n exit 0\nfi\n\n# Set both version numbers to yy.mm.dd.\nbuildNumber=$(date -u \"+%y.%m.%d\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $buildNumber\" \"$INFOPLIST_FILE\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n\n# Update the copyright string.\nbuildYear=$(date -u \"+%Y\")\n/usr/libexec/PlistBuddy -c \"Set :NSHumanReadableCopyright Copyright 2015–$buildYear Thomas Harte. All rights reserved.\" \"$INFOPLIST_FILE\"\n"; }; /* End PBXShellScriptBuildPhase section */ From 146e7393902e54307ebeb77978385d0f03929f00 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Mon, 25 Jul 2022 13:16:28 -0400 Subject: [PATCH 4/4] $ACTION seems to be the thing outside of Xcode Cloud. --- OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 487092e8c..4d3770d04 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -5485,7 +5485,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "#!/bin/bash\n\n# Change fields only for archive builds; this helps to avoid source control pollution.\nif [ $CI_XCODEBUILD_ACTION != 'archive' ]; then\n exit 0\nfi\n\n# Set both version numbers to yy.mm.dd.\nbuildNumber=$(date -u \"+%y.%m.%d\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $buildNumber\" \"$INFOPLIST_FILE\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n\n# Update the copyright string.\nbuildYear=$(date -u \"+%Y\")\n/usr/libexec/PlistBuddy -c \"Set :NSHumanReadableCopyright Copyright 2015–$buildYear Thomas Harte. All rights reserved.\" \"$INFOPLIST_FILE\"\n"; + shellScript = "#!/bin/bash\nset\n\n# Change fields only for archive builds; this helps to avoid source control pollution.\nif [ $ACTION != \"install\" ]; then\n exit 0\nfi\n\n# Set both version numbers to yy.mm.dd.\nbuildNumber=$(date -u \"+%y.%m.%d\")\n/usr/libexec/PlistBuddy -c \"Set :CFBundleShortVersionString $buildNumber\" \"$INFOPLIST_FILE\"\n/usr/libexec/PlistBuddy -c \"Set :CFBundleVersion $buildNumber\" \"$INFOPLIST_FILE\"\n\n# Update the copyright string.\nbuildYear=$(date -u \"+%Y\")\n/usr/libexec/PlistBuddy -c \"Set :NSHumanReadableCopyright Copyright 2015–$buildYear Thomas Harte. All rights reserved.\" \"$INFOPLIST_FILE\"\n"; }; /* End PBXShellScriptBuildPhase section */