Skip to content

Commit a345313

Browse files
committed
Progress.
1 parent a8445fe commit a345313

File tree

15 files changed

+170
-137
lines changed

15 files changed

+170
-137
lines changed

build_resolvers/lib/src/analysis_driver_model.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,9 @@ class AnalysisDriverModel {
122122
idsToSyncOntoFilesystem = await _log.attributeAsync(
123123
Attribution.track,
124124
() async {
125-
// Note: `transitiveDepsOf` can cause loads that cause builds that cause a
126-
// recursive `_performResolve` on this same `AnalysisDriver` instance.
125+
// Note: `transitiveDepsOf` can cause loads that cause builds that
126+
// cause a recursive `_performResolve` on this same `AnalysisDriver`
127+
// instance.
127128
final nodeLoader = AssetDepsLoader(buildStep.phasedReader);
128129
buildStep.inputTracker.addResolverEntrypoint(entrypoint);
129130
return await _graphLoader.transitiveDepsOf(nodeLoader, entrypoint);

build_runner/lib/src/build_script_generate/bootstrap.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,12 @@ Future<int> _generateAndRun(
117117
} on IsolateSpawnException catch (e) {
118118
if (tryCount > 1) {
119119
_log.severe(
120-
'Failed to spawn build script after retry. '
121-
'This is likely due to a misconfigured builder definition. '
122-
'See the generated script at $scriptLocation to find errors.',
123-
e,
120+
_log.renderThrowable(
121+
'Failed to spawn build script after retry. '
122+
'This is likely due to a misconfigured builder definition. '
123+
'See the generated script at $scriptLocation to find errors.',
124+
e,
125+
),
124126
);
125127
messagePort.sendPort.send(ExitCode.config.code);
126128
exitPort.sendPort.send(null);

build_runner/lib/src/entrypoint/doctor.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ class DoctorCommand extends BuildRunnerCommand {
7171
} on ArgumentError // ignore: avoid_catching_errors
7272
catch (e) {
7373
_log.severe(
74-
'Failed to parse a `build.yaml` file for ${package.name}',
75-
e,
74+
'Failed to parse a `build.yaml` file for ${package.name}:'
75+
' ${e.message}',
7676
);
7777
return BuildConfig.useDefault(
7878
package.name,

build_runner/lib/src/entrypoint/run_script.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ class RunCommand extends BuildRunnerCommand {
177177
onExit?.close();
178178
onError?.close();
179179
_log.severe(
180-
'Unhandled error from script: $scriptName',
181-
e[0],
182-
StackTrace.fromString(e[1].toString()),
180+
_log.renderThrowable(
181+
'Unhandled error from script: $scriptName',
182+
e[0],
183+
StackTrace.fromString(e[1].toString()),
184+
),
183185
);
184186
if (!exitCodeCompleter.isCompleted) exitCodeCompleter.complete(1);
185187
});
@@ -197,9 +199,11 @@ class RunCommand extends BuildRunnerCommand {
197199
return await exitCodeCompleter.future;
198200
} on IsolateSpawnException catch (e) {
199201
_log.severe(
200-
'Could not spawn isolate. Ensure that your file is in a valid '
201-
'directory (i.e. "bin", "benchmark", "example", "test", "tool").',
202-
e,
202+
_log.renderThrowable(
203+
'Could not spawn isolate. Ensure that your file is in a valid '
204+
'directory (i.e. "bin", "benchmark", "example", "test", "tool").',
205+
e,
206+
),
203207
);
204208
return ExitCode.ioError.code;
205209
} finally {

build_runner/lib/src/server/server.dart

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,12 @@ class AssetHandler {
423423
headers[HttpHeaders.contentLengthHeader] = '${body.length}';
424424
}
425425
return shelf.Response.ok(body, headers: headers);
426-
} catch (e, s) {
426+
} catch (e) {
427427
_log.info(
428-
'Error on request ${request.method} ${request.requestedUri}',
429-
e,
430-
s,
428+
_log.renderThrowable(
429+
'Error on request ${request.method} ${request.requestedUri}',
430+
e,
431+
),
431432
);
432433
rethrow;
433434
}
@@ -757,7 +758,7 @@ shelf.Handler _logRequests(shelf.Handler innerHandler) {
757758
request.method,
758759
watch.elapsed,
759760
);
760-
_log.severe(msg, error, stackTrace);
761+
_log.severe(_log.renderThrowable(msg, error, stackTrace));
761762
rethrow;
762763
}
763764
};

build_runner/lib/src/watcher/graph_watcher.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ class PackageGraphWatcher {
5656
StackTrace s,
5757
) {
5858
_log.severe(
59-
'Error from directory watcher for package:${w.node.name}\n\n'
60-
'If you see this consistently then it is recommended that '
61-
'you enable the polling file watcher with '
62-
'--use-polling-watcher.\n\n',
63-
e,
64-
s,
59+
_log.renderThrowable(
60+
'Error from directory watcher for '
61+
'package:${w.node.name}\n\n'
62+
'If you see this consistently then it is recommended that '
63+
'you enable the polling file watcher with '
64+
'--use-polling-watcher.\n\n',
65+
e,
66+
),
6567
);
6668
}),
6769
)

build_runner_core/lib/src/asset/reader_writer.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ class ReaderWriter extends AssetReader
186186
final path = _pathFor(id);
187187
// Hidden generated files are moved by `assetPathProvider` under the root
188188
// package folder, and it's allowed to delete them. So for assets in a
189-
// different package, check if the path has mapped onto the generated output
190-
// path, and if so allow the deleted.
189+
// different package, check if the path has mapped onto the generated
190+
// output path, and if so allow the deleted.
191191
var generatedOutputPath = assetPathProvider.pathFor(
192192
AssetId(rootPackage, generatedOutputDirectory),
193193
);

build_runner_core/lib/src/asset_graph/graph_loader.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ class AssetGraphLoader {
6161
'Throwing away cached asset graph due to '
6262
'version mismatch or corrupted asset graph.',
6363
);
64-
await Future.wait([
65-
writer.deleteDirectory(_generatedOutputDirectoryId),
66-
]);
64+
await Future.wait([writer.deleteDirectory(_generatedOutputDirectoryId)]);
6765
return null;
6866
}
6967
}

