OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // Usage: Add the following to your .gclient file (found in the parent | 5 // Usage: Add the following to your .gclient file (found in the parent |
6 // of the "dart" in a gclient checkout of the Dart repositor). | 6 // of the "dart" in a gclient checkout of the Dart repositor). |
7 // | 7 // |
8 // hooks = [ | 8 // hooks = [ |
9 // { | 9 // { |
10 // "pattern": ".", | 10 // "pattern": ".", |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 main(List<String> arguments) { | 54 main(List<String> arguments) { |
55 handler = new FormattingDiagnosticHandler() | 55 handler = new FormattingDiagnosticHandler() |
56 ..throwOnError = true; | 56 ..throwOnError = true; |
57 | 57 |
58 outputUri = | 58 outputUri = |
59 handler.provider.cwd.resolve(nativeToUriPath(arguments.first)); | 59 handler.provider.cwd.resolve(nativeToUriPath(arguments.first)); |
60 output = new File(arguments.first).openSync(mode: FileMode.WRITE); | 60 output = new File(arguments.first).openSync(mode: FileMode.WRITE); |
61 | 61 |
62 Uri myLocation = | 62 Uri myLocation = |
63 handler.provider.cwd.resolve(nativeToUriPath(Platform.script)); | 63 handler.provider.cwd.resolveUri(Platform.script); |
64 | 64 |
65 // Get the names of public dart2js libraries. | 65 // Get the names of public dart2js libraries. |
66 Iterable<String> names = LIBRARIES.keys.where(isPublicDart2jsLibrary); | 66 Iterable<String> names = LIBRARIES.keys.where(isPublicDart2jsLibrary); |
67 | 67 |
68 // Prepend "dart:" to the names. | 68 // Prepend "dart:" to the names. |
69 List<Uri> uris = names.map((String name) => Uri.parse('dart:$name')).toList(); | 69 List<Uri> uris = names.map((String name) => Uri.parse('dart:$name')).toList(); |
70 | 70 |
71 // Append dart2js itself. | 71 // Append dart2js itself. |
72 uris.add(myLocation.resolve(DART2JS)); | 72 uris.add(myLocation.resolve(DART2JS)); |
73 uris.add(myLocation.resolve(DART2JS_MIRROR)); | 73 uris.add(myLocation.resolve(DART2JS_MIRROR)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 var tag_definition_data = '$buffer'; | 124 var tag_definition_data = '$buffer'; |
125 var src_file = relativize(outputUri, uri, false); | 125 var src_file = relativize(outputUri, uri, false); |
126 var size_of_tag_definition_data_in_bytes = tag_definition_data.length; | 126 var size_of_tag_definition_data_in_bytes = tag_definition_data.length; |
127 | 127 |
128 // The header. | 128 // The header. |
129 output.writeStringSync( | 129 output.writeStringSync( |
130 '\x0c\n${src_file},${size_of_tag_definition_data_in_bytes}\n'); | 130 '\x0c\n${src_file},${size_of_tag_definition_data_in_bytes}\n'); |
131 output.writeStringSync(tag_definition_data); | 131 output.writeStringSync(tag_definition_data); |
132 } | 132 } |
OLD | NEW |