OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import os | 6 import os |
7 import sys | 7 import sys |
8 | 8 |
9 import bb_utils | 9 import bb_utils |
10 import bb_annotations | 10 import bb_annotations |
11 | 11 |
12 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | 12 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) |
13 from pylib import constants | 13 from pylib import constants |
14 | 14 |
15 | 15 |
16 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') | 16 SLAVE_SCRIPTS_DIR = os.path.join(bb_utils.BB_BUILD_DIR, 'scripts', 'slave') |
17 VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs']) | 17 VALID_HOST_TESTS = set(['check_webview_licenses', 'findbugs']) |
18 EXPERIMENTAL_TARGETS = ['android_experimental'] | 18 EXPERIMENTAL_TARGETS = ['android_experimental'] |
19 | 19 |
| 20 DIR_BUILD_ROOT = os.path.dirname(constants.DIR_SOURCE_ROOT) |
| 21 |
20 # Short hand for RunCmd which is used extensively in this file. | 22 # Short hand for RunCmd which is used extensively in this file. |
21 RunCmd = bb_utils.RunCmd | 23 RunCmd = bb_utils.RunCmd |
22 | 24 |
23 | 25 |
24 def SrcPath(*path): | 26 def SrcPath(*path): |
25 return os.path.join(constants.DIR_SOURCE_ROOT, *path) | 27 return os.path.join(constants.DIR_SOURCE_ROOT, *path) |
26 | 28 |
27 | 29 |
28 def CheckWebViewLicenses(_): | 30 def CheckWebViewLicenses(_): |
29 bb_annotations.PrintNamedStep('check_licenses') | 31 bb_annotations.PrintNamedStep('check_licenses') |
(...skipping 21 matching lines...) Expand all Loading... |
51 def Compile(options): | 53 def Compile(options): |
52 RunHooks(options.target) | 54 RunHooks(options.target) |
53 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), | 55 cmd = [os.path.join(SLAVE_SCRIPTS_DIR, 'compile.py'), |
54 '--build-tool=ninja', | 56 '--build-tool=ninja', |
55 '--compiler=goma', | 57 '--compiler=goma', |
56 '--target=%s' % options.target, | 58 '--target=%s' % options.target, |
57 '--goma-dir=%s' % bb_utils.GOMA_DIR] | 59 '--goma-dir=%s' % bb_utils.GOMA_DIR] |
58 build_targets = options.build_targets.split(',') | 60 build_targets = options.build_targets.split(',') |
59 bb_annotations.PrintNamedStep('compile') | 61 bb_annotations.PrintNamedStep('compile') |
60 for build_target in build_targets: | 62 for build_target in build_targets: |
61 RunCmd(cmd + ['--build-args=%s' % build_target], halt_on_failure=True) | 63 RunCmd(cmd + ['--build-args=%s' % build_target], |
| 64 halt_on_failure=True, |
| 65 cwd=DIR_BUILD_ROOT) |
62 if options.experimental: | 66 if options.experimental: |
63 for compile_target in EXPERIMENTAL_TARGETS: | 67 for compile_target in EXPERIMENTAL_TARGETS: |
64 bb_annotations.PrintNamedStep('Experimental Compile %s' % compile_target) | 68 bb_annotations.PrintNamedStep('Experimental Compile %s' % compile_target) |
65 RunCmd(cmd + ['--build-args=%s' % compile_target], | 69 RunCmd(cmd + ['--build-args=%s' % compile_target], |
66 flunk_on_failure=False, | 70 flunk_on_failure=False, |
67 cwd=constants.DIR_SOURCE_ROOT) | 71 cwd=DIR_BUILD_ROOT) |
68 | 72 |
69 | 73 |
70 def ZipBuild(options): | 74 def ZipBuild(options): |
71 bb_annotations.PrintNamedStep('zip_build') | 75 bb_annotations.PrintNamedStep('zip_build') |
72 RunCmd([ | 76 RunCmd([ |
73 os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'), | 77 os.path.join(SLAVE_SCRIPTS_DIR, 'zip_build.py'), |
74 '--src-dir', constants.DIR_SOURCE_ROOT, | 78 '--src-dir', constants.DIR_SOURCE_ROOT, |
75 '--build-dir', SrcPath('out'), | 79 '--build-dir', SrcPath('out'), |
76 '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests'] | 80 '--exclude-files', 'lib.target,gen,android_webview,jingle_unittests'] |
77 + bb_utils.EncodeProperties(options), cwd=constants.DIR_SOURCE_ROOT) | 81 + bb_utils.EncodeProperties(options), cwd=DIR_BUILD_ROOT) |
78 | 82 |
79 | 83 |
80 def ExtractBuild(options): | 84 def ExtractBuild(options): |
81 bb_annotations.PrintNamedStep('extract_build') | 85 bb_annotations.PrintNamedStep('extract_build') |
82 RunCmd( | 86 RunCmd( |
83 [os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py'), | 87 [os.path.join(SLAVE_SCRIPTS_DIR, 'extract_build.py'), |
84 '--build-dir', SrcPath('build'), '--build-output-dir', | 88 '--build-dir', SrcPath('build'), '--build-output-dir', |
85 SrcPath('out')] + bb_utils.EncodeProperties(options), | 89 SrcPath('out')] + bb_utils.EncodeProperties(options), |
86 warning_code=1, cwd=constants.DIR_SOURCE_ROOT) | 90 warning_code=1, cwd=DIR_BUILD_ROOT) |
87 | 91 |
88 | 92 |
89 def FindBugs(options): | 93 def FindBugs(options): |
90 bb_annotations.PrintNamedStep('findbugs') | 94 bb_annotations.PrintNamedStep('findbugs') |
91 build_type = [] | 95 build_type = [] |
92 if options.target == 'Release': | 96 if options.target == 'Release': |
93 build_type = ['--release-build'] | 97 build_type = ['--release-build'] |
94 RunCmd([SrcPath('build', 'android', 'findbugs_diff.py')] + build_type) | 98 RunCmd([SrcPath('build', 'android', 'findbugs_diff.py')] + build_type) |
95 RunCmd([SrcPath( | 99 RunCmd([SrcPath( |
96 'tools', 'android', 'findbugs_plugin', 'test', | 100 'tools', 'android', 'findbugs_plugin', 'test', |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 return sys.exit('Unused args %s' % args) | 144 return sys.exit('Unused args %s' % args) |
141 | 145 |
142 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) | 146 setattr(options, 'target', options.factory_properties.get('target', 'Debug')) |
143 | 147 |
144 if options.steps: | 148 if options.steps: |
145 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) | 149 bb_utils.RunSteps(options.steps.split(','), GetHostStepCmds(), options) |
146 | 150 |
147 | 151 |
148 if __name__ == '__main__': | 152 if __name__ == '__main__': |
149 sys.exit(main(sys.argv)) | 153 sys.exit(main(sys.argv)) |
OLD | NEW |