build_runner_core/lib/src/generate/build.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class Build {
276276
},
277277
(e, st) {
278278
if (!done.isCompleted) {
279-
_log.severe('Unhandled build failure! $e $st', e, st);
279+
_log.severe(_log.renderThrowable('Unhandled build failure!', e, st));
280280
done.complete(BuildResult(BuildStatus.failure, []));
281281
}
282282
},

build_runner_core/lib/src/generate/build_definition.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ class _Loader {
137137
_options.packageGraph,
138138
_environment.reader,
139139
);
140-
} on DuplicateAssetNodeException catch (e, st) {
141-
_log.severe('Conflicting outputs', e, st);
140+
} on DuplicateAssetNodeException catch (e) {
141+
_log.severe(e.toString());
142142
throw const CannotBuildException();
143143
}
144144
buildScriptUpdates = await BuildScriptUpdates.create(

build_runner_core/lib/src/generate/options.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,17 +191,13 @@ class BuildOptions {
191191
requiredSourcePaths: [r'lib/$lib$'],
192192
requiredRootSourcePaths: [r'$package$', r'lib/$lib$'],
193193
);
194-
} on BuildConfigParseException catch (e, s) {
195-
_log.severe(
196-
'''
194+
} on BuildConfigParseException catch (e) {
195+
_log.severe('''
197196
Failed to parse `build.yaml` for ${e.packageName}.
198197
199198
If you believe you have gotten this message in error, especially if using a new
200199
feature, you may need to run `dart run build_runner clean` and then rebuild.
201-
''',
202-
e.exception,
203-
s,
204-
);
200+
''');
205201
throw const CannotBuildException();
206202
}
207203

0 commit comments

Comments
 (0)