Skip to content

Commit d04bdcb

Browse files
committed
asset graph path is now based on script uri
1 parent 476fa92 commit d04bdcb

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

lib/src/util/constants.dart

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
4+
import 'dart:io';
5+
6+
import 'package:crypto/crypto.dart';
47

58
/// Relative path to the asset graph from the root package dir.
6-
const assetGraphPath = '$cacheDir/asset_graph.json';
9+
final assetGraphPath = '$cacheDir/${scriptHash}/asset_graph.json';
710

811
/// Relative path to the cache directory from the root package dir.
912
const cacheDir = '.dart_tool/build';
13+
14+
final String scriptHash = () {
15+
var hasher = new MD5();
16+
hasher.add(Platform.script.path.codeUnits);
17+
return CryptoUtils.bytesToHex(hasher.close());
18+
}();

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ dependencies:
1111
analyzer: ^0.27.1
1212
barback: ^0.15.0
1313
code_transformers: ^0.4.1
14+
crypto: 0.9.1
1415
logging: ^0.11.2
1516
glob: ^1.1.0
1617
path: ^1.1.0

0 commit comments

Comments
 (0)