Skip to content

Fix null error. #4056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2025
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
4 changes: 4 additions & 0 deletions build/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.5.3-wip

- Use `build_runner_core` 9.1.1.

## 2.5.2

- Use `build_runner_core` 9.1.0.
Expand Down
6 changes: 3 additions & 3 deletions build/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build
version: 2.5.2
version: 2.5.3-wip
description: A package for authoring build_runner compatible code generators.
repository: https://github.com/dart-lang/build/tree/master/build
resolution: workspace
Expand All @@ -10,7 +10,7 @@ environment:
dependencies:
analyzer: '>=6.9.0 <8.0.0'
async: ^2.5.0
build_runner_core: '9.1.0'
build_runner_core: '9.1.1-wip'
built_collection: ^5.1.1
built_value: ^8.9.5
convert: ^3.0.0
Expand All @@ -24,7 +24,7 @@ dependencies:
pool: ^1.5.0

dev_dependencies:
build_resolvers: '2.5.2'
build_resolvers: '2.5.3-wip'
build_test: ^3.1.0
built_value_generator: ^8.9.5
dart_flutter_team_lints: ^3.1.0
Expand Down
6 changes: 5 additions & 1 deletion build_resolvers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
## 2.5.3-wip

- Use `build_runner_core` 9.1.1.

## 2.5.2

- Simplify warnings for outdated `analyzer`.

## 2.5.1

- Use `build_runner_core` 2.5.1.
- Use `build_runner_core` 9.0.1.

## 2.5.0

Expand Down
6 changes: 3 additions & 3 deletions build_resolvers/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_resolvers
version: 2.5.2
version: 2.5.3-wip
description: Resolve Dart code in a Builder
repository: https://github.com/dart-lang/build/tree/master/build_resolvers
resolution: workspace
Expand All @@ -10,8 +10,8 @@ environment:
dependencies:
analyzer: '>=6.9.0 <8.0.0'
async: ^2.5.0
build: '2.5.2'
build_runner_core: '9.1.0'
build: '2.5.3-wip'
build_runner_core: '9.1.1-wip'
collection: ^1.17.0
convert: ^3.1.1
crypto: ^3.0.0
Expand Down
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.5.3-wip

- Bug fix: fix corner case with checked in generated output that could cause
a crash.

## 2.5.2

- Simplify warnings for outdated `analyzer`.
Expand Down
8 changes: 4 additions & 4 deletions build_runner/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_runner
version: 2.5.2
version: 2.5.3-wip
description: A build system for Dart code generation and modular compilation.
repository: https://github.com/dart-lang/build/tree/master/build_runner
resolution: workspace
Expand All @@ -16,11 +16,11 @@ dependencies:
analyzer: '>=4.4.0 <8.0.0'
args: ^2.0.0
async: ^2.5.0
build: '2.5.2'
build: '2.5.3-wip'
build_config: ">=1.1.0 <1.2.0"
build_daemon: ^4.0.0
build_resolvers: '2.5.2'
build_runner_core: '9.1.0'
build_resolvers: '2.5.3-wip'
build_runner_core: '9.1.1-wip'
code_builder: ^4.2.0
collection: ^1.15.0
crypto: ^3.0.0
Expand Down
5 changes: 5 additions & 0 deletions build_runner_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 9.1.1-wip

- Bug fix: fix corner case with checked in generated output that could cause
a crash.

## 9.1.0

- More detailed tracking of reads for the benefit of `build_test`.
Expand Down
4 changes: 3 additions & 1 deletion build_runner_core/lib/src/asset_graph/graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class AssetGraph implements GeneratedAssetHider {
);
// Pre-emptively compute digests for the nodes we know have outputs.
await graph._setDigests(
sources.where((id) => graph.get(id)!.primaryOutputs.isNotEmpty),
sources.where((id) => graph.get(id)?.primaryOutputs.isNotEmpty == true),
digestReader,
);
// Always compute digests for all internal nodes.
Expand Down Expand Up @@ -481,6 +481,8 @@ class AssetGraph implements GeneratedAssetHider {
///
/// If [placeholders] is supplied they will be added to [newSources] to create
/// the full input set.
///
/// May remove nodes if sources overlap with generated outputs.
void _addOutputsForSources(
BuildPhases buildPhases,
Set<AssetId> newSources,
Expand Down
8 changes: 4 additions & 4 deletions build_runner_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build_runner_core
version: 9.1.0
version: 9.1.1-wip
description: Core tools to organize the structure of a build and run Builders.
repository: https://github.com/dart-lang/build/tree/master/build_runner_core
resolution: workspace
Expand All @@ -15,10 +15,10 @@ platforms:
dependencies:
analyzer: '>=6.9.0 <8.0.0'
async: ^2.5.0
build: '2.5.2'
build: '2.5.3-wip'
build_config: ^1.0.0
build_resolvers: '2.5.2'
build_runner: '2.5.2'
build_resolvers: '2.5.3-wip'
build_runner: '2.5.3-wip'
built_collection: ^5.1.1
built_value: ^8.10.1
collection: ^1.15.0
Expand Down
64 changes: 53 additions & 11 deletions build_runner_core/test/invalidation/checked_in_output_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@ void main() {

setUp(() {
tester = InvalidationTester();

// Start with output source on disk.
//
// The ordering of sources matters because a different codepath in
// `graph.dart` is triggered depending on whether a source is first
// processed as an input or as a generated output of another input.
//
// So for `a` have the output come first, and for `b` the input come
// first.
tester.sources(['a.g', 'a', 'b', 'b.g']);
});

group('a <== a.g, a <== a.other', () {
setUp(() {
// Start with output source on disk.
//
// The ordering of sources matters because a different codepath in
// `graph.dart` is triggered depending on whether a source is first
// processed as an input or as a generated output of another input.
//
// So for `a` have the output come first, and for `b` the input come
// first.
tester.sources(['a.g', 'a', 'b', 'b.g']);

tester.builder(from: '', to: '.g', outputIsVisible: true)
..reads('')
..writes('.g');
Expand All @@ -37,7 +37,7 @@ void main() {
test('checked in outputs are not treated as inputs', () async {
expect(
await tester.build(),
// If outputs were treated by inputs there would be outputs created like
// If outputs were treated as inputs there would be outputs created like
// `a.g.g.other`.
Result(
written: [
Expand All @@ -52,4 +52,46 @@ void main() {
);
});
});

group('a <== a.g', () {
setUp(() {
// Start with output source on disk that the build would not actually
// write: with the output of a previous build used as input.
//
// The order matters because it affects the codepath in `graph.dart`.
tester.sources(['a.g.g', 'a.g', 'a']);

tester.builder(from: '', to: '.g', outputIsVisible: true)
..reads('')
..writes('.g');
});

test('can ignore multiple level pregenerated output', () async {
expect(await tester.build(), Result(written: ['a.g']));
});
});

group('a <== a.g <== a.g.other', () {
setUp(() {
// Start with output source on disk that the build would not actually
// write: with the output of a previous build used as input.
//
// The order matters because it affects the codepath in `graph.dart`.
tester.sources(['a.g.other.g', 'a.g.other', 'a.g', 'a']);

tester.builder(from: '', to: '.g', outputIsVisible: true)
..reads('')
..writes('.g');
tester.builder(from: '.g', to: '.g.other', outputIsVisible: true)
..reads('.g')
..writes('.g.other');
});

test(
'can ignore multiple level pregenerated output from two builders',
() async {
expect(await tester.build(), Result(written: ['a.g', 'a.g.other']));
},
);
});
}