@@ -43,21 +43,23 @@ class BuildRunnerCommandLine {
4343 final BuiltList <String >? buildFilter;
4444 final String ? buildMode;
4545 final String ? config;
46+ final bool ? dartAotPerf;
4647 final BuiltList <String >? defines;
4748 final BuiltList <String >? enableExperiments;
4849 final bool ? forceAot;
4950 final bool ? forceJit;
50- final BuiltList <String >? jitVmArgs;
5151 final String ? hostname;
52+ final BuiltList <String >? jitVmArgs;
5253 final bool ? liveReload;
5354 final String ? logPerformance;
5455 final bool ? logRequests;
5556 final bool ? lowResourcesMode;
5657 final BuiltList <String >? outputs;
5758 final bool ? release;
58- final bool ? trackPerformance;
5959 final bool ? symlink;
60+ final bool ? trackPerformance;
6061 final bool ? verbose;
62+ final bool ? verboseDurations;
6163 final bool ? workspace;
6264
6365 static Future <BuildRunnerCommandLine ?> parse (Iterable <String > arguments) =>
@@ -69,21 +71,23 @@ class BuildRunnerCommandLine {
6971 buildFilter = argResults.listNamed (buildFilterOption),
7072 buildMode = argResults.stringNamed (buildModeFlag),
7173 config = argResults.stringNamed (configOption),
74+ dartAotPerf = argResults.boolNamed (dartAotPerfOption),
7275 defines = argResults.listNamed (defineOption),
7376 enableExperiments = argResults.listNamed (enableExperimentOption),
7477 forceAot = argResults.boolNamed (forceAotOption),
7578 forceJit = argResults.boolNamed (forceJitOption),
76- jitVmArgs = argResults.listNamed (dartJitVmArgOption),
7779 hostname = argResults.stringNamed (hostnameOption),
80+ jitVmArgs = argResults.listNamed (dartJitVmArgOption),
7881 liveReload = argResults.boolNamed (liveReloadOption),
7982 logPerformance = argResults.stringNamed (logPerformanceOption),
8083 logRequests = argResults.boolNamed (logRequestsOption),
8184 lowResourcesMode = argResults.boolNamed (lowResourcesModeOption),
8285 outputs = argResults.listNamed (outputOption),
8386 release = argResults.boolNamed (releaseOption),
84- trackPerformance = argResults.boolNamed (trackPerformanceOption),
8587 symlink = argResults.boolNamed (symlinkOption),
88+ trackPerformance = argResults.boolNamed (trackPerformanceOption),
8689 verbose = argResults.boolNamed (verboseOption),
90+ verboseDurations = argResults.boolNamed (verboseDurationsOption),
8791 // Only "build" and "watch" support --workspace, default to false for
8892 // other commands.
8993 workspace = argResults.boolNamed (workspaceOption) ?? false ;
@@ -133,6 +137,7 @@ const deleteFilesByDefaultOption = 'delete-conflicting-outputs';
133137const enableExperimentOption = 'enable-experiment' ;
134138const forceAotOption = 'force-aot' ;
135139const forceJitOption = 'force-jit' ;
140+ const dartAotPerfOption = 'dart-aot-perf' ;
136141const dartJitVmArgOption = 'dart-jit-vm-arg' ;
137142const hostnameOption = 'hostname' ;
138143const liveReloadOption = 'live-reload' ;
@@ -141,8 +146,9 @@ const logRequestsOption = 'log-requests';
141146const lowResourcesModeOption = 'low-resources-mode' ;
142147const outputOption = 'output' ;
143148const releaseOption = 'release' ;
144- const trackPerformanceOption = 'track-performance' ;
145149const symlinkOption = 'symlink' ;
150+ const trackPerformanceOption = 'track-performance' ;
151+ const verboseDurationsOption = 'verbose-durations' ;
146152const verboseOption = 'verbose' ;
147153const workspaceOption = 'workspace' ;
148154
@@ -153,10 +159,7 @@ class _CommandRunner extends CommandRunner<BuildRunnerCommandLine> {
153159 : super (
154160 'build_runner' ,
155161 'Dart build tool.' ,
156- usageLineLength:
157- buildProcessState.stdio.hasTerminal
158- ? buildProcessState.stdio.terminalColumns
159- : 80 ,
162+ usageLineLength: buildProcessState.stdio.terminalColumns,
160163 ) {
161164 addCommand (_build);
162165 addCommand (_clean);
@@ -170,7 +173,15 @@ class _CommandRunner extends CommandRunner<BuildRunnerCommandLine> {
170173
171174final _build = _Build ();
172175
173- class _Build extends Command <BuildRunnerCommandLine > {
176+ /// [Command] with `ArgParser.usageLineLength` set.
177+ abstract class _Command <T > extends Command <T > {
178+ @override
179+ final ArgParser argParser = ArgParser (
180+ usageLineLength: buildProcessState.stdio.terminalColumns,
181+ );
182+ }
183+
184+ class _Build extends _Command <BuildRunnerCommandLine > {
174185 _Build () {
175186 addBuildArgs (argParser, symlinksDefault: false , supportWorkspace: true );
176187 }
@@ -228,6 +239,11 @@ class _Build extends Command<BuildRunnerCommandLine> {
228239 negatable: true ,
229240 defaultsTo: false ,
230241 )
242+ ..addFlag (
243+ verboseDurationsOption,
244+ negatable: false ,
245+ help: 'Logs durations with greater precision.' ,
246+ )
231247 ..addOption (
232248 logPerformanceOption,
233249 help:
@@ -272,7 +288,7 @@ class _Build extends Command<BuildRunnerCommandLine> {
272288 help:
273289 'An explicit filter of files to build. Relative paths and '
274290 '`package:` uris are supported, including glob syntax for paths '
275- 'portions (but not package names).\n\n '
291+ 'portions (but not package names). '
276292 'If multiple filters are applied then outputs matching any '
277293 'filter will be built (they do not need to match all filters).' ,
278294 )
@@ -284,16 +300,24 @@ class _Build extends Command<BuildRunnerCommandLine> {
284300 dartJitVmArgOption,
285301 help:
286302 'Flags to pass to `dart run` when launching the inner build '
287- 'script\n . '
303+ 'script. '
288304 'For example, `--dart-jit-vm-arg "--observe" '
289305 '--dart-jit-vm-arg "--pause-isolates-on-start"` would start the '
290306 'build script with a debugger attached to it.' ,
291307 );
308+ if (Platform .isLinux) {
309+ argParser.addFlag (
310+ dartAotPerfOption,
311+ negatable: false ,
312+ help: 'Run AOT-compiled builders under the `perf` profiling tool.' ,
313+ );
314+ }
315+
292316 if (supportWorkspace) {
293317 argParser.addFlag (
294318 workspaceOption,
295319 defaultsTo: false ,
296- negatable: true ,
320+ negatable: false ,
297321 help: 'Build all packages in the current workspace.' ,
298322 );
299323 }
@@ -315,7 +339,7 @@ class _Build extends Command<BuildRunnerCommandLine> {
315339
316340final _clean = _Clean ();
317341
318- class _Clean extends Command <BuildRunnerCommandLine > {
342+ class _Clean extends _Command <BuildRunnerCommandLine > {
319343 @override
320344 String get name => 'clean' ;
321345
@@ -330,7 +354,7 @@ class _Clean extends Command<BuildRunnerCommandLine> {
330354
331355final _daemon = _Daemon ();
332356
333- class _Daemon extends Command <BuildRunnerCommandLine > {
357+ class _Daemon extends _Command <BuildRunnerCommandLine > {
334358 @override
335359 String get description => 'Starts the build daemon.' ;
336360
@@ -367,7 +391,7 @@ class _Daemon extends Command<BuildRunnerCommandLine> {
367391
368392final _run = _Run ();
369393
370- class _Run extends Command <BuildRunnerCommandLine > {
394+ class _Run extends _Command <BuildRunnerCommandLine > {
371395 _Run () {
372396 _Build .addBuildArgs (
373397 argParser,
@@ -394,7 +418,7 @@ class _Run extends Command<BuildRunnerCommandLine> {
394418
395419final _serve = _Serve ();
396420
397- class _Serve extends Command <BuildRunnerCommandLine > {
421+ class _Serve extends _Command <BuildRunnerCommandLine > {
398422 _Serve () {
399423 _Build .addBuildArgs (
400424 argParser,
@@ -438,7 +462,7 @@ class _Serve extends Command<BuildRunnerCommandLine> {
438462
439463final _test = _Test ();
440464
441- class _Test extends Command <BuildRunnerCommandLine > {
465+ class _Test extends _Command <BuildRunnerCommandLine > {
442466 _Test () {
443467 _Build .addBuildArgs (
444468 argParser,
@@ -465,7 +489,7 @@ class _Test extends Command<BuildRunnerCommandLine> {
465489
466490final _watch = _Watch ();
467491
468- class _Watch extends Command <BuildRunnerCommandLine > {
492+ class _Watch extends _Command <BuildRunnerCommandLine > {
469493 _Watch () {
470494 _Build .addBuildArgs (
471495 argParser,
0 commit comments