Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import os | |
| 6 | |
| 7 try: | |
| 8 import json # pylint: disable=F0401 | |
| 9 except ImportError: | |
| 10 import simplejson as json | |
| 11 | |
| 12 def deps_blacklist(path_to_whitelist_script, path_to_deps_file): | |
| 13 local_vars = {} | |
| 14 execfile(path_to_whitelist_script, {'os': os}, local_vars) | |
| 15 deps_whitelist = local_vars['DepsWhitelist']() | |
| 16 return deps_whitelist.get_aosp_bot_deps_blacklist(path_to_deps_file) | |
| 17 | |
| 18 def GetFactoryProperties(api, factory_properties, build_properties): | |
| 19 android_repo_url = factory_properties.get('android_repo_url') | |
| 20 android_repo_sync_flags = factory_properties.get('android_repo_sync_flags', | |
| 21 ['-j16', '-d', '-f']) | |
| 22 android_repo_resync_projects = factory_properties.get( | |
| 23 'android_repo_resync_projects') | |
| 24 android_repo_branch = factory_properties.get('android_repo_branch') | |
| 25 android_ndk_pin_revision = factory_properties.get('android_ndk_pin_revision') | |
| 26 | |
| 27 android_lunch_flavor = 'full-eng' | |
| 28 slave_android_root_name = 'android-src' | |
| 29 slave_android_build_path = api.slave_build_path(slave_android_root_name) | |
| 30 slave_android_out_path = api.slave_build_path(slave_android_root_name, 'out') | |
| 31 chromium_in_android_subpath = 'external/chromium_org' | |
| 32 slave_chromium_in_android_path = api.slave_build_path( | |
| 33 slave_android_root_name, chromium_in_android_subpath) | |
| 34 slave_repo_in_android_path = api.slave_build_path(slave_android_root_name, | |
| 35 '.repo', 'repo', 'repo') | |
| 36 slave_repo_copy_dir = api.slave_build_path('repo_copy') | |
| 37 slave_repo_copy_path = api.slave_build_path('repo_copy', 'repo') | |
| 38 | |
| 39 steps = api.Steps(build_properties) | |
| 40 | |
| 41 # This depends on __str__ being run delayed (at the time the command is about | |
| 42 # to be executred, not at the time the command stream is generated). | |
| 43 # TODO: better way? | |
|
iannucci
2013/05/09 21:13:38
*wistles*. Cool hax bro :D.
Unfortunately, this
mkosiba (inactive)
2013/05/10 15:08:52
I was expecting more of a "omg, this is terrible"
| |
| 44 class TrimmedDepsSpec(object): | |
| 45 def __init__(self): | |
| 46 pass | |
| 47 | |
| 48 def __str__(self): | |
| 49 custom_deps = deps_blacklist( | |
| 50 api.slave_build_path('src', 'android_webview', 'buildbot', | |
| 51 'deps_whitelist.py'), | |
| 52 api.slave_build_path('src', 'DEPS')) | |
| 53 trimmed_spec = { | |
| 54 'solutions': [{ | |
| 55 'name' : 'src', | |
| 56 'url' : steps.ChromiumSvnURL('chrome', 'trunk', 'src'), | |
| 57 'safesync_url': '', | |
| 58 'custom_deps': custom_deps, | |
| 59 }], | |
| 60 'target_os': ['android'], | |
| 61 } | |
| 62 return json.dumps(trimmed_spec) | |
| 63 | |
| 64 with_lunch_command = [api.slave_build_path('src', 'android_webview', | |
| 65 'buildbot', 'with_lunch'), | |
| 66 slave_android_build_path, | |
| 67 android_lunch_flavor] | |
| 68 | |
| 69 # For the android_webview AOSP build we want to only include whitelisted | |
| 70 # DEPS. This is to detect the addition of unexpected new deps to the webview. | |
| 71 spec = { | |
| 72 'solutions': [{ | |
| 73 'name' : 'src', | |
| 74 'url' : steps.ChromiumSvnURL('chrome', 'trunk', 'src'), | |
| 75 'deps_file': '', | |
| 76 'safesync_url': '', | |
| 77 }], | |
| 78 'target_os': ['android'], | |
| 79 } | |
| 80 | |
| 81 sync_with_trimmed_deps_step = [ | |
| 82 steps.step('sync with trimmed deps', [ | |
| 83 api.build_path('scripts', 'slave', 'annotated_checkout.py'), | |
| 84 '--type', 'gclient', '--spec', TrimmedDepsSpec()]), | |
| 85 ] | |
| 86 | |
| 87 # The version of repo checked into depot_tools doesn't support switching | |
| 88 # between branches correctly due to | |
| 89 # https://code.google.com/p/git-repo/issues/detail?id=46 which is why we use | |
| 90 # the copy of repo from the Android tree. | |
| 91 # The copy of repo from depot_tools is only used to bootstrap the Android | |
| 92 # tree checkout. | |
| 93 repo_init_steps = [] | |
| 94 | |
| 95 repo_path = api.depot_tools_path('repo') | |
| 96 if os.path.exists(slave_repo_in_android_path): | |
| 97 repo_path = slave_repo_copy_path | |
| 98 if not os.path.exists(slave_repo_copy_dir): | |
| 99 repo_init_steps.append( | |
| 100 steps.step('mkdir repo copy dir', | |
| 101 ['mkdir', '-p', slave_repo_copy_dir])) | |
| 102 repo_init_steps.append( | |
| 103 steps.step('use repo from Android source tree', [ | |
| 104 'cp', slave_repo_in_android_path, slave_repo_copy_path])) | |
| 105 | |
| 106 if not os.path.exists(slave_android_build_path): | |
| 107 repo_init_steps.append( | |
| 108 steps.step('mkdir android source root', [ | |
| 109 'mkdir', slave_android_root_name], | |
| 110 cwd=api.SLAVE_BUILD_ROOT)) | |
| 111 | |
| 112 # Piping through cat makes repo's check for running in a non-interactive | |
| 113 # environment succeed thus suppressing potential interactive prompts for user | |
| 114 # name and email. | |
| 115 repo_init_steps.append( | |
| 116 steps.step('repo init', [ | |
| 117 repo_path, | |
| 118 'init', | |
| 119 '-u', android_repo_url, | |
| 120 '-b', android_repo_branch], | |
| 121 pipes=[['cat']], | |
|
iannucci
2013/05/09 21:13:38
Ick. I think I'd (much) rather force ALL stdout fo
mkosiba (inactive)
2013/05/10 15:08:52
ah.. exciting news here - this was caused by the r
iannucci
2013/05/10 20:21:53
Ah, sweet! I should have remembered that.
It woul
| |
| 122 cwd=slave_android_build_path)) | |
| 123 | |
| 124 repo_sync_step = [ | |
| 125 steps.step('repo sync', | |
| 126 [repo_path, 'sync'] + android_repo_sync_flags, | |
| 127 cwd=slave_android_build_path), | |
| 128 ] | |
| 129 | |
| 130 local_manifest_ndk_pin_revision = [] | |
| 131 if android_ndk_pin_revision: | |
| 132 local_manifest_ndk_pin_revision = ['--ndk-revision', | |
| 133 android_ndk_pin_revision] | |
| 134 generate_local_manifest_steps = [ | |
| 135 steps.step('generate local manifest', [ | |
| 136 api.slave_build_path( | |
| 137 'src', 'android_webview', 'buildbot', | |
| 138 'generate_local_manifest.py'), | |
| 139 slave_android_build_path, chromium_in_android_subpath] + | |
| 140 local_manifest_ndk_pin_revision), | |
| 141 steps.step('repo re-sync', [repo_path, 'sync', '-l'], | |
| 142 cwd=slave_android_build_path), | |
| 143 ] | |
| 144 | |
| 145 # If the repo sync flag override specifies a smart sync manifest, then this | |
| 146 # makes it possible to sync specific projects past the smart sync manifest | |
| 147 # to the most up-to-date version. | |
| 148 android_repo_resync_projects_steps = [] | |
| 149 if android_repo_resync_projects: | |
| 150 for project in android_repo_resync_projects: | |
| 151 android_repo_resync_projects_steps.append( | |
| 152 steps.step('repo re-sync project ' + project, | |
| 153 [repo_path, 'sync', project], | |
| 154 cwd=slave_android_build_path)) | |
| 155 | |
| 156 | |
| 157 remove_potentially_stale_android_chromium_org_step = [] | |
| 158 if os.path.exists(slave_chromium_in_android_path): | |
| 159 remove_potentially_stale_android_chromium_org_step = [ | |
| 160 steps.step('remove potentially stale chromium_org', | |
| 161 ['rm', '-rf', slave_chromium_in_android_path]), | |
| 162 ] | |
| 163 | |
| 164 symlink_chromium_into_android_tree_step = [ | |
| 165 steps.step('symlink chromium source into android tree', | |
| 166 ['ln', '-s', api.slave_build_path('src'), | |
| 167 slave_chromium_in_android_path]), | |
| 168 ] | |
| 169 | |
| 170 gyp_webview_step = [ | |
| 171 steps.step('gyp_webview', with_lunch_command + [ | |
| 172 api.slave_build_path( | |
| 173 slave_android_root_name, 'external', 'chromium_org', | |
| 174 'android_webview', 'tools', 'gyp_webview')], | |
| 175 cwd=slave_chromium_in_android_path), | |
| 176 ] | |
| 177 | |
| 178 # The Android.mk build system handles deps differently than the 'regular' | |
| 179 # Chromium makefiles which can lead to targets not being rebuilt. | |
| 180 # Fixing this is actually quite hard so we make this bot always clobber. | |
| 181 clobber_step = [ | |
| 182 steps.step('clobber', ['rm', '-rf', slave_android_out_path + '/*']), | |
| 183 ] | |
| 184 | |
| 185 compile_compiler_option = [] | |
| 186 if os.path.exists(api.build_path('goma')): | |
| 187 compile_compiler_option = ['--compiler', 'goma', | |
| 188 '--goma-dir', api.build_path('goma')] | |
| 189 compile_step = [ | |
| 190 steps.step('compile', with_lunch_command + | |
| 191 [api.build_path('scripts', 'slave', 'compile.py'), | |
| 192 'libwebviewchromium', 'android_webview_java', | |
| 193 '--build-dir', api.slave_build_path(), | |
| 194 '--src-dir', slave_android_build_path, | |
| 195 '--target-output-dir', slave_android_out_path, | |
| 196 '--build-tool', 'make-android', | |
| 197 '--verbose'] + compile_compiler_option, | |
| 198 cwd=api.SLAVE_BUILD_ROOT), | |
| 199 ] | |
| 200 | |
| 201 return { | |
| 202 'checkout': 'gclient', | |
| 203 'gclient_spec': spec, | |
| 204 'steps': ( | |
| 205 sync_with_trimmed_deps_step + | |
| 206 repo_init_steps + | |
| 207 repo_sync_step + | |
| 208 generate_local_manifest_steps + | |
| 209 android_repo_resync_projects_steps + | |
| 210 remove_potentially_stale_android_chromium_org_step + | |
| 211 symlink_chromium_into_android_tree_step + | |
| 212 gyp_webview_step + | |
| 213 clobber_step + | |
| 214 compile_step | |
| 215 ), | |
| 216 } | |
| 217 | |
| OLD | NEW |