| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from infra.libs.infra_types import freeze | 5 from infra.libs.infra_types import freeze |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'bot_update', | 8 'bot_update', |
| 9 'chromium', | 9 'chromium', |
| 10 'commit_position', | 10 'commit_position', |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 **bot_config.get('chromium_config_kwargs', {})) | 130 **bot_config.get('chromium_config_kwargs', {})) |
| 131 api.chromium.runhooks() | 131 api.chromium.runhooks() |
| 132 targets = bot_config.get('compile_targets', []) | 132 targets = bot_config.get('compile_targets', []) |
| 133 debug_path = api.path['checkout'].join('out', api.chromium.c.BUILD_CONFIG) | 133 debug_path = api.path['checkout'].join('out', api.chromium.c.BUILD_CONFIG) |
| 134 command = ['ninja', '-C', debug_path] + list(targets) | 134 command = ['ninja', '-C', debug_path] + list(targets) |
| 135 # Add the parameters for creating the compilation database. | 135 # Add the parameters for creating the compilation database. |
| 136 command += ['-t', 'compdb', 'cc', 'cxx', 'objc', 'objcxx'] | 136 command += ['-t', 'compdb', 'cc', 'cxx', 'objc', 'objcxx'] |
| 137 result = api.step('generate compilation database', command, | 137 result = api.step('generate compilation database', command, |
| 138 stdout=api.raw_io.output()) | 138 stdout=api.raw_io.output()) |
| 139 | 139 |
| 140 api.chromium.compile(targets, force_clobber=True) | 140 api.chromium.compile(targets) |
| 141 | 141 |
| 142 # Copy the created output to the correct directory. When running the clang | 142 # Copy the created output to the correct directory. When running the clang |
| 143 # tool, it is assumed by the scripts that the compilation database is in the | 143 # tool, it is assumed by the scripts that the compilation database is in the |
| 144 # out/Debug directory, and named 'compile_commands.json'. | 144 # out/Debug directory, and named 'compile_commands.json'. |
| 145 api.step('copy compilation database', | 145 api.step('copy compilation database', |
| 146 ['cp', api.raw_io.input(data=result.stdout), | 146 ['cp', api.raw_io.input(data=result.stdout), |
| 147 debug_path.join('compile_commands.json')]) | 147 debug_path.join('compile_commands.json')]) |
| 148 | 148 |
| 149 # Now compile the code for real. | 149 # Now compile the code for real. |
| 150 if bot_config.get('create_index_pack'): | 150 if bot_config.get('create_index_pack'): |
| (...skipping 18 matching lines...) Expand all Loading... |
| 169 # For some files, the clang tool produces errors. This is a known issue, | 169 # For some files, the clang tool produces errors. This is a known issue, |
| 170 # but since it only affects very few files (currently 9), we ignore these | 170 # but since it only affects very few files (currently 9), we ignore these |
| 171 # errors for now. At least this means we can already have cross references | 171 # errors for now. At least this means we can already have cross references |
| 172 # support for the files where it works. | 172 # support for the files where it works. |
| 173 api.step.active_result.presentation.step_text = f.reason_message() | 173 api.step.active_result.presentation.step_text = f.reason_message() |
| 174 | 174 |
| 175 # Create the index pack | 175 # Create the index pack |
| 176 got_revision_cp = api.chromium.build_properties.get('got_revision_cp') | 176 got_revision_cp = api.chromium.build_properties.get('got_revision_cp') |
| 177 commit_position = api.commit_position.parse_revision(got_revision_cp) | 177 commit_position = api.commit_position.parse_revision(got_revision_cp) |
| 178 platform = bot_config.get('platform', 'linux') | 178 platform = bot_config.get('platform', 'linux') |
| 179 index_pack_name = 'index_pack_%s_%s.zip' % (platform, commit_position) | 179 index_pack_name = 'index_pack_%s.zip' % platform |
| 180 index_pack_name_with_revision = 'index_pack_%s_%s.zip' % ( |
| 181 platform, commit_position) |
| 180 api.python('create index pack', | 182 api.python('create index pack', |
| 181 api.path['build'].join('scripts', 'slave', 'chromium', | 183 api.path['build'].join('scripts', 'slave', 'chromium', |
| 182 'package_index.py'), | 184 'package_index.py'), |
| 183 ['--path-to-compdb', debug_path.join('compile_commands.json'), | 185 ['--path-to-compdb', debug_path.join('compile_commands.json'), |
| 184 '--path-to-archive-output', debug_path.join(index_pack_name)]) | 186 '--path-to-archive-output', debug_path.join(index_pack_name)]) |
| 185 | 187 |
| 186 # Remove the llvm-build directory, so that gclient runhooks will download | 188 # Remove the llvm-build directory, so that gclient runhooks will download |
| 187 # the pre-built clang binary and not use the locally compiled binary from | 189 # the pre-built clang binary and not use the locally compiled binary from |
| 188 # the 'compile translation_unit clang tool' step. | 190 # the 'compile translation_unit clang tool' step. |
| 189 api.path.rmtree('llvm-build', | 191 api.path.rmtree('llvm-build', |
| 190 api.path['checkout'].join('third_party', 'llvm-build')) | 192 api.path['checkout'].join('third_party', 'llvm-build')) |
| 191 | 193 |
| 192 # Upload the index pack | 194 # Upload the index pack |
| 193 environment = bot_config.get('environment', 'prod') | 195 environment = bot_config.get('environment', 'prod') |
| 194 api.gsutil.upload( | 196 api.gsutil.upload( |
| 195 name='upload index pack', | 197 name='upload index pack', |
| 196 source=debug_path.join(index_pack_name), | 198 source=debug_path.join(index_pack_name), |
| 197 bucket=BUCKET_NAME, | 199 bucket=BUCKET_NAME, |
| 198 dest='%s/%s' % (environment, index_pack_name) | 200 dest='%s/%s' % (environment, index_pack_name_with_revision) |
| 199 ) | 201 ) |
| 200 | 202 |
| 201 # Package the source code. | 203 # Package the source code. |
| 202 tarball_name = 'chromium_src_%s_%s.tar.bz2' % (platform, commit_position) | 204 tarball_name = 'chromium_src_%s.tar.bz2' % platform |
| 205 tarball_name_with_revision = 'chromium_src_%s_%s.tar.bz2' % ( |
| 206 platform,commit_position) |
| 203 api.python('archive source', | 207 api.python('archive source', |
| 204 api.path['build'].join('scripts','slave', | 208 api.path['build'].join('scripts','slave', |
| 205 'archive_source_codesearch.py'), | 209 'archive_source_codesearch.py'), |
| 206 ['src', 'build', 'infra', 'tools', '/usr/include', '-f', | 210 ['src', 'build', 'infra', 'tools', '/usr/include', '-f', |
| 207 tarball_name]) | 211 tarball_name]) |
| 208 | 212 |
| 209 # Upload the source code. | 213 # Upload the source code. |
| 210 api.gsutil.upload( | 214 api.gsutil.upload( |
| 211 name='upload source tarball', | 215 name='upload source tarball', |
| 212 source=api.path['slave_build'].join(tarball_name), | 216 source=api.path['slave_build'].join(tarball_name), |
| 213 bucket=BUCKET_NAME, | 217 bucket=BUCKET_NAME, |
| 214 dest='%s/%s' % (environment, tarball_name) | 218 dest='%s/%s' % (environment, tarball_name_with_revision) |
| 215 ) | 219 ) |
| 216 else: | 220 else: |
| 217 # Run the package_source.py script that creates and uploads the source | 221 # Run the package_source.py script that creates and uploads the source |
| 218 # archive which also includes the .index files generated by the | 222 # archive which also includes the .index files generated by the |
| 219 # clang_indexer. The script inspects factory properties, so the options are | 223 # clang_indexer. The script inspects factory properties, so the options are |
| 220 # provided in this format. | 224 # provided in this format. |
| 221 fake_factory_properties = { | 225 fake_factory_properties = { |
| 222 'package_filename': bot_config.get('package_filename', ''), | 226 'package_filename': bot_config.get('package_filename', ''), |
| 223 } | 227 } |
| 224 args = [ | 228 args = [ |
| (...skipping 25 matching lines...) Expand all Loading... |
| 250 | 254 |
| 251 yield ( | 255 yield ( |
| 252 api.test( | 256 api.test( |
| 253 'full_%s_fail' % _sanitize_nonalpha('ChromiumOS Codesearch Staging')) + | 257 'full_%s_fail' % _sanitize_nonalpha('ChromiumOS Codesearch Staging')) + |
| 254 api.step_data('generate compilation database', | 258 api.step_data('generate compilation database', |
| 255 stdout=api.raw_io.output('some compilation data')) + | 259 stdout=api.raw_io.output('some compilation data')) + |
| 256 api.step_data('run translation_unit clang tool', retcode=2) + | 260 api.step_data('run translation_unit clang tool', retcode=2) + |
| 257 api.properties.generic(buildername='ChromiumOS Codesearch Staging', | 261 api.properties.generic(buildername='ChromiumOS Codesearch Staging', |
| 258 mastername='chromium.fyi') | 262 mastername='chromium.fyi') |
| 259 ) | 263 ) |
| OLD | NEW |