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') |