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 steps.use_mirror = False | |
| 41 | |
| 42 # This depends on __str__ being run delayed (at the time the command is about | |
| 43 # to be executred, not at the time the command stream is generated). | |
| 44 # TODO: better way? | |
| 45 class TrimmedDepsSpec(object): | |
| 46 def __init__(self): | |
| 47 pass | |
| 48 | |
| 49 def __str__(self): | |
| 50 custom_deps = deps_blacklist( | |
| 51 api.slave_build_path('src2', 'android_webview', 'buildbot', | |
| 52 'deps_whitelist.py'), | |
| 53 api.slave_build_path('src', 'DEPS')) | |
| 54 trimmed_spec = { | |
| 55 'solutions': [{ | |
| 56 'name' : 'src', | |
| 57 'url' : steps.ChromiumSvnURL('chrome', 'trunk', 'src'), | |
| 58 'safesync_url': '', | |
| 59 'custom_deps': custom_deps, | |
| 60 }], | |
| 61 'target_os': ['android'], | |
| 62 } | |
| 63 return json.dumps(trimmed_spec) | |
| 64 | |
| 65 with_lunch_command = [api.slave_build_path('src2', 'android_webview', | |
| 66 'buildbot', 'with_lunch'), | |
| 67 slave_android_build_path, | |
| 68 android_lunch_flavor] | |
| 69 | |
| 70 # For the android_webview AOSP build we want to only include whitelisted | |
| 71 # DEPS. This is to detect the addition of unexpected new deps to the webview. | |
| 72 spec = { | |
| 73 'solutions': [{ | |
| 74 'name' : 'src', | |
| 75 'url' : steps.ChromiumSvnURL('chrome', 'trunk', 'src'), | |
| 76 'deps_file': '', | |
| 77 'safesync_url': '', | |
| 78 }], | |
| 79 'target_os': ['android'], | |
| 80 } | |
| 81 | |
| 82 sync_with_trimmed_deps_step = [ | |
| 83 steps.step('sync with trimmed deps', | |
| 84 [api.build_path('scripts', 'slave', 'annotated_checkout.py'), | |
| 85 '--type', 'gclient', | |
| 86 '--spec', TrimmedDepsSpec()]), | |
| 87 ] | |
| 88 | |
| 89 # The version of repo checked into depot_tools doesn't support switching | |
| 90 # between branches correctly due to | |
| 91 # https://code.google.com/p/git-repo/issues/detail?id=46 which is why we use | |
| 92 # the copy of repo from the Android tree. | |
| 93 # The copy of repo from depot_tools is only used to bootstrap the Android | |
| 94 # tree checkout. | |
| 95 repo_init_step = [] | |
| 96 | |
| 97 repo_path = api.depot_tools_path('repo') | |
| 98 if os.path.exists(slave_repo_in_android_path): | |
| 99 repo_path = slave_repo_copy_path | |
| 100 if not os.path.exists(slave_repo_copy_dir): | |
| 101 repo_init_step.append( | |
| 102 steps.step('mkdir repo copy dir', | |
| 103 ['mkdir', '-p', slave_repo_copy_dir])) | |
| 104 repo_init_step.append( | |
| 105 steps.step('use repo from Android source tree', | |
| 106 ['cp', slave_repo_in_android_path, | |
| 107 slave_repo_copy_path])) | |
| 108 | |
| 109 if not os.path.exists(slave_android_build_path): | |
| 110 repo_init_step.append( | |
| 111 steps.step('mkdir android source root', | |
| 112 ['mkdir', slave_android_root_name], | |
| 113 cwd=api.SLAVE_BUILD_ROOT)) | |
| 114 | |
| 115 # repo init can interactively ask about some user details which is why we | |
| 116 # echo the newlines and the 'y'. | |
| 117 repo_init_step.append( | |
| 118 steps.step('repo init', ['echo', '\n\ny\n'], pipes=[[ | |
|
mkosiba (inactive)
2013/05/07 13:30:19
is this the best way to supply the repo init comma
| |
| 119 repo_path, | |
| 120 'init', | |
| 121 '-u', android_repo_url, | |
| 122 '-b', android_repo_branch]], | |
| 123 cwd=slave_android_build_path)) | |
| 124 | |
| 125 repo_sync_step = [ | |
| 126 steps.step('repo sync', | |
| 127 [repo_path, 'sync'] + android_repo_sync_flags, | |
| 128 cwd=slave_android_build_path), | |
| 129 ] | |
| 130 | |
| 131 local_manifest_ndk_pin_revision = [] | |
| 132 if android_ndk_pin_revision: | |
| 133 local_manifest_ndk_pin_revision = ['--ndk-revision', | |
| 134 android_ndk_pin_revision] | |
| 135 local_manifest_ndk_pin_revision = ['--ndk-revision', | |
| 136 android_ndk_pin_revision] | |
| 137 generate_local_manifest_step = [ | |
| 138 steps.step('generate local manifest', [ | |
| 139 api.slave_build_path( | |
| 140 'src2', 'android_webview', 'buildbot', | |
| 141 'generate_local_manifest.py'), | |
| 142 slave_android_build_path, chromium_in_android_subpath] + | |
| 143 local_manifest_ndk_pin_revision), | |
| 144 steps.step('repo re-sync', [repo_path, 'sync', '-l'], | |
| 145 cwd=slave_android_build_path), | |
| 146 ] | |
| 147 | |
| 148 # If the repo sync flag override specifies a smart sync manifest, then this | |
| 149 # makes it possible to sync specific projects past the smart sync manifest | |
| 150 # to the most up-to-date version. | |
| 151 android_repo_resync_projects_step = [] | |
| 152 if android_repo_resync_projects: | |
| 153 for project in android_repo_resync_projects: | |
| 154 android_repo_resync_projects_step.append( | |
| 155 steps.step('repo re-sync project ' + project, | |
| 156 [repo_path, 'sync', project], | |
| 157 cwd=slave_android_build_path)) | |
| 158 | |
| 159 | |
| 160 remove_potentially_stale_android_chromium_org = [] | |
| 161 if os.path.exists(slave_chromium_in_android_path): | |
| 162 remove_potentially_stale_android_chromium_org = [ | |
| 163 steps.step('remove potentially stale chromium_org', | |
| 164 ['rm', '-rf', slave_chromium_in_android_path]), | |
| 165 ] | |
| 166 | |
| 167 symlink_chromium_into_android_tree_step = [ | |
| 168 steps.step('symlink chromium source into android tree', | |
| 169 ['ln', '-s', api.slave_build_path('src'), | |
| 170 slave_chromium_in_android_path]), | |
| 171 ] | |
| 172 | |
| 173 gyp_webview_step = [ | |
| 174 steps.step('gyp_webview', with_lunch_command + [ | |
| 175 api.slave_build_path( | |
| 176 slave_android_root_name, 'external', 'chromium_org', | |
| 177 'android_webview', 'tools', 'gyp_webview')], | |
| 178 cwd=slave_chromium_in_android_path), | |
| 179 ] | |
| 180 | |
| 181 # The Android.mk build system handles deps differently than the 'regular' | |
| 182 # Chromium makefiles which can lead to targets not being rebuilt. | |
| 183 # Fixing this is actually quite hard so we make this bot always clobber. | |
| 184 clobber_step = [ | |
| 185 steps.step('clobber', ['rm', '-rf', slave_android_out_path + '/*']), | |
| 186 ] | |
| 187 | |
| 188 compile_compiler_option = [] | |
| 189 if os.path.exists(api.build_path('goma')): | |
| 190 compile_compiler_option = ['--compiler', 'goma', | |
| 191 '--goma-dir', api.build_path('goma')] | |
| 192 compile_step = [ | |
| 193 steps.step('compile', with_lunch_command + | |
| 194 [api.build_path('scripts', 'slave', 'compile.py'), | |
| 195 'libwebviewchromium', 'android_webview_java', | |
| 196 '--build-dir', api.slave_build_path(), | |
| 197 '--src-dir', slave_android_build_path, | |
| 198 '--target-output-dir', slave_android_out_path, | |
| 199 '--build-tool', 'make-android', | |
| 200 '--verbose'] + compile_compiler_option, | |
| 201 cwd=api.SLAVE_BUILD_ROOT), | |
| 202 ] | |
| 203 | |
| 204 return { | |
| 205 'checkout': 'gclient', | |
| 206 'gclient_spec': spec, | |
| 207 'steps': ( | |
| 208 sync_with_trimmed_deps_step + | |
| 209 repo_init_step + | |
| 210 repo_sync_step + generate_local_manifest_step + | |
| 211 remove_potentially_stale_android_chromium_org + | |
| 212 symlink_chromium_into_android_tree_step + | |
| 213 gyp_webview_step + | |
| 214 clobber_step + | |
| 215 compile_step | |
| 216 ), | |
| 217 } | |
| 218 | |
| OLD | NEW |