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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 if extra_env_vars: | 51 if extra_env_vars: |
52 init_env.update(extra_env_vars) | 52 init_env.update(extra_env_vars) |
53 envsetup_cmd = '. build/android/envsetup.sh' | 53 envsetup_cmd = '. build/android/envsetup.sh' |
54 if host_obj.target_arch: | |
55 envsetup_cmd += ' --target-arch=%s' % host_obj.target_arch | |
56 if testing: | 54 if testing: |
57 # Skip envsetup to avoid presubmit dependence on android deps. | 55 # Skip envsetup to avoid presubmit dependence on android deps. |
58 print 'Testing mode - skipping "%s"' % envsetup_cmd | 56 print 'Testing mode - skipping "%s"' % envsetup_cmd |
59 envsetup_cmd = ':' | 57 envsetup_cmd = ':' |
60 else: | 58 else: |
61 print 'Running %s' % envsetup_cmd | 59 print 'Running %s' % envsetup_cmd |
62 proc = subprocess.Popen(['bash', '-exc', | 60 proc = subprocess.Popen(['bash', '-exc', |
63 envsetup_cmd + ' >&2; python build/android/buildbot/env_to_json.py'], | 61 envsetup_cmd + ' >&2; python build/android/buildbot/env_to_json.py'], |
64 stdout=subprocess.PIPE, stderr=subprocess.PIPE, | 62 stdout=subprocess.PIPE, stderr=subprocess.PIPE, |
65 cwd=bb_utils.CHROME_SRC, env=init_env) | 63 cwd=bb_utils.CHROME_SRC, env=init_env) |
66 json_env, envsetup_output = proc.communicate() | 64 json_env, envsetup_output = proc.communicate() |
67 if proc.returncode != 0: | 65 if proc.returncode != 0: |
68 print >> sys.stderr, 'FATAL Failure in envsetup.' | 66 print >> sys.stderr, 'FATAL Failure in envsetup.' |
69 print >> sys.stderr, envsetup_output | 67 print >> sys.stderr, envsetup_output |
70 sys.exit(1) | 68 sys.exit(1) |
71 env = json.loads(json_env) | 69 env = json.loads(json_env) |
72 env['GYP_DEFINES'] = env.get('GYP_DEFINES', '') + \ | 70 env['GYP_DEFINES'] = env.get('GYP_DEFINES', '') + \ |
73 ' fastbuild=1 use_goma=1 gomadir=%s' % bb_utils.GOMA_DIR | 71 ' fastbuild=1 use_goma=1 gomadir=%s' % bb_utils.GOMA_DIR |
| 72 if host_obj.target_arch: |
| 73 gyp_target_arch = { 'mips': 'mipsel', 'x86': 'ia32' }.get( |
| 74 host_obj.target_arch, host_obj.target_arch) |
| 75 env['GYP_DEFINES'] += ' target_arch=%s' % gyp_target_arch |
74 extra_gyp = host_obj.extra_gyp_defines | 76 extra_gyp = host_obj.extra_gyp_defines |
75 if extra_gyp: | 77 if extra_gyp: |
76 env['GYP_DEFINES'] += ' %s' % extra_gyp | 78 env['GYP_DEFINES'] += ' %s' % extra_gyp |
77 if re.search('(asan|clang)=1', extra_gyp): | 79 if re.search('(asan|clang)=1', extra_gyp): |
78 env.pop('CXX_target', None) | 80 env.pop('CXX_target', None) |
79 | 81 |
80 # Bots checkout chrome in /b/build/slave/<name>/build/src | 82 # Bots checkout chrome in /b/build/slave/<name>/build/src |
81 build_internal_android = os.path.abspath(os.path.join( | 83 build_internal_android = os.path.abspath(os.path.join( |
82 bb_utils.CHROME_SRC, '..', '..', '..', '..', '..', 'build_internal', | 84 bb_utils.CHROME_SRC, '..', '..', '..', '..', '..', 'build_internal', |
83 'scripts', 'slave', 'android')) | 85 'scripts', 'slave', 'android')) |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 for command in commands: | 286 for command in commands: |
285 print 'Will run: ', bb_utils.CommandToString(command) | 287 print 'Will run: ', bb_utils.CommandToString(command) |
286 print | 288 print |
287 | 289 |
288 env = GetEnvironment(bot_config.host_obj, options.testing) | 290 env = GetEnvironment(bot_config.host_obj, options.testing) |
289 return RunBotCommands(options, commands, env) | 291 return RunBotCommands(options, commands, env) |
290 | 292 |
291 | 293 |
292 if __name__ == '__main__': | 294 if __name__ == '__main__': |
293 sys.exit(main(sys.argv)) | 295 sys.exit(main(sys.argv)) |
OLD | NEW |