Chromium Code Reviews| Index: tools/cr/cr/actions/ninja.py |
| diff --git a/tools/cr/cr/actions/ninja.py b/tools/cr/cr/actions/ninja.py |
| index 404e6caea26e11360bf1b874e72c8de38f3fd697..6a8bd1900ba9def5d628aa1d12ea91355d947606 100644 |
| --- a/tools/cr/cr/actions/ninja.py |
| +++ b/tools/cr/cr/actions/ninja.py |
| @@ -30,6 +30,26 @@ class NinjaBuilder(cr.Builder): |
| self._targets = [] |
| def Build(self, context, targets, arguments): |
| + # Make sure Goma is started, if Ninja is set to use it. |
| + # This may be redundant, but it currently improves reliability. |
| + try: |
|
ian_cottrell
2014/01/09 17:00:21
I would change how you build paths.
Use
NINJA_BU
johnme
2014/01/09 19:06:11
Done.
|
| + goma_dir = context.Get('GOMA_DIR', raise_errors=True) |
| + build_dir = context.Get('CR_BUILD_DIR', raise_errors=True) |
| + build_ninja = os.path.join(build_dir, 'build.ninja') |
| + if os.path.exists(build_ninja): |
| + goma_cc = 'cc = {} $\n'.format(os.path.join(goma_dir, 'gomacc')) |
| + with open(build_ninja, 'r') as f: |
|
ian_cottrell
2014/01/09 17:00:21
This is vile, but I don't have a better suggestion
|
| + if f.readline() == goma_cc: |
| + # Goma is active, so make sure it's started. |
| + cr.Host.ExecuteSilently( |
| + context, |
| + os.path.join('{GOMA_DIR}', 'goma_ctl.py'), |
| + 'ensure_start' |
| + ) |
| + except KeyError: |
| + pass |
| + |
| + |
| build_arguments = [target.build_target for target in targets] |
| build_arguments.extend(arguments) |
| cr.Host.Execute( |