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

Side by Side Diff: tools/create_sdk.py

Issue 1295073003: create dartdoc snapshot, add to dart-sdk. Also add resources needed to run dartdoc from the sdk. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: update dartdoc in DEPS Created 5 years, 4 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 | « sdk/bin/dartdoc.bat ('k') | utils/dartdoc/dartdoc.gyp » ('j') | 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 # 2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 # A script which will be invoked from gyp to create an SDK. 7 # A script which will be invoked from gyp to create an SDK.
8 # 8 #
9 # Usage: create_sdk.py sdk_directory 9 # Usage: create_sdk.py sdk_directory
10 # 10 #
11 # The SDK will be used either from the command-line or from the editor. 11 # The SDK will be used either from the command-line or from the editor.
12 # Top structure is 12 # Top structure is
13 # 13 #
14 # ..dart-sdk/ 14 # ..dart-sdk/
15 # ....bin/ 15 # ....bin/
16 # ......dart or dart.exe (executable) 16 # ......dart or dart.exe (executable)
17 # ......dart.lib (import library for VM native extensions on Windows) 17 # ......dart.lib (import library for VM native extensions on Windows)
18 # ......dartdoc
18 # ......dartfmt 19 # ......dartfmt
19 # ......dart2js 20 # ......dart2js
20 # ......dartanalyzer 21 # ......dartanalyzer
21 # ......pub 22 # ......pub
22 # ......snapshots/ 23 # ......snapshots/
23 # ........analysis_server.dart.snapshot 24 # ........analysis_server.dart.snapshot
24 # ........dart2js.dart.snapshot 25 # ........dart2js.dart.snapshot
25 # ........dartanalyzer.dart.snapshot 26 # ........dartanalyzer.dart.snapshot
27 # ........dartdoc.dart.snapshot
26 # ........dartfmt.dart.snapshot 28 # ........dartfmt.dart.snapshot
27 # ........pub.dart.snapshot 29 # ........pub.dart.snapshot
28 # ........utils_wrapper.dart.snapshot 30 # ........utils_wrapper.dart.snapshot
31 #.........resources/
32 #...........dartdoc/
33 #..............packages
34 #.............resources/
35 #.............templates/
29 # ....include/ 36 # ....include/
30 # ......dart_api.h 37 # ......dart_api.h
31 # ......dart_mirrors_api.h 38 # ......dart_mirrors_api.h
32 # ......dart_native_api.h 39 # ......dart_native_api.h
33 # ......dart_tools_api.h 40 # ......dart_tools_api.h
34 # ....lib/ 41 # ....lib/
35 # ......_internal/ 42 # ......_internal/
36 # ......async/ 43 # ......async/
37 # ......collection/ 44 # ......collection/
38 # ......convert/ 45 # ......convert/
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 if dest_file.endswith('_sdk'): 114 if dest_file.endswith('_sdk'):
108 dest_file = dest_file.replace('_sdk', '') 115 dest_file = dest_file.replace('_sdk', '')
109 116
110 src = src_file + file_extension 117 src = src_file + file_extension
111 dest = join(dest_dir, dest_file + file_extension) 118 dest = join(dest_dir, dest_file + file_extension)
112 Copy(src, dest) 119 Copy(src, dest)
113 120
114 121
115 def CopyDartScripts(home, sdk_root): 122 def CopyDartScripts(home, sdk_root):
116 for executable in ['dart2js_sdk', 'dartanalyzer_sdk', 'dartfmt_sdk', 'docgen', 123 for executable in ['dart2js_sdk', 'dartanalyzer_sdk', 'dartfmt_sdk', 'docgen',
117 'dartdocgen', 'pub_sdk']: 124 'dartdocgen', 'pub_sdk', 'dartdoc']:
118 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), 125 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
119 os.path.join(sdk_root, 'bin')) 126 os.path.join(sdk_root, 'bin'))
120 127
121 128
122 def CopySnapshots(snapshots, sdk_root): 129 def CopySnapshots(snapshots, sdk_root):
123 for snapshot in ['analysis_server', 'dart2js', 'dartanalyzer', 'dartfmt', 130 for snapshot in ['analysis_server', 'dart2js', 'dartanalyzer', 'dartfmt',
124 'utils_wrapper', 'pub']: 131 'utils_wrapper', 'pub', 'dartdoc']:
125 snapshot += '.dart.snapshot' 132 snapshot += '.dart.snapshot'
126 copyfile(join(snapshots, snapshot), 133 copyfile(join(snapshots, snapshot),
127 join(sdk_root, 'bin', 'snapshots', snapshot)) 134 join(sdk_root, 'bin', 'snapshots', snapshot))
128 135
136 def CopyDartdocResources(home,sdk_root):
137 RESOURCE_DIR = join(sdk_root, 'bin', 'snapshots', 'resources')
138 DARTDOC = join(RESOURCE_DIR, 'dartdoc')
139
140 copytree(join(home, 'third_party', 'pkg', 'dartdoc', 'lib', 'templates'),
141 join(DARTDOC, 'templates'))
142 copytree(join(home, 'third_party', 'pkg', 'dartdoc', 'lib', 'resources'),
143 join(DARTDOC, 'resources'))
144 # write the .packages file
145 PACKAGES_FILE = join(DARTDOC, '.packages')
146 packages_file = open(PACKAGES_FILE, 'w')
147 packages_file.write('dartdoc:.')
148 packages_file.close()
149
129 150
130 def Main(): 151 def Main():
131 # Pull in all of the gypi files which will be munged into the sdk. 152 # Pull in all of the gypi files which will be munged into the sdk.
132 HOME = dirname(dirname(realpath(__file__))) 153 HOME = dirname(dirname(realpath(__file__)))
133 154
134 (options, args) = GetOptions() 155 (options, args) = GetOptions()
135 156
136 SDK = options.sdk_output_dir 157 SDK = options.sdk_output_dir
137 SDK_tmp = '%s.tmp' % SDK 158 SDK_tmp = '%s.tmp' % SDK
138 159
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 265
245 # Copy in 7zip for Windows. 266 # Copy in 7zip for Windows.
246 if HOST_OS == 'win32': 267 if HOST_OS == 'win32':
247 copytree(join(HOME, 'third_party', '7zip'), 268 copytree(join(HOME, 'third_party', '7zip'),
248 join(RESOURCE, '7zip'), 269 join(RESOURCE, '7zip'),
249 ignore=ignore_patterns('.svn')) 270 ignore=ignore_patterns('.svn'))
250 271
251 # Copy dart2js/pub. 272 # Copy dart2js/pub.
252 CopyDartScripts(HOME, SDK_tmp) 273 CopyDartScripts(HOME, SDK_tmp)
253 CopySnapshots(SNAPSHOT, SDK_tmp) 274 CopySnapshots(SNAPSHOT, SDK_tmp)
275 CopyDartdocResources(HOME, SDK_tmp)
254 276
255 # Write the 'version' file 277 # Write the 'version' file
256 version = utils.GetVersion() 278 version = utils.GetVersion()
257 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w') 279 versionFile = open(os.path.join(SDK_tmp, 'version'), 'w')
258 versionFile.write(version + '\n') 280 versionFile.write(version + '\n')
259 versionFile.close() 281 versionFile.close()
260 282
261 # Write the 'revision' file 283 # Write the 'revision' file
262 revision = utils.GetGitRevision() 284 revision = utils.GetGitRevision()
263 285
264 if revision is not None: 286 if revision is not None:
265 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 287 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
266 f.write('%s\n' % revision) 288 f.write('%s\n' % revision)
267 f.close() 289 f.close()
268 290
269 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) 291 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README'))
270 Copy(join(HOME, 'sdk', 'api_readme.md'), join(SDK_tmp, 'lib', 'api_readme.md') ) 292 Copy(join(HOME, 'sdk', 'api_readme.md'), join(SDK_tmp, 'lib', 'api_readme.md') )
271 293
272 move(SDK_tmp, SDK) 294 move(SDK_tmp, SDK)
273 295
274 if __name__ == '__main__': 296 if __name__ == '__main__':
275 sys.exit(Main()) 297 sys.exit(Main())
OLDNEW
« no previous file with comments | « sdk/bin/dartdoc.bat ('k') | utils/dartdoc/dartdoc.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698