Add workaround for bug in actool in Xcode 9.1 β.
Ignore spurious messages matching the spurious notice message emitted by Xcode 9.1 β version of actool. Bug: 770634 Change-Id: I186cae33297b197df379c3d12d4e10126778aa46 Reviewed-on: https://chromium-review.googlesource.com/697205 Reviewed-by: Jean-François Geyelin <jif@chromium.org> Commit-Queue: Sylvain Defresne <sdefresne@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#506017} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 331d7ef11600b0fe3f571e8b77659a9eae363b17
This commit is contained in:
Родитель
05cc4b12ce
Коммит
da99bf90bf
|
@ -29,6 +29,15 @@ SECTION_HEADER = re.compile('^/\\* ([^ ]*) \\*/$')
|
|||
# Name of the section containing informational messages that can be ignored.
|
||||
NOTICE_SECTION = 'com.apple.actool.compilation-results'
|
||||
|
||||
# Regular expressions matching spurious messages from actool that should be
|
||||
# ignored (as they are bogus). Generally a bug should be filed with Apple
|
||||
# when adding a pattern here.
|
||||
SPURIOUS_PATTERNS = map(re.compile, [
|
||||
# crbug.com/770634, likely a bug in Xcode 9.1 beta, remove once build
|
||||
# requires a version of Xcode with a fix.
|
||||
r'\[\]\[ipad\]\[76x76\]\[\]\[\]\[1x\]\[\]\[\]: notice: \(null\)',
|
||||
])
|
||||
|
||||
# Map special type of asset catalog to the corresponding command-line
|
||||
# parameter that need to be passed to actool.
|
||||
ACTOOL_FLAG_FOR_ASSET_TYPE = {
|
||||
|
@ -37,6 +46,15 @@ ACTOOL_FLAG_FOR_ASSET_TYPE = {
|
|||
}
|
||||
|
||||
|
||||
def IsSpuriousMessage(line):
|
||||
"""Returns whether line contains a spurious message that should be ignored."""
|
||||
for pattern in SPURIOUS_PATTERNS:
|
||||
match = pattern.search(line)
|
||||
if match is not None:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def FilterCompilerOutput(compiler_output, relative_paths):
|
||||
"""Filers actool compilation output.
|
||||
|
||||
|
@ -49,8 +67,8 @@ def FilterCompilerOutput(compiler_output, relative_paths):
|
|||
com.apple.actool.document.warnings sections (as spurious messages comes
|
||||
before any section of the output).
|
||||
|
||||
See crbug.com/730054 and crbug.com/739163 for some example messages that
|
||||
pollute the output of actool and cause flaky builds.
|
||||
See crbug.com/730054, crbug.com/739163 and crbug.com/770634 for some example
|
||||
messages that pollute the output of actool and cause flaky builds.
|
||||
|
||||
Args:
|
||||
compiler_output: string containing the output generated by the
|
||||
|
@ -67,18 +85,23 @@ def FilterCompilerOutput(compiler_output, relative_paths):
|
|||
|
||||
filtered_output = []
|
||||
current_section = None
|
||||
data_in_section = False
|
||||
for line in compiler_output.splitlines():
|
||||
match = SECTION_HEADER.search(line)
|
||||
if match is not None:
|
||||
data_in_section = False
|
||||
current_section = match.group(1)
|
||||
if current_section != NOTICE_SECTION:
|
||||
filtered_output.append(line + '\n')
|
||||
continue
|
||||
if current_section and current_section != NOTICE_SECTION:
|
||||
if IsSpuriousMessage(line):
|
||||
continue
|
||||
absolute_path = line.split(':')[0]
|
||||
relative_path = relative_paths.get(absolute_path, absolute_path)
|
||||
if absolute_path != relative_path:
|
||||
line = relative_path + line[len(absolute_path):]
|
||||
if not data_in_section:
|
||||
data_in_section = True
|
||||
filtered_output.append('/* %s */\n' % current_section)
|
||||
filtered_output.append(line + '\n')
|
||||
|
||||
return ''.join(filtered_output)
|
||||
|
|
|
@ -64,6 +64,21 @@ class TestFilterCompilerOutput(unittest.TestCase):
|
|||
'/* com.apple.actool.compilation-results */\n',
|
||||
self.relative_paths))
|
||||
|
||||
def testSpurious(self):
|
||||
self.assertEquals(
|
||||
'/* com.apple.actool.document.warnings */\n'
|
||||
'../../Chromium.xcassets:./AppIcon.appiconset: warning: A 1024x1024 ap'
|
||||
'p store icon is required for iOS apps\n',
|
||||
compile_xcassets.FilterCompilerOutput(
|
||||
'/* com.apple.actool.document.warnings */\n'
|
||||
'/Users/janedoe/chromium/src/Chromium.xcassets:./AppIcon.appiconse'
|
||||
't: warning: A 1024x1024 app store icon is required for iOS ap'
|
||||
'ps\n'
|
||||
'/* com.apple.actool.document.notices */\n'
|
||||
'/Users/janedoe/chromium/src/Chromium.xcassets:./AppIcon.appiconse'
|
||||
't/[][ipad][76x76][][][1x][][]: notice: (null)\n',
|
||||
self.relative_paths))
|
||||
|
||||
def testComplexError(self):
|
||||
self.assertEquals(
|
||||
'/* com.apple.actool.errors */\n'
|
||||
|
|
Загрузка…
Ссылка в новой задаче