File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -34,17 +34,22 @@ class BuildCommand extends Command<int> {
3434
3535 @override
3636 Future <int > run () async {
37- if (argResults.rest.isNotEmpty) {
37+ var unsupported =
38+ argResults.rest.where ((arg) => ! arg.startsWith ('-' )).toList ();
39+ if (unsupported.isNotEmpty) {
3840 throw UsageException (
3941 'Arguments were provided that are not supported: '
40- '"${argResults . rest .join (' ' )}".' ,
42+ '"${unsupported .join (' ' )}".' ,
4143 argParser.usage);
4244 }
45+ var extraArgs =
46+ argResults.rest.where ((arg) => arg.startsWith ('-' )).toList ();
4347
4448 var configuration = Configuration .fromArgs (argResults);
4549 setVerbosity (configuration.verbose);
4650 var pubspecLock = await readPubspecLock (configuration);
47- final arguments = buildRunnerArgs (pubspecLock, configuration);
51+ final arguments = buildRunnerArgs (pubspecLock, configuration)
52+ ..addAll (extraArgs);
4853
4954 try {
5055 logHandler (Level .INFO , 'Connecting to the build daemon...' );
Original file line number Diff line number Diff line change @@ -62,6 +62,21 @@ void main() {
6262 await process.shouldExit (isNot (0 ));
6363 });
6464
65+ test ('build should allow passing extra arguments to build_runner' , () async {
66+ var args = [
67+ 'build' ,
68+ '-o' ,
69+ 'web:${d .sandbox }' ,
70+ '--' ,
71+ '--delete-conflicting-outputs'
72+ ];
73+
74+ var process = await runWebDev (args, workingDirectory: exampleDirectory);
75+
76+ await checkProcessStdout (process, ['Succeeded' ]);
77+ await process.shouldExit (0 );
78+ });
79+
6580 group ('should build with valid configuration' , () {
6681 for (var withDDC in [true , false ]) {
6782 test (withDDC ? 'DDC' : 'dart2js' , () async {
You can’t perform that action at this time.
0 commit comments