Skip to content

Commit d2de292

Browse files
committed
Formatted files.
1 parent 8f65f41 commit d2de292

4 files changed

Lines changed: 34 additions & 33 deletions

File tree

lib/src/builders/merging_builder.dart

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ class MergingBuilder<T, S extends SyntheticInput> extends SyntheticBuilder<S> {
6060

6161
@override
6262
Map<String, List<String>> get buildExtensions => {
63-
syntheticInput.value: [outputFile]
64-
};
63+
syntheticInput.value: [outputFile],
64+
};
6565

6666
/// Writes the merged content to the stand-alone file
6767
/// specified by [outputFile].
@@ -79,18 +79,17 @@ class MergingBuilder<T, S extends SyntheticInput> extends SyntheticBuilder<S> {
7979
for (final libraryAssetId in libraryAssetIds) {
8080
if (path.equals(outputFile, libraryAssetId.path)) {
8181
throw ErrorOf<MergingBuilder>(
82-
message: 'Output file clashes with input file!',
83-
expectedState: 'Output files must not overwrite input files. '
84-
'Check the [MergingBuilder] constructor argument [outputFile].',
85-
invalidState: 'Output: $outputFile is also an input file.');
82+
message: 'Output file clashes with input file!',
83+
expectedState:
84+
'Output files must not overwrite input files. '
85+
'Check the [MergingBuilder] constructor argument [outputFile].',
86+
invalidState: 'Output: $outputFile is also an input file.',
87+
);
8688
}
8789
}
8890

8991
await buildStep.writeAsString(
90-
AssetId(
91-
buildStep.inputId.package,
92-
outputFile,
93-
),
92+
AssetId(buildStep.inputId.package, outputFile),
9493
arrangeContent(
9594
await generator.generateMergedContent(
9695
_combineStreams(buildStep, libraryAssetIds),

lib/src/builders/standalone_builder.dart

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ class StandaloneBuilder<S extends SyntheticInput> extends SyntheticBuilder<S> {
7474
/// type parameter [S].
7575
@override
7676
Map<String, List<String>> get buildExtensions => {
77-
syntheticInput.value: _resolvedOutputFiles(),
78-
};
77+
syntheticInput.value: _resolvedOutputFiles(),
78+
};
7979

8080
@override
8181
FutureOr<void> build(BuildStep buildStep) async {
@@ -90,12 +90,11 @@ class StandaloneBuilder<S extends SyntheticInput> extends SyntheticBuilder<S> {
9090

9191
// Create output file name.
9292
await buildStep.writeAsString(
93-
AssetId(
94-
buildStep.inputId.package,
95-
_outputFile(libAssetId),
93+
AssetId(buildStep.inputId.package, _outputFile(libAssetId)),
94+
arrangeContent(
95+
(await generator.generate(library, buildStep)) ?? '',
96+
generatedBy: 'Generated by ${generator.runtimeType}. ',
9697
),
97-
arrangeContent((await generator.generate(library, buildStep)) ?? '',
98-
generatedBy: 'Generated by ${generator.runtimeType}. '),
9998
);
10099
}
101100
}
@@ -113,8 +112,10 @@ class StandaloneBuilder<S extends SyntheticInput> extends SyntheticBuilder<S> {
113112
SyntheticInput.validatePath<S>(outputFiles);
114113
final resolvedInputFiles = Glob(inputFiles);
115114
final fileSystem = LocalFileSystem();
116-
for (final inputEntity
117-
in resolvedInputFiles.listFileSystemSync(fileSystem, root: root)) {
115+
for (final inputEntity in resolvedInputFiles.listFileSystemSync(
116+
fileSystem,
117+
root: root,
118+
)) {
118119
final basename = path.basenameWithoutExtension(inputEntity.path);
119120
final outputFileName = outputFiles.replaceAll(
120121
RegExp(r'\(\*\)'),
@@ -123,11 +124,13 @@ class StandaloneBuilder<S extends SyntheticInput> extends SyntheticBuilder<S> {
123124
// Check if output clashes with input files.
124125
if (path.equals(outputFileName, inputEntity.path)) {
125126
throw ErrorOf<StandaloneBuilder>(
126-
message: 'Output file clashes with input file!',
127-
expectedState: 'Output files must not overwrite input files. '
128-
'Check the [StandaloneBuilder] '
129-
'constructor argument [outputFiles].',
130-
invalidState: 'Output: $outputFileName is also an input file.');
127+
message: 'Output file clashes with input file!',
128+
expectedState:
129+
'Output files must not overwrite input files. '
130+
'Check the [StandaloneBuilder] '
131+
'constructor argument [outputFiles].',
132+
invalidState: 'Output: $outputFileName is also an input file.',
133+
);
131134
}
132135
result.add(outputFileName);
133136
}

lib/src/builders/synthetic_input.dart

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ sealed class SyntheticInput {
3939
static void validatePath<T extends SyntheticInput>(String path) {
4040
if (!SyntheticInput.isValidPath<T>(path)) {
4141
throw ErrorOf<SyntheticInput>(
42-
message: 'Invalid file path found.',
43-
expectedState: 'A path starting with \'lib\'.'
44-
'To access files outside \'lib\' change the builder '
45-
'type parameter to [PackageDir].',
46-
invalidState: 'The actual path is: $path.');
42+
message: 'Invalid file path found.',
43+
expectedState:
44+
'A path starting with \'lib\'.'
45+
'To access files outside \'lib\' change the builder '
46+
'type parameter to [PackageDir].',
47+
invalidState: 'The actual path is: $path.',
48+
);
4749
}
4850
}
4951
}

lib/src/generators/merging_generator.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ abstract class MergingGenerator<T, A> extends GeneratorForAnnotation<A> {
1616

1717
/// Generates a stream of objects of type [T]. Each value of [T] is
1818
/// calculated by calling [generateStreamItemForAnnotatedElement].
19-
Stream<T> generateStream(
20-
LibraryReader library,
21-
BuildStep buildStep,
22-
) async* {
19+
Stream<T> generateStream(LibraryReader library, BuildStep buildStep) async* {
2320
for (final annotatedElement in library.annotatedWith(typeChecker)) {
2421
yield generateStreamItemForAnnotatedElement(
2522
annotatedElement.element,

0 commit comments

Comments
 (0)