Skip to content

Commit bc03328

Browse files
committed
remove trackAsDependency and addDependency apis
1 parent f5cfda9 commit bc03328

File tree

3 files changed

+6
-53
lines changed

3 files changed

+6
-53
lines changed

lib/src/builder/build_step.dart

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,12 @@ abstract class BuildStep {
1414
Asset get input;
1515

1616
/// Checks if an [Asset] by [id] exists as an input for this [BuildStep].
17-
///
18-
/// If [trackAsDependency] is true, then [id] will be marked as a dependency
19-
/// of all [expectedOutputs].
20-
Future<bool> hasInput(AssetId id, {bool trackAsDependency: true});
17+
Future<bool> hasInput(AssetId id);
2118

2219
/// Reads an [Asset] by [id] as a [String] using [encoding].
23-
///
24-
/// If [trackAsDependency] is true, then [id] will be marked as a dependency
25-
/// of all [expectedOutputs].
26-
Future<String> readAsString(AssetId id,
27-
{Encoding encoding: UTF8, bool trackAsDependency: true});
20+
Future<String> readAsString(AssetId id, {Encoding encoding: UTF8});
2821

2922
/// Outputs an [Asset] using the current [AssetWriter], and adds [asset] to
3023
/// [outputs].
3124
void writeAsString(Asset asset, {Encoding encoding: UTF8});
32-
33-
/// Explicitly adds [id] as a dependency of all [expectedOutputs]. This is
34-
/// not generally necessary unless forcing `trackAsDependency: false` when
35-
/// calling [readAsString].
36-
void addDependency(AssetId id);
3725
}

lib/src/builder/build_step_impl.dart

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,15 @@ class BuildStepImpl implements BuildStep {
5050
}
5151

5252
/// Checks if an [Asset] by [id] exists as an input for this [BuildStep].
53-
///
54-
/// If [trackAsDependency] is true, then [id] will be marked as a dependency
55-
/// of all [expectedOutputs].
56-
Future<bool> hasInput(AssetId id, {bool trackAsDependency: true}) {
57-
if (trackAsDependency) _dependencies.add(id);
53+
Future<bool> hasInput(AssetId id) {
54+
_dependencies.add(id);
5855
return _reader.hasInput(id);
5956
}
6057

6158
/// Reads an [Asset] by [id] as a [String] using [encoding].
62-
///
63-
/// If [trackAsDependency] is true, then [id] will be marked as a dependency
64-
/// of all [expectedOutputs].
6559
@override
66-
Future<String> readAsString(AssetId id,
67-
{Encoding encoding: UTF8, bool trackAsDependency: true}) {
68-
if (trackAsDependency) _dependencies.add(id);
60+
Future<String> readAsString(AssetId id, {Encoding encoding: UTF8}) {
61+
_dependencies.add(id);
6962
return _reader.readAsString(id, encoding: encoding);
7063
}
7164

@@ -83,12 +76,4 @@ class BuildStepImpl implements BuildStep {
8376
var done = _writer.writeAsString(asset, encoding: encoding);
8477
_outputsCompleted = _outputsCompleted.then((_) => done);
8578
}
86-
87-
/// Explicitly adds [id] as a dependency of all [expectedOutputs]. This is
88-
/// not generally necessary unless forcing `trackAsDependency: false` when
89-
/// calling [readAsString].
90-
@override
91-
void addDependency(AssetId id) {
92-
_dependencies.add(id);
93-
}
9479
}

test/builder/build_step_impl_test.dart

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ main() {
3535
var a2 = makeAssetId();
3636
await buildStep.readAsString(a2);
3737
expect(buildStep.dependencies, [primary.id, a1, a2]);
38-
39-
var a3 = makeAssetId();
40-
await buildStep.readAsString(a3, trackAsDependency: false);
41-
expect(buildStep.dependencies.contains(a3), isFalse);
4238
});
4339

4440
test('tracks dependencies on hasInput', () async {
@@ -51,22 +47,6 @@ main() {
5147
var a2 = makeAssetId();
5248
await buildStep.hasInput(a2);
5349
expect(buildStep.dependencies, [primary.id, a1, a2]);
54-
55-
var a3 = makeAssetId();
56-
await buildStep.hasInput(a3, trackAsDependency: false);
57-
expect(buildStep.dependencies.contains(a3), isFalse);
58-
});
59-
60-
test('addDependency adds dependencies', () {
61-
expect(buildStep.dependencies, [primary.id]);
62-
63-
var a1 = makeAssetId();
64-
buildStep.addDependency(a1);
65-
expect(buildStep.dependencies, [primary.id, a1]);
66-
67-
var a2 = makeAssetId();
68-
buildStep.addDependency(a2);
69-
expect(buildStep.dependencies, [primary.id, a1, a2]);
7050
});
7151

7252
test('tracks outputs', () async {

0 commit comments

Comments
 (0)