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

Side by Side Diff: dart/tools/create_sdk.py

Issue 10266011: Shoehorn dart2js into the SDK. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, 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 #
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 saves them back out. subs should by a list of (pattern, replace) tuples.''' 67 saves them back out. subs should by a list of (pattern, replace) tuples.'''
68 for path in paths: 68 for path in paths:
69 contents = open(path).read() 69 contents = open(path).read()
70 for pattern, replace in subs: 70 for pattern, replace in subs:
71 contents = re.sub(pattern, replace, contents) 71 contents = re.sub(pattern, replace, contents)
72 72
73 dest = open(path, 'w') 73 dest = open(path, 'w')
74 dest.write(contents) 74 dest.write(contents)
75 dest.close() 75 dest.close()
76 76
77
78 def Copy(src, dest):
79 copyfile(src, dest)
80 copymode(src, dest)
81
82
83 def CopyDart2Js(build_dir, sdk_root):
kasperl 2012/05/01 05:51:07 Maybe add a comment that explains what you're copy
ahe 2012/05/02 10:32:17 Done.
84 copytree('lib', os.path.join(sdk_root, 'lib', 'dart2js', 'lib'),
85 ignore=ignore_patterns('.svn'))
86 copytree(os.path.join('corelib', 'src'),
87 os.path.join(sdk_root, 'lib', 'dart2js', 'corelib', 'src'),
88 ignore=ignore_patterns('.svn'))
89 copytree(os.path.join('runtime', 'lib'),
90 os.path.join(sdk_root, 'lib', 'dart2js', 'runtime', 'lib'),
91 ignore=ignore_patterns('.svn'))
92 copytree(os.path.join('runtime', 'bin'),
93 os.path.join(sdk_root, 'lib', 'dart2js', 'runtime', 'bin'),
94 ignore=ignore_patterns('.svn'))
dgrove 2012/05/01 06:54:58 This approach generally looks orthogonal to the wa
dgrove 2012/05/01 06:54:58 What are you doing about the html and isolate libr
ahe 2012/05/02 10:32:17 I'm copying dart/lib to PRODUCT_DIR/dart-sdk/lib/d
ahe 2012/05/02 10:32:17 I thought the plan was to shuffle directories arou
95 dart2js = os.path.join(sdk_root, 'bin', 'dart2js')
kasperl 2012/05/01 05:51:07 Shouldn't this be different on Windows? Don't you
ahe 2012/05/02 10:32:17 I think I'll break Windows if I don't create the B
96 Copy(os.path.join(build_dir, 'dart2js'), dart2js)
97
98 ReplaceInFiles([dart2js],
99 [(r'\$BIN_DIR/\.\./\.\./lib',
100 r'$BIN_DIR/../lib/dart2js/lib')])
101
102
103
77 def Main(argv): 104 def Main(argv):
78 # Pull in all of the gpyi files which will be munged into the sdk. 105 # Pull in all of the gpyi files which will be munged into the sdk.
79 builtin_runtime_sources = \ 106 builtin_runtime_sources = \
80 (eval(open("runtime/bin/builtin_sources.gypi").read()))['sources'] 107 (eval(open("runtime/bin/builtin_sources.gypi").read()))['sources']
81 io_runtime_sources = \ 108 io_runtime_sources = \
82 (eval(open("runtime/bin/io_sources.gypi").read()))['sources'] 109 (eval(open("runtime/bin/io_sources.gypi").read()))['sources']
83 corelib_sources = \ 110 corelib_sources = \
84 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources'] 111 (eval(open("corelib/src/corelib_sources.gypi").read()))['sources']
85 corelib_frog_sources = \ 112 corelib_frog_sources = \
86 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources'] 113 (eval(open("frog/lib/frog_corelib_sources.gypi").read()))['sources']
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 444
418 445
419 # Copy import maps 446 # Copy import maps
420 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js', 'frog' ] 447 PLATFORMS = ['any', 'vm', 'dartium', 'dart2js', 'frog' ]
421 os.makedirs(join(LIB, 'config')) 448 os.makedirs(join(LIB, 'config'))
422 for platform in PLATFORMS: 449 for platform in PLATFORMS:
423 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config') 450 import_src = join(HOME, 'lib', 'config', 'import_' + platform + '.config')
424 import_dst = join(LIB, 'config', 'import_' + platform + '.config') 451 import_dst = join(LIB, 'config', 'import_' + platform + '.config')
425 copyfile(import_src, import_dst); 452 copyfile(import_src, import_dst);
426 453
454 CopyDart2Js(build_dir, SDK_tmp)
455
427 # Write the 'revision' file 456 # Write the 'revision' file
428 revision = utils.GetSVNRevision() 457 revision = utils.GetSVNRevision()
429 if revision is not None: 458 if revision is not None:
430 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: 459 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f:
431 f.write(revision + '\n') 460 f.write(revision + '\n')
432 f.close() 461 f.close()
433 462
434 move(SDK_tmp, SDK) 463 move(SDK_tmp, SDK)
435 utils.Touch(os.path.join(SDK, 'create.stamp')) 464 utils.Touch(os.path.join(SDK, 'create.stamp'))
436 465
437 if __name__ == '__main__': 466 if __name__ == '__main__':
438 sys.exit(Main(sys.argv)) 467 sys.exit(Main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698