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 import 'dart:io'; | 5 import 'dart:io'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 | 7 |
8 import 'dart:mirrors'; | 8 import 'dart:mirrors'; |
9 | 9 |
10 import 'package:_internal/libraries.dart' | 10 import 'package:_internal/libraries.dart' |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 .then(jsonify); | 63 .then(jsonify); |
64 } | 64 } |
65 | 65 |
66 jsonify(MirrorSystem mirrors) { | 66 jsonify(MirrorSystem mirrors) { |
67 var map = <String, String>{}; | 67 var map = <String, String>{}; |
68 | 68 |
69 mirrors.libraries.forEach((_, LibraryMirror library) { | 69 mirrors.libraries.forEach((_, LibraryMirror library) { |
70 BackDoor.compilationUnitsOf(library).forEach((compilationUnit) { | 70 BackDoor.compilationUnitsOf(library).forEach((compilationUnit) { |
71 Uri uri = compilationUnit.uri; | 71 Uri uri = compilationUnit.uri; |
72 String filename = relativize(sdkRoot, uri, false); | 72 String filename = relativize(sdkRoot, uri, false); |
73 SourceFile file = handler.provider.sourceFiles['$uri']; | 73 SourceFile file = handler.provider.sourceFiles[uri]; |
74 map['sdk:/$filename'] = file.slowText(); | 74 map['sdk:/$filename'] = file.slowText(); |
75 }); | 75 }); |
76 }); | 76 }); |
77 | 77 |
78 LIBRARIES.forEach((name, info) { | 78 LIBRARIES.forEach((name, info) { |
79 var patch = info.dart2jsPatchPath; | 79 var patch = info.dart2jsPatchPath; |
80 if (patch != null) { | 80 if (patch != null) { |
81 Uri uri = sdkRoot.resolve('sdk/lib/$patch'); | 81 Uri uri = sdkRoot.resolve('sdk/lib/$patch'); |
82 String filename = relativize(sdkRoot, uri, false); | 82 String filename = relativize(sdkRoot, uri, false); |
83 SourceFile file = handler.provider.sourceFiles['$uri']; | 83 SourceFile file = handler.provider.sourceFiles[uri]; |
84 map['sdk:/$filename'] = file.slowText(); | 84 map['sdk:/$filename'] = file.slowText(); |
85 } | 85 } |
86 }); | 86 }); |
87 | 87 |
88 if (outputJson) { | 88 if (outputJson) { |
89 output.writeStringSync(JSON.encode(map)); | 89 output.writeStringSync(JSON.encode(map)); |
90 } else { | 90 } else { |
91 output.writeStringSync(''' | 91 output.writeStringSync(''' |
92 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 92 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
93 // for details. All rights reserved. Use of this source code is governed by a | 93 // for details. All rights reserved. Use of this source code is governed by a |
94 // BSD-style license that can be found in the LICENSE file. | 94 // BSD-style license that can be found in the LICENSE file. |
95 | 95 |
96 // DO NOT EDIT. | 96 // DO NOT EDIT. |
97 // This file is generated by jsonify.dart. | 97 // This file is generated by jsonify.dart. |
98 | 98 |
99 library dart.sdk_sources; | 99 library dart.sdk_sources; |
100 | 100 |
101 const Map<String, String> SDK_SOURCES = const <String, String>'''); | 101 const Map<String, String> SDK_SOURCES = const <String, String>'''); |
102 output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$')); | 102 output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$')); |
103 output.writeStringSync(';\n'); | 103 output.writeStringSync(';\n'); |
104 } | 104 } |
105 output.closeSync(); | 105 output.closeSync(); |
106 } | 106 } |
OLD | NEW |