From d8114465a5d6a57604ba8eb85586aaada552dadc Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 15 Dec 2018 17:49:08 +0900 Subject: [PATCH] mac: Fix support with XCode 10 --- .travis.yml | 4 ++-- build/config/compiler/BUILD.gn | 2 ++ build/config/mac/sdk_info.py | 34 +++++++++++++++++++++++++++------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index d962a8f..e4276b3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,11 @@ notifications: language: node_js node_js: - - "8" + - "10" os: - osx - linux -osx_image: xcode8.3 +osx_image: xcode10.1 dist: trusty sudo: required diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 5167841..f36fa5c 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -1370,6 +1370,8 @@ config("default_warnings") { # TODO(hans): https://crbug.com/637306 "-Wno-address-of-packed-member", + + "-Wno-unused-lambda-capture", ] } } diff --git a/build/config/mac/sdk_info.py b/build/config/mac/sdk_info.py index 8a9edc1..46dcec8 100644 --- a/build/config/mac/sdk_info.py +++ b/build/config/mac/sdk_info.py @@ -3,6 +3,8 @@ # found in the LICENSE file. import argparse +import doctest +import itertools import os import subprocess import sys @@ -10,16 +12,32 @@ # 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 SplitVersion(version): + """Splits the Xcode version to 3 values. + + >>> list(SplitVersion('8.2.1.1')) + ['8', '2', '1'] + >>> list(SplitVersion('9.3')) + ['9', '3', '0'] + >>> list(SplitVersion('10.0')) + ['10', '0', '0'] + """ + version = version.split('.') + return itertools.islice(itertools.chain(version, itertools.repeat('0')), 0, 3) 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) + """Converts Xcode version to a format required for DTXcode in Info.plist + >>> FormatVersion('8.2.1') + '0821' + >>> FormatVersion('9.3') + '0930' + >>> FormatVersion('10.0') + '1000' + """ + major, minor, patch = SplitVersion(version) + return ('%2s%s%s' % (major, minor, patch)).replace(' ', '0') def FillXcodeVersion(settings): """Fills the Xcode version and build number into |settings|.""" @@ -53,6 +71,8 @@ def FillSDKPathAndVersion(settings, platform, xcode_version): if __name__ == '__main__': + doctest.testmod() + parser = argparse.ArgumentParser() parser.add_argument("--developer_dir", required=False) args, unknownargs = parser.parse_known_args()