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

Unified Diff: build/android/gyp/process_resources.py

Issue 619793002: Ignore "libpng: unknown profile" warnings when running aapt crunch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wrapped long line Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/process_resources.py
diff --git a/build/android/gyp/process_resources.py b/build/android/gyp/process_resources.py
index fd3206437d8584d768e876e49c2f88ad5027f145..6f35388986ac79ef73700f0afc9d61e7f467a405 100755
--- a/build/android/gyp/process_resources.py
+++ b/build/android/gyp/process_resources.py
@@ -120,20 +120,26 @@ def CreateExtraRJavaFiles(r_dir, extra_packages):
# affect how the code in this .apk target could refer to the resources.
+def FilterCrunchStderr(stderr):
+ """Filters out lines from aapt crunch's stderr that can safely be ignored."""
+ filtered_lines = []
+ for line in stderr.splitlines(True):
+ # Ignore this libpng warning, which is a known non-error condition.
+ # http://crbug.com/364355
+ if ('libpng warning: iCCP: Not recognizing known sRGB profile that has '
+ + 'been edited' in line):
+ continue
+ filtered_lines.append(line)
+ return ''.join(filtered_lines)
+
+
def DidCrunchFail(returncode, stderr):
"""Determines whether aapt crunch failed from its return code and output.
Because aapt's return code cannot be trusted, any output to stderr is
- an indication that aapt has failed (http://crbug.com/314885), except
- lines that contain "libpng warning", which is a known non-error condition
- (http://crbug.com/364355).
+ an indication that aapt has failed (http://crbug.com/314885).
"""
- if returncode != 0:
- return True
- for line in stderr.splitlines():
- if line and not 'libpng warning' in line:
- return True
- return False
+ return returncode != 0 or stderr
def ZipResources(resource_dirs, zip_path):
@@ -253,7 +259,8 @@ def main():
'crunch',
'-C', crunch_dir,
'-S', d]
- build_utils.CheckOutput(aapt_cmd, fail_func=DidCrunchFail)
+ build_utils.CheckOutput(aapt_cmd, stderr_filter=FilterCrunchStderr,
+ fail_func=DidCrunchFail)
ZipResources(zip_resource_dirs, options.resource_zip_out)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698