OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library source.caching_pub_package_map_provider; | |
6 | |
7 import 'dart:convert'; | 5 import 'dart:convert'; |
8 import 'dart:core'; | 6 import 'dart:core'; |
9 import 'dart:io' as io; | 7 import 'dart:io' as io; |
10 | 8 |
11 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
12 import 'package:analyzer/source/package_map_provider.dart'; | 10 import 'package:analyzer/source/package_map_provider.dart'; |
13 import 'package:analyzer/source/pub_package_map_provider.dart'; | 11 import 'package:analyzer/source/pub_package_map_provider.dart'; |
14 import 'package:analyzer/src/dart/sdk/sdk.dart'; | 12 import 'package:analyzer/src/dart/sdk/sdk.dart'; |
15 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
16 import 'package:analyzer/src/generated/source.dart'; | 14 import 'package:analyzer/src/generated/source.dart'; |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 // TODO(danrubel) This implementation assumes that | 249 // TODO(danrubel) This implementation assumes that |
252 // two separate processes are not accessing the cache file at the same time | 250 // two separate processes are not accessing the cache file at the same time |
253 io.File file = new io.File(cacheFile.path); | 251 io.File file = new io.File(cacheFile.path); |
254 if (!file.parent.existsSync()) { | 252 if (!file.parent.existsSync()) { |
255 file.parent.createSync(recursive: true); | 253 file.parent.createSync(recursive: true); |
256 } | 254 } |
257 file.writeAsStringSync(content, flush: true); | 255 file.writeAsStringSync(content, flush: true); |
258 return file.lastModifiedSync().millisecondsSinceEpoch; | 256 return file.lastModifiedSync().millisecondsSinceEpoch; |
259 } | 257 } |
260 } | 258 } |
OLD | NEW |