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

Unified Diff: tools/create_sdk.py

Issue 13945008: Move the dart2js snapshot into bin directory of sdk root. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« sdk/bin/dart2js ('K') | « sdk/bin/dart2js.bat ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/create_sdk.py
===================================================================
--- tools/create_sdk.py (revision 21139)
+++ tools/create_sdk.py (working copy)
@@ -18,6 +18,8 @@
# ......dart2js
# ......dart_analyzer
# ......pub
+# ......snapshots/
+# ........dart2js.dart.snapshot
# ....include/
# ......dart_api.h
# ......dart_debugger_api.h
@@ -99,9 +101,29 @@
Copy(src, dest)
+def CreateSnapshots(build_dir, sdk_root, internal_build_dir):
+ snapshots = [os.path.join(internal_build_dir, 'compiler',
+ 'implementation', 'dart2js.dart')]
+ for snapshot in snapshots:
+ snapshot_name = os.path.join(sdk_root, 'bin', 'snapshots',
+ basename(snapshot) + '.snapshot')
+ subprocess.call([os.path.join(build_dir, 'dart'),
kustermann 2013/04/09 15:02:28 Does this work on windows as well (or do we need t
ricow1 2013/04/09 15:26:59 This is using this existing code on with other arg
+ '--generate-script-snapshot=%s' %
+ snapshot_name,
kustermann 2013/04/09 15:02:28 You could move this a line up.
+ snapshot])
+
+
def CopyDartScripts(home, build_dir, sdk_root, version):
+ # We create a copy internal that we can use to create the snapshot
+ # with the right version from
+ internal_build_dir = os.path.join(sdk_root, '_internal')
+ if exists(internal_build_dir):
+ rmtree(internal_build_dir);
+ copytree(os.path.join(home, 'sdk', 'lib', '_internal'),
+ internal_build_dir)
ahe 2013/04/09 14:37:21 Did you test that this works? The relative refere
ricow1 2013/04/09 15:26:59 As discussed offline I will change this to a wrapp
+
if version:
- ReplaceInFiles([os.path.join(sdk_root, 'lib', '_internal', 'compiler',
+ ReplaceInFiles([os.path.join(internal_build_dir, 'compiler',
'implementation', 'compiler.dart')],
[(r"BUILD_ID = 'build number could not be determined'",
r"BUILD_ID = '%s'" % version)])
@@ -110,15 +132,10 @@
CopyShellScript(os.path.join(home, 'sdk', 'bin', executable),
os.path.join(sdk_root, 'bin'))
- subprocess.call([os.path.join(build_dir, 'dart'),
- '--generate-script-snapshot=%s' %
- os.path.join(sdk_root, 'lib', '_internal', 'compiler',
- 'implementation', 'dart2js.dart.snapshot'),
- os.path.join(sdk_root, 'lib', '_internal', 'compiler',
- 'implementation', 'dart2js.dart')])
+ CreateSnapshots(build_dir, sdk_root, internal_build_dir)
+ rmtree(internal_build_dir)
-
def Main(argv):
# Pull in all of the gpyi files which will be munged into the sdk.
kustermann 2013/04/09 15:02:28 gpyi -> gypi
ricow1 2013/04/09 15:26:59 Done.
HOME = dirname(dirname(realpath(__file__)))
@@ -139,6 +156,8 @@
# Create and populate sdk/bin.
BIN = join(SDK_tmp, 'bin')
os.makedirs(BIN)
+ SNAPSHOTS = join(BIN, 'snapshots')
+ os.makedirs(SNAPSHOTS)
# Copy the Dart VM binary and the Windows Dart VM link library
# into sdk/bin.
@@ -199,7 +218,11 @@
#
os.makedirs(join(LIB, 'html'))
- for library in ['_internal', 'async', 'collection', '_collection_dev', 'core',
+
+ # Remove _internal/compiler/implementation/lib when we can add that
+ # as part of the dart2js snapshot.
+ for library in ['_internal/compiler/implementation/lib',
+ 'async', 'collection', '_collection_dev', 'core',
'crypto', 'io', 'isolate',
join('chrome', 'dart2js'), join('chrome', 'dartium'),
join('html', 'dart2js'), join('html', 'dartium'),
@@ -214,6 +237,9 @@
copytree(join(HOME, 'sdk', 'lib', library), join(LIB, library),
ignore=ignore_patterns('*.svn', 'doc', '*.py', '*.gypi', '*.sh'))
+ # Remove this once we can add it as part of the dart2js snapshot.
ahe 2013/04/09 14:37:21 The Editor will still need it.
+ copyfile(join(HOME, 'sdk', 'lib', '_internal', 'libraries.dart'),
+ join(LIB, '_internal', 'libraries.dart'))
# Create and copy packages.
PACKAGES = join(SDK_tmp, 'packages')
« sdk/bin/dart2js ('K') | « sdk/bin/dart2js.bat ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698