google / google/grinder.dart

How to pass arguments to dependent tasks?

Open
#391 0 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
Dart
Stars
266
Forks
36
Avg merge
23h 25m
Merged PRs (30d)
2

Description

See this `serve` task as an example, https://github.com/dart-lang/dart-pad/blob/b9a426f73c1b4dff267b7328d3c6fac964b560bd/tool/grind.dart#L28.

This depends on the `build` task, which accepts a `--debug` flag.

I want to run the `serve` task, with `--debug` set for the nested `build` task, but I can't figure out how to do it?

I tried `grind serve build --debug`, `grind serve --debug`, `grind serve --debug build --debug`, but none of those options work, they all ultimately end up with an error like this:

```
Unhandled exception:
GrinderException: Cannot run a task multiple times with different arguments
#0 Grinder._postOrder (package:grinder/src/grinder.dart:88:9)
#1 Grinder._postOrder (package:grinder/src/grinder.dart:78:7)
#2 Grinder.start (package:grinder/src/grinder.dart:168:7)
#3 runTasks (package:grinder/src/cli.dart:69:38)
#4 grind (package:grinder/grinder.dart:45:12)
#5 main (/dart-pad/tool/grind.dart:21:28)
#6 _delayEntrypointInvocation. (dart:isolate-patch/isolate_patch.dart:295:32)
#7 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
```

I did some debugging and it looks like the task is trying to run both with empty arguments and with `["--debug"]`. So I think the dependency set up by `serve` is implicitly trying to run it with no arguments, or something like that?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.