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
4 changes: 1 addition & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
DART_VERSION="${{ steps.setup-dart.outputs.dart-version }}"
if [[ "$DART_VERSION" =~ ^3 ]]; then
./tool/delete_dart_2_only_files.sh
./tool/update_tests_for_dart_3.sh
# Stage these changes so they don't show up in the generated file `git diff` check below
git add .
fi
Expand Down Expand Up @@ -146,7 +145,6 @@ jobs:
DART_VERSION="${{ steps.setup-dart.outputs.dart-version }}"
if [[ "$DART_VERSION" =~ ^3 ]]; then
./tool/delete_dart_2_only_files.sh
./tool/update_tests_for_dart_3.sh
fi

- name: Analyze package source
Expand Down Expand Up @@ -196,7 +194,7 @@ jobs:
run: |
DART_VERSION="${{ steps.setup-dart.outputs.dart-version }}"
if [[ "$DART_VERSION" =~ ^3 ]]; then
(cd ../.. && ./tool/delete_dart_2_only_files.sh && ./tool/update_tests_for_dart_3.sh)
(cd ../.. && ./tool/delete_dart_2_only_files.sh)
fi

- name: Validate dependencies
Expand Down
273 changes: 126 additions & 147 deletions test/vm_tests/builder/over_react_builder_test.dart

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions test_fixtures/gold_output_files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,3 @@ To re-generate the gold files in this directory using the over_react builder, ru
```sh
dart tool/update_gold_output_files.dart
```

If that deletes other generated files throughout over_react (which usually only happens after it prompts you about conflicting outputs), you can restore them by running a build:
```sh
dart run build_runner build
```
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic_library.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'props_mixin.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

mixin $ExamplePropsMixinClass implements ExamplePropsMixinClass {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'state_mixin.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

mixin $ExampleStateMixinClass implements ExampleStateMixinClass {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic_library.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic_library.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'library.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'props_mixin.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

@deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'state_mixin.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

@deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic_library.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'basic_two_nine.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'library.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'props_mixin.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

@Deprecated('This API is for use only within generated code.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'state_mixin.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

@Deprecated('This API is for use only within generated code.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'two_nine_with_multiple_factories.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

// React component factory implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ part of 'type_parameters.dart';

// **************************************************************************
// OverReactBuilder (package:over_react/src/builder.dart)
//
// Using nullSafety: false. {languageVersion: 2.11, source: libraryVersionComment}
// **************************************************************************

@Deprecated('This API is for use only within generated code.'
Expand Down
Empty file.
9 changes: 9 additions & 0 deletions test_fixtures/test_packages/builder/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: over_react__test__builder_tests
publish_to: none
environment:
sdk: ">=2.19.0 <4.0.0"
dependencies:
over_react:
path: ../../../
dev_dependencies:
build_runner: any
53 changes: 20 additions & 33 deletions tool/update_gold_output_files.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,43 @@ import 'dart:io';
import 'package:glob/glob.dart';
import 'package:glob/list_local_fs.dart';
import 'package:path/path.dart' as p;
import 'package:yaml/yaml.dart';

final sourceFixturesDir = Directory('test_fixtures/source_files');
final sourceFixtureDir = Directory('test_fixtures/test_packages/builder');
final goldsDir = Directory('test_fixtures/gold_output_files');

/// A temporary directory used to generate new golds.
final tmpSourceDir = Directory('test/tmp_test_files');

/// Updates gold files in [goldsDir] by re-generating them from a copy of the files in [sourceFixturesDir].
/// Updates gold files in [goldsDir] by re-generating them from a copy of the files in [sourceFixtureDir].
Future<void> main() async {
print('Copying files from ${sourceFixturesDir.path} to temporary directory ${tmpSourceDir.path}');
if (tmpSourceDir.existsSync()) tmpSourceDir.deleteSync(recursive: true);
tmpSourceDir.createSync(recursive: true);
for (final file in Glob(p.join(sourceFixturesDir.path, '**')).listSync().whereType<File>()) {
final newPath = p.join(tmpSourceDir.path, p.relative(file.path, from: sourceFixturesDir.path));
File(newPath).parent.createSync(recursive: true);
file.copySync(newPath);
}
final sourceFixturePubspec =
loadYaml(File(p.join(sourceFixtureDir.path, 'pubspec.yaml')).readAsStringSync());
final sourceFixturePackageName = sourceFixturePubspec['name'] as String;

print('Building files in temporary directory ${tmpSourceDir.path}');
final buildProcess = await Process.start(
'dart', ['run', 'build_runner', 'build', '--build-filter=${p.join(tmpSourceDir.path, '**')}'],
mode: ProcessStartMode.inheritStdio);
print('Building files in test fixture ${goldsDir.path}');
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The print message on this line says "Building files in test fixture ${goldsDir.path}", but goldsDir is the output directory for gold files, not the test fixture directory being built. This message should probably say something like "Updating gold files in ${goldsDir.path}" or refer to sourceFixtureDir instead.

Copilot uses AI. Check for mistakes.

print('Building files in ${sourceFixtureDir.path} to .dart_tool...');
final buildProcess = await Process.start('dart', ['run', 'build_runner', 'build'],
workingDirectory: sourceFixtureDir.path, mode: ProcessStartMode.inheritStdio);
// Wait for build to complete.
final buildExitCode = await buildProcess.exitCode;
if (buildExitCode != 0) {
stderr.writeln(
'^ Build failures are expected for "missing_over_react_g_part" files, and can be ignored.');
'\n^ Build failures are expected for "missing_over_react_g_part" files, and can be ignored.\n');
}

print('Copying built files to golds directory ${goldsDir.path}');
final generatedTmpFiles =
Glob(p.join(tmpSourceDir.path, '**.over_react.g.dart')).listSync().whereType<File>().toList();
if (generatedTmpFiles.isEmpty) {
throw Exception('No generated files were found in ${tmpSourceDir.path}.'
' Ensure in build.yaml the over_react builder runs on directory with build_to:source');
final outputPath = p.join(
sourceFixtureDir.path, '.dart_tool', 'build', 'generated', sourceFixturePackageName, 'lib');
late final generatedTmpFiles =
Glob(p.join(outputPath, '**.over_react.g.dart')).listSync().whereType<File>().toList();
if (!Directory(outputPath).existsSync() || generatedTmpFiles.isEmpty) {
throw Exception(
'No generated files were found in $outputPath; something is probably wrong with the paths in this script.');
}
for (final file in generatedTmpFiles) {
final newPath =
p.join(goldsDir.path, p.relative(file.path, from: tmpSourceDir.path)) + '.goldFile';
final newPath = p.join(goldsDir.path, p.relative(file.path, from: outputPath)) + '.goldFile';
File(newPath).parent.createSync(recursive: true);
file.copySync(newPath);
}

print('Cleaning up temporary directory ${tmpSourceDir.path}');
tmpSourceDir.deleteSync(recursive: true);

print('Done!');

print('\nIf non-gold generated files throughout this package got deleted'
' (which usually only happens after it prompts you about conflicting outputs),'
' you can restore them by running a build:\n\n'
' dart run build_runner build');
}
18 changes: 0 additions & 18 deletions tool/update_tests_for_dart_3.sh

This file was deleted.

45 changes: 0 additions & 45 deletions tool/update_tests_for_dart_3/build_test_3_updates.patch

This file was deleted.