Skip to content

Commit 294c065

Browse files
committed
Use the new Swift Build System and check when it is being used. Return the environment to the previous state for the user.
1 parent ef32a9d commit 294c065

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

benchmark.sh

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,19 @@ clear
55

66
echo "Preparing environment"
77

8-
START_TIME=$(date +"%T")
9-
8+
readonly duration=$(defaults read com.apple.dt.Xcode ShowBuildOperationDuration)
109
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
1110

11+
# We should build with the new build system
12+
readonly swift_build_system=$(defaults read com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration)
13+
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration YES
14+
15+
START_TIME=$(date +"%T")
16+
1217
if [ -n "$PATH_TO_PROJECT" ]; then
1318

14-
echo "Running XcodeBenchmark..."
15-
echo "Please do not use your Mac while XcodeBenchmark is in progress\n\n"
19+
echo "Please do not use your Mac while XcodeBenchmark is in progress\n\n"
20+
echo "Running XcodeBenchmark...\n\n"
1621

1722
xcodebuild -workspace "$PATH_TO_PROJECT" \
1823
-scheme XcodeBenchmark \
@@ -23,6 +28,8 @@ if [ -n "$PATH_TO_PROJECT" ]; then
2328
echo "System Version:" "$(sw_vers -productVersion)"
2429
xcodebuild -version | grep "Xcode"
2530

31+
echo "Swift Build System:" "$(defaults read com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration)"
32+
2633
echo "Hardware Overview"
2734
system_profiler SPHardwareDataType | grep "Model Name:"
2835
system_profiler SPHardwareDataType | grep "Model Identifier:"
@@ -55,8 +62,14 @@ if [ -n "$PATH_TO_PROJECT" ]; then
5562
echo "2️⃣ Share your results at https://github.com/devMEremenko/XcodeBenchmark"
5663

5764
rm -rfd "$PATH_TO_DERIVED"
65+
66+
# Return environment to previous state
67+
defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration "$swift_build_system"
68+
defaults write com.apple.dt.Xcode ShowBuildOperationDuration "$duration"
69+
70+
echo ""
5871

5972
else
60-
echo "XcodeBenchmark.xcworkspace was not found in the current folder"
61-
echo "Are you running in the XcodeBenchmark folder?"
73+
echo "XcodeBenchmark.xcworkspace was not found in the current folder\n"
74+
echo "Are you running in the XcodeBenchmark folder?\n"
6275
fi

0 commit comments

Comments
 (0)