OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import collections | 7 import collections |
8 import copy | 8 import copy |
9 import json | 9 import json |
10 import os | 10 import os |
(...skipping 30 matching lines...) Expand all Loading... |
41 if key in d1 and d1[key] != d2.get(key): | 41 if key in d1 and d1[key] != d2.get(key): |
42 diff.append('- %s=%s' % (key, pipes.quote(d1[key]))) | 42 diff.append('- %s=%s' % (key, pipes.quote(d1[key]))) |
43 if key in d2 and d2[key] != d1.get(key): | 43 if key in d2 and d2[key] != d1.get(key): |
44 diff.append('+ %s=%s' % (key, pipes.quote(d2[key]))) | 44 diff.append('+ %s=%s' % (key, pipes.quote(d2[key]))) |
45 return '\n'.join(diff) | 45 return '\n'.join(diff) |
46 | 46 |
47 | 47 |
48 def GetEnvironment(host_obj, testing, extra_env_vars=None): | 48 def GetEnvironment(host_obj, testing, extra_env_vars=None): |
49 init_env = dict(os.environ) | 49 init_env = dict(os.environ) |
50 init_env['GYP_GENERATORS'] = 'ninja' | 50 init_env['GYP_GENERATORS'] = 'ninja' |
51 init_env['GOMA_DIR'] = bb_utils.GOMA_DIR | |
52 if extra_env_vars: | 51 if extra_env_vars: |
53 init_env.update(extra_env_vars) | 52 init_env.update(extra_env_vars) |
54 envsetup_cmd = '. build/android/envsetup.sh' | 53 envsetup_cmd = '. build/android/envsetup.sh' |
55 if host_obj.target_arch: | 54 if host_obj.target_arch: |
56 envsetup_cmd += ' --target-arch=%s' % host_obj.target_arch | 55 envsetup_cmd += ' --target-arch=%s' % host_obj.target_arch |
57 if testing: | 56 if testing: |
58 # Skip envsetup to avoid presubmit dependence on android deps. | 57 # Skip envsetup to avoid presubmit dependence on android deps. |
59 print 'Testing mode - skipping "%s"' % envsetup_cmd | 58 print 'Testing mode - skipping "%s"' % envsetup_cmd |
60 envsetup_cmd = ':' | 59 envsetup_cmd = ':' |
61 else: | 60 else: |
62 print 'Running %s' % envsetup_cmd | 61 print 'Running %s' % envsetup_cmd |
63 proc = subprocess.Popen(['bash', '-exc', | 62 proc = subprocess.Popen(['bash', '-exc', |
64 envsetup_cmd + ' >&2; python build/android/buildbot/env_to_json.py'], | 63 envsetup_cmd + ' >&2; python build/android/buildbot/env_to_json.py'], |
65 stdout=subprocess.PIPE, stderr=subprocess.PIPE, | 64 stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
66 cwd=bb_utils.CHROME_SRC, env=init_env) | 65 cwd=bb_utils.CHROME_SRC, env=init_env) |
67 json_env, envsetup_output = proc.communicate() | 66 json_env, envsetup_output = proc.communicate() |
68 if proc.returncode != 0: | 67 if proc.returncode != 0: |
69 print >> sys.stderr, 'FATAL Failure in envsetup.' | 68 print >> sys.stderr, 'FATAL Failure in envsetup.' |
70 print >> sys.stderr, envsetup_output | 69 print >> sys.stderr, envsetup_output |
71 sys.exit(1) | 70 sys.exit(1) |
72 env = json.loads(json_env) | 71 env = json.loads(json_env) |
73 env['GYP_DEFINES'] = env.get('GYP_DEFINES', '') + ' fastbuild=1' | 72 env['GYP_DEFINES'] = env.get('GYP_DEFINES', '') + \ |
| 73 ' fastbuild=1 use_goma=1 gomadir=%s' % bb_utils.GOMA_DIR |
74 extra_gyp = host_obj.extra_gyp_defines | 74 extra_gyp = host_obj.extra_gyp_defines |
75 if extra_gyp: | 75 if extra_gyp: |
76 env['GYP_DEFINES'] += ' %s' % extra_gyp | 76 env['GYP_DEFINES'] += ' %s' % extra_gyp |
77 if re.search('(asan|clang)=1', extra_gyp): | 77 if re.search('(asan|clang)=1', extra_gyp): |
78 env.pop('CXX_target', None) | 78 env.pop('CXX_target', None) |
79 | 79 |
80 # Bots checkout chrome in /b/build/slave/<name>/build/src | 80 # Bots checkout chrome in /b/build/slave/<name>/build/src |
81 build_internal_android = os.path.abspath(os.path.join( | 81 build_internal_android = os.path.abspath(os.path.join( |
82 bb_utils.CHROME_SRC, '..', '..', '..', '..', '..', 'build_internal', | 82 bb_utils.CHROME_SRC, '..', '..', '..', '..', '..', 'build_internal', |
83 'scripts', 'slave', 'android')) | 83 'scripts', 'slave', 'android')) |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 for command in commands: | 283 for command in commands: |
284 print 'Will run: ', bb_utils.CommandToString(command) | 284 print 'Will run: ', bb_utils.CommandToString(command) |
285 print | 285 print |
286 | 286 |
287 env = GetEnvironment(bot_config.host_obj, options.testing) | 287 env = GetEnvironment(bot_config.host_obj, options.testing) |
288 return RunBotCommands(options, commands, env) | 288 return RunBotCommands(options, commands, env) |
289 | 289 |
290 | 290 |
291 if __name__ == '__main__': | 291 if __name__ == '__main__': |
292 sys.exit(main(sys.argv)) | 292 sys.exit(main(sys.argv)) |
OLD | NEW |