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

Side by Side Diff: dart/third_party/pkg/js/tools/create_bootstrap.dart

Issue 57393002: Version 0.8.10.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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
(Empty)
1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file.
5
6 /**
7 * This utility carves out the embedded bootstrap JavaScript in
8 * js.dart as a separate file that may be included directly in html.
9 * This is necessary in settings where script injection is disallowed.
10 *
11 * To run, navigate to the top-level directory for this project and run:
12 * .../dart ./tools/create_bootstrap.dart
13 */
14 library create_bootstrap;
15
16 import 'dart:io';
17
18 final JS_PATTERN = new RegExp(r'final _JS_BOOTSTRAP = r"""((.*\n)*)""";');
19
20 final HEADER = """
21 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
22 // for details. All rights reserved. Use of this source code is governed by a
23 // BSD-style license that can be found in the LICENSE file.
24
25 // THIS FILE IS AUTO GENERATED. PLEASE DO NOT EDIT.
26
27 // TODO(vsm): Move this file once we determine where assets should go. See
28 // http://dartbug.com/6101.
29 """;
30
31 createFile(Path source, Path target) {
32 final f = new File.fromPath(source);
33 f.readAsString()
34 .then((text) {
35 final js = JS_PATTERN.firstMatch(text).group(1);
36 final out = new File.fromPath(target);
37 out.create()
38 .then((out) => out.open(mode: FileMode.WRITE)
39 .then((file) => file.writeString(HEADER)
40 .then((file) => file.writeString(js)
41 .then((file) => file.close()))));
42 });
43 }
44
45 create(Path libPath) {
46 final source = libPath.append('js.dart');
47 final target = libPath.append('dart_interop.js');
48 createFile(source, target);
49 }
50
51 main() {
52 final scriptPath = new Path(Platform.script).directoryPath;
53 final libPath = scriptPath.join(new Path('../lib'));
54 create(libPath);
55 }
OLDNEW
« no previous file with comments | « dart/third_party/pkg/js/test/js_wrapping/browser_tests.html ('k') | dart/third_party/pkg/js/update-ghpages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698