OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 6 |
7 import 'package:async_await/async_await.dart' as async_await; | 7 import 'package:async_await/async_await.dart' as async_await; |
8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
9 | 9 |
10 /// A changing string that indicates the "version" or timestamp of the compiler | 10 /// A changing string that indicates the "version" or timestamp of the compiler |
11 /// that the current sources were compiled against. | 11 /// that the current sources were compiled against. |
12 /// | 12 /// |
13 /// Increment this whenever a meaningful change in the async/await compiler | 13 /// Increment this whenever a meaningful change in the async/await compiler |
14 /// itself is landed. Bumping this will force all previously compiled files | 14 /// itself is landed. Bumping this will force all previously compiled files |
15 /// that were compiled against an older compiler to be recompiled. | 15 /// that were compiled against an older compiler to be recompiled. |
16 const COMPILER_VERSION = "1"; | 16 const COMPILER_VERSION = "2"; |
17 | 17 |
18 /// The path to pub's root directory (sdk/lib/_internal/pub) in the Dart repo. | 18 /// The path to pub's root directory (sdk/lib/_internal/pub) in the Dart repo. |
19 /// | 19 /// |
20 /// This assumes this script is itself being run from within the repo. | 20 /// This assumes this script is itself being run from within the repo. |
21 final sourceDir = p.dirname(p.dirname(p.fromUri(Platform.script))); | 21 final sourceDir = p.dirname(p.dirname(p.fromUri(Platform.script))); |
22 | 22 |
23 /// The [sourceDir] as a URL, for use in import strings. | 23 /// The [sourceDir] as a URL, for use in import strings. |
24 final sourceUrl = p.toUri(sourceDir).toString(); | 24 final sourceUrl = p.toUri(sourceDir).toString(); |
25 | 25 |
26 /// The directory that compiler output should be written to. | 26 /// The directory that compiler output should be written to. |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 /// Writes [contents] to [path], ignoring any IO errors that occur. | 165 /// Writes [contents] to [path], ignoring any IO errors that occur. |
166 /// | 166 /// |
167 /// This swallows errors to accommodate multiple compilers running concurrently. | 167 /// This swallows errors to accommodate multiple compilers running concurrently. |
168 /// Since they will produce the same output anyway, a failure of one is fine. | 168 /// Since they will produce the same output anyway, a failure of one is fine. |
169 void _writeFile(String path, String contents) { | 169 void _writeFile(String path, String contents) { |
170 try { | 170 try { |
171 new File(path).writeAsStringSync(contents); | 171 new File(path).writeAsStringSync(contents); |
172 } on IOException catch (ex) { | 172 } on IOException catch (ex) { |
173 // Do nothing. | 173 // Do nothing. |
174 } | 174 } |
175 } | 175 } |
OLD | NEW |