OLD | NEW |
| (Empty) |
1 # Copyright 2015 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 """Recipe to build windows depot_tools bootstrap zipfile.""" | |
6 | |
7 DEPS = [ | |
8 'recipe_engine/path', | |
9 'recipe_engine/platform', | |
10 'recipe_engine/properties', | |
11 'recipe_engine/step', | |
12 | |
13 'depot_tools/git', | |
14 | |
15 'file', | |
16 'gsutil', | |
17 'zip', | |
18 ] | |
19 | |
20 from recipe_engine.recipe_api import Property | |
21 | |
22 REPO_URL='https://chromium.googlesource.com/chromium/tools/depot_tools.git' | |
23 DOC_UPLOAD_URL='gs://chrome-infra-docs/flat/depot_tools/docs/' | |
24 | |
25 PROPERTIES = { | |
26 'revision': Property( | |
27 kind=str, help='The revision of depot_tools to check out'), | |
28 } | |
29 | |
30 def RunSteps(api, revision): | |
31 # prepare the output dir and zip paths | |
32 api.path['checkout'] = api.path['slave_build'].join('depot_tools') | |
33 zip_out = api.path['slave_build'].join('depot_tools.zip') | |
34 | |
35 with api.step.nest('clean workspace'): | |
36 api.file.rmtree('rm depot_tools', api.path['checkout']) | |
37 api.file.remove('rm depot_tools.zip', zip_out, ok_ret=(0, 1)) | |
38 | |
39 # generate the new directory | |
40 api.step('mk depot_tools', ['mkdir', api.path['checkout']]) | |
41 | |
42 with api.step.nest('clone + checkout'): | |
43 api.git('clone', '--single-branch', '-n', REPO_URL, api.path['checkout']) | |
44 api.git('config', 'core.autocrlf', 'false', name='set autocrlf') | |
45 api.git('config', 'core.filemode', 'false', name='set filemode') | |
46 api.git('config', 'core.symlinks', 'false', name='set symlinks') | |
47 api.git('checkout', 'origin/master') | |
48 api.git('reset', '--hard', revision) | |
49 api.git('reflog', 'expire', '--all') | |
50 api.git('gc', '--aggressive', '--prune=all') | |
51 | |
52 # zip + upload repo | |
53 api.zip.directory('zip it up', api.path['checkout'], zip_out) | |
54 api.gsutil.upload(zip_out, 'chrome-infra', 'depot_tools.zip', | |
55 args=['-a', 'public-read'], unauthenticated_url=True) | |
56 | |
57 # upload html docs | |
58 api.gsutil(['cp', '-r', '-z', 'html', '-a', 'public-read', | |
59 api.path['checkout'].join('man', 'html'), DOC_UPLOAD_URL], | |
60 name='upload docs') | |
61 | |
62 | |
63 def GenTests(api): | |
64 yield ( | |
65 api.test('basic') + | |
66 api.properties(path_config='kitchen', revision='deadbeef') | |
67 ) | |
OLD | NEW |