Open natebosch opened 5 years ago
Ah, Jake pointed out you can pass them through with a -- --define=...
This is probably sufficient, but we should still update the docs.
@natebosch as I mentioned on the gitter build chat today, webdev serve -- --define "<builder_key>=<option>=<value>"
does not work, throwing the following exception:
[INFO] Invalid argument (define): Expected at least 2 `=` signs, should be of the format like --define "<builder_key>=<option>=<value>": "--build-mode=BuildMode.Auto"Unhandled exception:
Bad state: Unable to start build daemon.
#0 _handleDaemonStartup (package:build_daemon/client.dart:82:5)
<asynchronous suspension>
#1 BuildDaemonClient.connect (package:build_daemon/client.dart:183:11)
<asynchronous suspension>
#2 connectClient (package:webdev/src/daemon_client.dart:17:23)
#3 _startBuildDaemon (package:webdev/src/serve/dev_workflow.dart:25:18)
<asynchronous suspension>
#4 DevWorkflow.start (package:webdev/src/serve/dev_workflow.dart:171:24)
<asynchronous suspension>
#5 ServeCommand.run (package:webdev/src/command/serve_command.dart:125:27)
<asynchronous suspension>
#6 CommandRunner.runCommand (package:args/command_runner.dart:197:27)
<asynchronous suspension>
#7 _CommandRunner.runCommand (package:webdev/src/webdev_command_runner.dart:38:24)
<asynchronous suspension>
#8 CommandRunner.run.<anonymous closure> (package:args/command_runner.dart:112:25)
#9 new Future.sync (dart:async/future.dart:224:31)
#10 CommandRunner.run (package:args/command_runner.dart:112:14)
#11 run (package:webdev/src/webdev_command_runner.dart:19:56)
#12 main (file:///Users/aaronlademann/.pub-cache/hosted/pub.dartlang.org/webdev-2.3.0/bin/webdev.dart:17:22)
<asynchronous suspension>
#13 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#14 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)
However, if you use an =
instead of a space, it works: webdev serve -- --define="<builder_key>=<option>=<value>"
Note that the exception from build_runner
even says _should be of the format like --define "
This should either work the same way it does when using pub run build_runner serve --define
, or this lib should add its own format exception that spits out the correct format, IMO.
Our docs for how to debug with dart2js point to using
--define
but that doesn't work withwebdev
.For now you can workaround with
pub run build_runner serve
instead ofwebdev
but that option will go away eventually.We either need to update the docs, or support the argument.