Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: sky/tools/deploy_sdk.py

Issue 1038273002: Fix deploy_sdk.py to include README.md and stock data files (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sky/framework/testplan.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 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 argparse 6 import argparse
7 from datetime import datetime 7 from datetime import datetime
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 13
14 # Generates the sky_sdk from the template at sky/sdk. 14 # Generates the sky_sdk from the template at sky/sdk.
15 15
16 # This script has a split personality of both making our deployment sdk 16 # This script has a split personality of both making our deployment sdk
17 # as well as being a required part of developing locally, since all 17 # as well as being a required part of developing locally, since all
18 # of our framework assumes it's working from the SDK. 18 # of our framework assumes it's working from the SDK.
19 19
20 SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__)) 20 SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
21 SKY_DIR = os.path.dirname(SKY_TOOLS_DIR) 21 SKY_DIR = os.path.dirname(SKY_TOOLS_DIR)
22 SRC_ROOT = os.path.dirname(SKY_DIR) 22 SRC_ROOT = os.path.dirname(SKY_DIR)
23 23
24 DEFAULT_REL_BUILD_DIR = os.path.join('out', 'android_Release') 24 DEFAULT_REL_BUILD_DIR = os.path.join('out', 'android_Release')
25 25
26 def git_revision(): 26 def git_revision():
27 return subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip() 27 return subprocess.check_output(['git', 'rev-parse', 'HEAD']).strip()
28 28
29
29 def gen_filter(path): 30 def gen_filter(path):
30 if os.path.isdir(path): 31 if os.path.isdir(path):
31 return True 32 return True
32 _, ext = os.path.splitext(path) 33 _, ext = os.path.splitext(path)
33 # Don't include all .dart, just .mojom.dart. 34 # Don't include all .dart, just .mojom.dart.
34 return path.endswith('.mojom.dart') 35 return path.endswith('.mojom.dart')
35 36
37
36 def dart_filter(path): 38 def dart_filter(path):
37 if os.path.isdir(path): 39 if os.path.isdir(path):
38 return True 40 return True
39 _, ext = os.path.splitext(path) 41 _, ext = os.path.splitext(path)
40 # .dart includes '.mojom.dart' 42 # .dart includes '.mojom.dart'
41 return ext == '.dart' 43 return ext == '.dart'
42 44
43 45
44 def sky_or_dart_filter(path):
45 if os.path.isdir(path):
46 return True
47 _, ext = os.path.splitext(path)
48 # .dart includes '.mojom.dart'
49 return ext == '.sky' or ext == '.dart'
50
51
52 def ensure_dir_exists(path): 46 def ensure_dir_exists(path):
53 if not os.path.exists(path): 47 if not os.path.exists(path):
54 os.makedirs(path) 48 os.makedirs(path)
55 49
56 50
57 def copy(from_root, to_root, filter_func=None): 51 def copy(from_root, to_root, filter_func=None):
58 assert os.path.exists(from_root), "%s does not exist!" % from_root 52 assert os.path.exists(from_root), "%s does not exist!" % from_root
59 if os.path.isfile(from_root): 53 if os.path.isfile(from_root):
60 ensure_dir_exists(os.path.dirname(to_root)) 54 ensure_dir_exists(os.path.dirname(to_root))
61 shutil.copy(from_root, to_root) 55 shutil.copy(from_root, to_root)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 143
150 def src_path(rel_path): 144 def src_path(rel_path):
151 return os.path.join(SRC_ROOT, rel_path) 145 return os.path.join(SRC_ROOT, rel_path)
152 146
153 ensure_dir_exists(sdk_root) 147 ensure_dir_exists(sdk_root)
154 delete_all_non_hidden_files_in_directory(sdk_root, args.non_interactive) 148 delete_all_non_hidden_files_in_directory(sdk_root, args.non_interactive)
155 149
156 # Manually clear sdk_root above to avoid deleting dot-files. 150 # Manually clear sdk_root above to avoid deleting dot-files.
157 copy(src_path('sky/sdk'), sdk_root) 151 copy(src_path('sky/sdk'), sdk_root)
158 152
159 copy_or_link(src_path('sky/examples'), sdk_path('examples'), 153 copy_or_link(src_path('sky/examples'), sdk_path('examples'))
160 sky_or_dart_filter)
161 154
162 # Sky package 155 # Sky package
163 copy_or_link(src_path('sky/framework'), 156 copy_or_link(src_path('sky/framework'), sdk_path('packages/sky/lib/framework '))
164 sdk_path('packages/sky/lib/framework'), sky_or_dart_filter)
165 copy_or_link(src_path('sky/assets'), sdk_path('packages/sky/lib/assets')) 157 copy_or_link(src_path('sky/assets'), sdk_path('packages/sky/lib/assets'))
166 # Copy gen files every time for now: 158 # Copy gen files every time for now:
167 copy(os.path.join(build_dir, 'gen/sky'), 159 copy(os.path.join(build_dir, 'gen/sky'),
168 sdk_path('packages/sky/lib'), gen_filter) 160 sdk_path('packages/sky/lib'), gen_filter)
169 161
170 # Sky SDK additions: 162 # Sky SDK additions:
171 copy_or_link(src_path('sky/engine/bindings/builtin.dart'), 163 copy_or_link(src_path('sky/engine/bindings/builtin.dart'),
172 sdk_path('packages/sky/sdk_additions/dart_sky_builtins.dart')) 164 sdk_path('packages/sky/sdk_additions/dart_sky_builtins.dart'))
173 bindings_path = os.path.join(build_dir, 'gen/sky/bindings') 165 bindings_path = os.path.join(build_dir, 'gen/sky/bindings')
174 # dart_sky.dart has many supporting files: 166 # dart_sky.dart has many supporting files:
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 'git', 'commit', 210 'git', 'commit',
219 '-m', '%s from %s' % (rel_build_dir, git_revision()) 211 '-m', '%s from %s' % (rel_build_dir, git_revision())
220 ], cwd=sdk_root) 212 ], cwd=sdk_root)
221 213
222 time_delta = datetime.now() - start_time 214 time_delta = datetime.now() - start_time
223 print 'SDK built at %s in %ss' % (sdk_root, time_delta.total_seconds()) 215 print 'SDK built at %s in %ss' % (sdk_root, time_delta.total_seconds())
224 216
225 217
226 if __name__ == '__main__': 218 if __name__ == '__main__':
227 main() 219 main()
OLDNEW
« no previous file with comments | « sky/framework/testplan.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698