Makes the generation of the Info.plist environment variables fail-safe.
This prevents the invocation from failing, when one of the variables could not
be discovered (and mimics the behavior of Xcode 7.1 and SDK 9.1).
An example generated with SDK 9.1
{
...
BuildMachineOSBuild = 14F27;
DTCompiler = "com.apple.compilers.llvm.clang.1_0";
DTPlatformBuild = "";
DTPlatformVersion = "9.1";
DTSDKBuild = 13B5110e;
DTXCodeBuild = 7B60;
DTXcode = 0710;
...
}
RELNOTES:
--
MOS_MIGRATED_REVID=103191602
diff --git a/src/tools/xcode/environment/environment_plist.sh b/src/tools/xcode/environment/environment_plist.sh
index b142f7d..2ba4137 100755
--- a/src/tools/xcode/environment/environment_plist.sh
+++ b/src/tools/xcode/environment/environment_plist.sh
@@ -23,7 +23,7 @@
# --platform - the target platform, e.g. 'iphoneos' or 'iphonesimulator8.3'
#
-set -eu
+set -u
while [[ $# > 1 ]]
do
@@ -64,11 +64,11 @@
xcode_build=$(/usr/bin/defaults read "${XCODE_VERSION_PLIST}" ProductBuildVersion)
xcode_version=$(/usr/bin/defaults read "${XCODE_PLIST}" DTXcode)
-/usr/bin/defaults write "${PLIST}" DTPlatformBuild -string ${platform_build}
-/usr/bin/defaults write "${PLIST}" DTSDKBuild -string ${sdk_build}
-/usr/bin/defaults write "${PLIST}" DTPlatformVersion -string ${platform_version}
-/usr/bin/defaults write "${PLIST}" DTXcode -string ${xcode_version}
-/usr/bin/defaults write "${PLIST}" DTXCodeBuild -string ${xcode_build}
-/usr/bin/defaults write "${PLIST}" DTCompiler -string ${compiler}
-/usr/bin/defaults write "${PLIST}" BuildMachineOSBuild -string ${os_build}
+/usr/bin/defaults write "${PLIST}" DTPlatformBuild -string ${platform_build:-""}
+/usr/bin/defaults write "${PLIST}" DTSDKBuild -string ${sdk_build:-""}
+/usr/bin/defaults write "${PLIST}" DTPlatformVersion -string ${platform_version:-""}
+/usr/bin/defaults write "${PLIST}" DTXcode -string ${xcode_version:-""}
+/usr/bin/defaults write "${PLIST}" DTXCodeBuild -string ${xcode_build:-""}
+/usr/bin/defaults write "${PLIST}" DTCompiler -string ${compiler:-""}
+/usr/bin/defaults write "${PLIST}" BuildMachineOSBuild -string ${os_build:-""}
cat "${PLIST}" > "${OUTPUT}"