Chromium Code Reviews| Index: dart/tools/build.py |
| diff --git a/dart/tools/build.py b/dart/tools/build.py |
| index d2bf1bc240330a21f5e0168983eda19f07c5f24a..df6d55fbf784f7d2b4b67fbc30b59f5811b96d24 100755 |
| --- a/dart/tools/build.py |
| +++ b/dart/tools/build.py |
| @@ -224,6 +224,39 @@ def CurrentDirectoryBaseName(): |
| return os.path.relpath(os.curdir, start=os.pardir) |
| +def ParseXcodebuild(args): |
| + """ |
| + Run xcodebuild and returns the process object. |
| + Output is parsed to filter out build actions that had no output. |
| + """ |
|
kustermann
2013/04/02 21:13:15
A small comment explaining the 'output format' of
ahe
2013/04/05 15:03:43
Done.
|
| + |
| + def is_empty_chunk(chunk): |
| + empty_chunk = ['Check dependencies', '', ''] |
| + return not chunk or (len(chunk) == 4 and chunk[1:] == empty_chunk) |
| + |
| + process = subprocess.Popen(args, |
| + bufsize=0, |
|
kustermann
2013/04/02 21:13:15
I think 'bufsize=0' is the default -- you could re
ahe
2013/04/05 15:03:43
Yes. In addition it turns out that "for line in p
|
| + stdin=None, |
| + stdout=subprocess.PIPE, |
| + stderr=subprocess.STDOUT) |
| + section = None |
| + chunk = [] |
| + for line in process.stdout: |
| + line = line.rstrip() |
| + if line.startswith('=== BUILD ') or line.startswith('** BUILD '): |
| + if not is_empty_chunk(chunk): |
| + print '\n'.join(chunk) |
| + section = line |
| + chunk = [] |
| + if not section: |
| + print line |
| + else: |
| + chunk.append(line) |
| + if not is_empty_chunk(chunk): |
| + print '\n'.join(chunk) |
| + return process |
| + |
| + |
| def Main(): |
| utils.ConfigureJava() |
| # Parse the options. |
| @@ -241,6 +274,7 @@ def Main(): |
| else: |
| target = args[0] |
| + parse_xcodebuild = False |
|
kustermann
2013/04/02 21:13:15
The intention is not to parse the output of xcodeb
ahe
2013/04/05 15:03:43
Done.
|
| # Remember path |
| old_path = os.environ['PATH'] |
| # Build the targets for each requested configuration. |
| @@ -249,6 +283,7 @@ def Main(): |
| for arch in options.arch: |
| build_config = utils.GetBuildConf(mode, arch) |
| if HOST_OS == 'macos': |
| + parse_xcodebuild = True |
| project_file = 'dart.xcodeproj' |
| if os.path.exists('dart-%s.gyp' % CurrentDirectoryBaseName()): |
| project_file = 'dart-%s.xcodeproj' % CurrentDirectoryBaseName() |
| @@ -316,7 +351,11 @@ def Main(): |
| print k + " = " + v |
| print ' '.join(args) |
| - process = subprocess.Popen(args) |
| + process = None |
| + if parse_xcodebuild: |
| + process = ParseXcodebuild(args) |
| + else: |
| + process = subprocess.Popen(args, stdin=None) |
|
kustermann
2013/04/02 21:13:15
You could do something like this:
if filter_xcode
ahe
2013/04/05 15:03:43
Done.
|
| process.wait() |
| if process.returncode != 0: |
| print "BUILD FAILED" |