Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: build/config/ios/ios_sdk.py

Issue 1611363003: Add support for iOS application bundle to GN. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-bundles
Patch Set: Address comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/config/ios/ios_sdk.py
diff --git a/build/config/ios/ios_sdk.py b/build/config/ios/ios_sdk.py
index dfec4dbada9d88d80e3fe5167ec1b43a826e2beb..c3039c1ec19eb70067b98ff35990bf08b371025f 100644
--- a/build/config/ios/ios_sdk.py
+++ b/build/config/ios/ios_sdk.py
@@ -2,18 +2,49 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os
import subprocess
import sys
-# This script returns the path to the SDK of the given type. Pass the type of
-# SDK you want, which is typically "iphone" or "iphonesimulator".
+# This script prints information about the build system, the operating
+# system and the iOS SDK (depending on the platform "iphonesimulator"
+# or "iphoneos" generally).
#
# In the GYP build, this is done inside GYP itself based on the SDKROOT
# variable.
-if len(sys.argv) != 2:
- print "Takes one arg (SDK to find)"
- sys.exit(1)
+def FormatVersion(version):
+ """Converts Xcode version to a format required for Info.plist."""
+ version = version.replace('.', '')
+ version = version + '0' * (3 - len(version))
+ return version.zfill(4)
-print subprocess.check_output(['xcodebuild', '-version', '-sdk',
- sys.argv[1], 'Path']).strip()
+
+def PrintXcodeVersion():
+ """Prints the Xcode version and build number."""
+ lines = subprocess.check_output(['xcodebuild', '-version']).splitlines()
+ print FormatVersion(lines[0].split()[-1])
+ print lines[-1].split()[-1]
+
+
+def PrintMachineOSBuild():
+ """Prints OS build number."""
+ subprocess.check_call(['sw_vers', '-buildVersion'])
+
+
+def PrintSDKPathAndVersion(platform):
+ """Prints the SDK path and version for |platform|."""
+ subprocess.check_call(['xcodebuild', '-version', '-sdk',
+ platform, 'Path', 'SDKVersion'])
+
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ sys.stderr.write(
+ 'usage: %s [iphoneos|iphonesimulator]\n' %
+ os.path.basename(sys.argv[0]))
+ sys.exit(1)
+
+ PrintSDKPathAndVersion(sys.argv[1])
+ PrintXcodeVersion()
+ PrintMachineOSBuild()

Powered by Google App Engine
This is Rietveld 408576698