Skip to content

fix: change builder name to flutter_gen_runner (#589) #592

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 3 commits into from
Oct 20, 2024
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ You can also configure generate options in the `build.yaml`, it will be read bef
targets:
$default:
builders:
flutter_gen:
flutter_gen_runner: # or flutter_gen
options:
output: lib/build_gen/ # Optional (default: lib/gen/)
line_length: 120 # Optional (default: 80)
Expand Down
4 changes: 2 additions & 2 deletions packages/command/test/flutter_gen_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ void main() {
);
expect(
await process.stdout.next,
equals('$flutterGenVersion Loading ... command${separator}pubspec.yaml'),
equals('$flutterGenVersion Loading ...'),
);
await process.shouldExit(0);
});
Expand All @@ -26,7 +26,7 @@ void main() {
);
expect(
await process.stdout.next,
equals('$flutterGenVersion Loading ... command${separator}pubspec.yaml'),
equals('$flutterGenVersion Loading ...'),
);
await process.shouldExit(0);
});
Expand Down
8 changes: 4 additions & 4 deletions packages/core/lib/settings/config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ Config loadPubspecConfig(File pubspecFile, {File? buildFile}) {
if (buildFile != null && buildFile.existsSync()) {
final buildContent = buildFile.readAsStringSync();
final rawMap = loadYaml(buildContent) as Map?;
final optionBuildMap = rawMap?['targets']?[r'$default']?['builders']
?['flutter_gen']?['options'];

if (optionBuildMap != null) {
final builders = rawMap?['targets']?[r'$default']?['builders'];
final optionBuildMap = (builders?['flutter_gen_runner'] ??
builders?['flutter_gen'])?['options'];
if (optionBuildMap is YamlMap) {
final buildMap = {'flutter_gen': optionBuildMap};
mergedMap = mergeMap([mergedMap, buildMap]);
final buildLocaleHint = normalize(
Expand Down
12 changes: 12 additions & 0 deletions packages/core/test/assets_gen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,18 @@ void main() {
await expectedAssetsGen(pubspec, generated, fact, build: build);
},
);

test(
'Assets on pubspec_assets.yaml and override with build_runner_assets.yaml ',
() async {
const pubspec = 'test_resources/pubspec_assets.yaml';
const build = 'test_resources/build_runnfer_assets.yaml';
const fact = 'test_resources/actual_data/build_assets.gen.dart';
const generated = 'test_resources/lib/build_gen/assets.gen.dart';

await expectedAssetsGen(pubspec, generated, fact, build: build);
},
);
});

group('Test generatePackageNameForConfig', () {
Expand Down
9 changes: 9 additions & 0 deletions packages/core/test_resources/build_runner_assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: test

targets:
$default:
builders:
flutter_gen_runner:
options:
output: lib/build_gen/
line_length: 120
Loading