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

Unified Diff: build/config/mac/sdk_info.py

Issue 2023703002: Beginning work on GN build (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Really add //build. Add dart_bootstrap rule. Created 4 years, 7 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
« no previous file with comments | « build/config/mac/rules.gni ('k') | build/config/mac/xcrun.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/config/mac/sdk_info.py
diff --git a/build/config/mac/sdk_info.py b/build/config/mac/sdk_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..9a7d57a85f23dd7ba19762680e35c6b7d73a5b68
--- /dev/null
+++ b/build/config/mac/sdk_info.py
@@ -0,0 +1,64 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# 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 prints information about the build system, the operating
+# system and the iOS or Mac SDK (depending on the platform "iphonesimulator",
+# "iphoneos" or "macosx" generally).
+#
+# In the GYP build, this is done inside GYP itself based on the SDKROOT
+# variable.
+
+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)
+
+
+def FillXcodeVersion(settings):
+ """Fills the Xcode version and build number into |settings|."""
+ lines = subprocess.check_output(['xcodebuild', '-version']).splitlines()
+ settings['xcode_version'] = FormatVersion(lines[0].split()[-1])
+ settings['xcode_build'] = lines[-1].split()[-1]
+
+
+def FillMachineOSBuild(settings):
+ """Fills OS build number into |settings|."""
+ settings['machine_os_build'] = subprocess.check_output(
+ ['sw_vers', '-buildVersion']).strip()
+
+
+def FillSDKPathAndVersion(settings, platform, xcode_version):
+ """Fills the SDK path and version for |platform| into |settings|."""
+ settings['sdk_path'] = subprocess.check_output([
+ 'xcrun', '-sdk', platform, '--show-sdk-path']).strip()
+ settings['sdk_version'] = subprocess.check_output([
+ 'xcrun', '-sdk', platform, '--show-sdk-version']).strip()
+ # TODO: unconditionally use --show-sdk-build-version once Xcode 7.2 or
+ # higher is required to build Chrome for iOS or OS X.
+ if xcode_version >= '0720':
+ settings['sdk_build'] = subprocess.check_output([
+ 'xcrun', '-sdk', platform, '--show-sdk-build-version']).strip()
+ else:
+ settings['sdk_build'] = settings['sdk_version']
+
+
+if __name__ == '__main__':
+ if len(sys.argv) != 2:
+ sys.stderr.write(
+ 'usage: %s [iphoneos|iphonesimulator|macosx]\n' %
+ os.path.basename(sys.argv[0]))
+ sys.exit(1)
+
+ settings = {}
+ FillMachineOSBuild(settings)
+ FillXcodeVersion(settings)
+ FillSDKPathAndVersion(settings, sys.argv[1], settings['xcode_version'])
+
+ for key in sorted(settings):
+ print '%s="%s"' % (key, settings[key])
« no previous file with comments | « build/config/mac/rules.gni ('k') | build/config/mac/xcrun.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698