Skip to content

Commit e2e0bcd

Browse files
committed
move .build to .dart_tool/build
1 parent 027ce92 commit e2e0bcd

File tree

7 files changed

+26
-21
lines changed

7 files changed

+26
-21
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ build/
44
.pub/
55
pubspec.lock
66

7-
# Files generated by build runs
8-
.build
7+
# Files generated by dart tools
8+
.dart_tool
99

1010
# Generated by tool/create_all_test.dart
1111
tool/test_all.dart

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,9 @@ Outputs from previous builds will not be treated as inputs to later ones.
103103

104104
### Source control
105105

106-
This package creates a top level `.build` folder in your package, which should
107-
not be submitted to your source control repo (likely this just means adding
108-
'.build' to your '.gitignore' file).
106+
This package creates a top level `.dart_tool` folder in your package, which
107+
should not be submitted to your source control repo (likely this just means
108+
adding '.dart_tool' to your '.gitignore' file).
109109

110110
When it comes to generated files it is generally best to not submit them to
111111
source control, but a specific `Builder` may provide a recommendation otherwise.

lib/src/generate/build_impl.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class BuildImpl {
168168

169169
/// Asset containing previous asset dependency graph.
170170
AssetId get _assetGraphId =>
171-
new AssetId(_packageGraph.root.name, '.build/asset_graph.json');
171+
new AssetId(_packageGraph.root.name, '.dart_tool/build/asset_graph.json');
172172

173173
/// Reads in the [assetGraph] from disk.
174174
Future<AssetGraph> _readAssetGraph() async {
@@ -359,9 +359,9 @@ class BuildImpl {
359359
if (conflictingOutputs.isEmpty) return;
360360

361361
stdout.writeln('\n\nFound ${conflictingOutputs.length} declared outputs '
362-
'which already exist on disk. This is likely because the `.build` '
363-
'folder was deleted, or you are submitting generated files to your '
364-
'source repository.');
362+
'which already exist on disk. This is likely because the'
363+
'`.dart_tool/build` folder was deleted, or you are submitting generated '
364+
'files to your source repository.');
365365
var done = false;
366366
while (!done) {
367367
stdout.write('\nDelete these files (y/n) (or list them (l))?: ');

lib/src/generate/watch_impl.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ class WatchImpl {
228228

229229
/// Checks if we should skip a watch event for this [id].
230230
bool _shouldSkipInput(AssetId id, ChangeType type) {
231-
if (id.path.contains('.build/')) return true;
231+
if (id.path.contains('.dart_tool/build/')) return true;
232232
var node = _assetGraph.get(id);
233233
return node is GeneratedAssetNode && type != ChangeType.REMOVE;
234234
}

test/common/common.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export 'matchers.dart';
2424
export 'stub_reader.dart';
2525
export 'stub_writer.dart';
2626

27+
final String assetGraphPath = '.dart_tool/build/asset_graph.json';
28+
2729
Future wait(int milliseconds) =>
2830
new Future.delayed(new Duration(milliseconds: milliseconds));
2931

test/generate/build_test.dart

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ main() {
140140
{
141141
'a|lib/a.txt': 'a',
142142
'a|lib/a.txt.copy': 'a',
143-
'a|.build/asset_graph.json': JSON.encode(emptyGraph.serialize()),
143+
'a|$assetGraphPath':
144+
JSON.encode(emptyGraph.serialize()),
144145
},
145146
status: BuildStatus.Failure,
146147
exceptionMatcher: invalidOutputException);
@@ -153,7 +154,7 @@ main() {
153154
outputs: {'a|web/a.txt.copy': 'a', 'a|lib/b.txt.copy': 'b'},
154155
writer: writer);
155156

156-
var graphId = makeAssetId('a|.build/asset_graph.json');
157+
var graphId = makeAssetId('a|$assetGraphPath');
157158
expect(writer.assets, contains(graphId));
158159
var cachedGraph =
159160
new AssetGraph.deserialize(JSON.decode(writer.assets[graphId].value));
@@ -194,7 +195,7 @@ main() {
194195
await testPhases(copyAPhaseGroup, inputs, outputs: outputs, writer: writer);
195196

196197
// Delete the `asset_graph.json` file!
197-
var outputId = makeAssetId('a|.build/asset_graph.json');
198+
var outputId = makeAssetId('a|$assetGraphPath');
198199
await writer.delete(outputId);
199200

200201
// Second run, should have no extra outputs.
@@ -223,7 +224,7 @@ main() {
223224
'a|web/a.txt': 'a',
224225
'a|lib/b.txt.copy': 'b',
225226
'a|lib/c.txt': 'c',
226-
'a|.build/asset_graph.json': JSON.encode(graph.serialize()),
227+
'a|$assetGraphPath': JSON.encode(graph.serialize()),
227228
}, outputs: {
228229
'a|web/a.txt.copy': 'a',
229230
'a|lib/c.txt.copy': 'c',
@@ -268,7 +269,8 @@ main() {
268269
'a|lib/a.txt.copy.clone': 'a',
269270
'a|lib/b.txt.copy': 'b',
270271
'a|lib/b.txt.copy.clone': 'b',
271-
'a|.build/asset_graph.json': JSON.encode(graph.serialize()),
272+
'a|$assetGraphPath':
273+
JSON.encode(graph.serialize()),
272274
},
273275
outputs: {'a|lib/a.txt.copy': 'b', 'a|lib/a.txt.copy.clone': 'b',},
274276
writer: writer);
@@ -297,14 +299,15 @@ main() {
297299
{
298300
'a|lib/a.txt.copy': 'a',
299301
'a|lib/a.txt.copy.clone': 'a',
300-
'a|.build/asset_graph.json': JSON.encode(graph.serialize()),
302+
'a|$assetGraphPath':
303+
JSON.encode(graph.serialize()),
301304
},
302305
outputs: {},
303306
writer: writer);
304307

305308
/// Should be deleted using the writer, and removed from the new graph.
306-
var newGraph = new AssetGraph.deserialize(JSON.decode(
307-
writer.assets[makeAssetId('a|.build/asset_graph.json')].value));
309+
var newGraph = new AssetGraph.deserialize(JSON.decode(writer
310+
.assets[makeAssetId('a|$assetGraphPath')].value));
308311
expect(newGraph.contains(aNode.id), isFalse);
309312
expect(newGraph.contains(aCopyNode.id), isFalse);
310313
expect(newGraph.contains(aCloneNode.id), isFalse);
@@ -331,7 +334,7 @@ main() {
331334
await testPhases(copyAPhaseGroup, {
332335
'a|web/a.txt': 'a',
333336
'a|web/a.txt.copy': 'a',
334-
'a|.build/asset_graph.json': JSON.encode(graph.serialize()),
337+
'a|$assetGraphPath': JSON.encode(graph.serialize()),
335338
}, outputs: {
336339
'a|web/a.txt.copy': 'a',
337340
});

test/generate/watch_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ main() {
114114
result = await nextResult(results);
115115
checkOutputs({'a|web/c.txt.copy': 'c'}, result, writer.assets);
116116

117-
var cachedGraph = new AssetGraph.deserialize(JSON.decode(
118-
writer.assets[makeAssetId('a|.build/asset_graph.json')].value));
117+
var cachedGraph = new AssetGraph.deserialize(JSON.decode(writer
118+
.assets[makeAssetId('a|$assetGraphPath')].value));
119119

120120
var expectedGraph = new AssetGraph();
121121
var bCopyNode = makeAssetNode('a|web/b.txt.copy');

0 commit comments

Comments
 (0)