Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions build_runner/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.4.5

- Fix a bug handling a builder which has a `required_input` that matches it's
own output.

## 2.4.4

- Use a stable order for builders without an order defined by dependencies.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ Iterable<BuilderDefinition> findBuilderOrder(
..sort((a, b) => a.key.compareTo(b.key));
Iterable<BuilderDefinition> dependencies(BuilderDefinition parent) =>
consistentOrderBuilders.where((child) =>
_hasInputDependency(parent, child) ||
_mustRunBefore(parent, child, globalBuilderConfigs));
parent != child &&
(_hasInputDependency(parent, child) ||
_mustRunBefore(parent, child, globalBuilderConfigs)));
try {
return topologicalSort<BuilderDefinition>(
consistentOrderBuilders,
Expand Down
2 changes: 1 addition & 1 deletion build_runner/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_runner
version: 2.4.4
version: 2.4.5
description: A build system for Dart code generation and modular compilation.
repository: https://github.com/dart-lang/build/tree/master/build_runner

Expand Down
23 changes: 23 additions & 0 deletions build_runner/test/build_script_generate/builder_ordering_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,5 +185,28 @@ void main() {
{}),
throwsA(anything));
});

test('allows self cycles with `required_inputs`', () async {
final buildConfigs = parseBuildConfigs({
'a': {
'builders': {
'self_cycle': {
'builder_factories': ['createBuilder'],
'build_extensions': {
'.in': ['.out'],
'.out': ['.another']
},
'target': '',
'import': '',
'required_inputs': ['.out'],
},
}
}
});
final orderedBuilders = findBuilderOrder(
buildConfigs.values.expand((v) => v.builderDefinitions.values), {});
final orderedKeys = orderedBuilders.map((b) => b.key);
expect(orderedKeys, ['a:self_cycle']);
});
});
}