Cannot use TaskInvocation in Depends annotation.
- Dominant language
- Dart
- Stars
- 266
- Forks
- 36
- Avg merge
- 23h 25m
- Merged PRs (30d)
- 2
Description
The [Depends documentation](https://www.dartdocs.org/documentation/grinder/0.8.1/grinder/Depends-class.html) states that a `TaskInvocation` can be used instead of a `Function` or `String` in order to pass arguments to a dependent task. However, when trying to pass an instance of `TaskInvocation` to `Depends`, dart throws an error for it not being a compile-time constant.
`error: line 11 pos 10: expression is not a valid compile-time constant @Depends(new TaskInvocation('print'))`
When I try to make a constant `TaskInvocation` dart throws an error because it isn't a const constructor.
`error: line 11 pos 39: non-const constructor 'TaskInvocation' cannot be used in const object creation @Depends(const TaskInvocation('print'))`
This is my `grind.dart` file. Am I using this correctly?
```
import 'package:grinder/grinder.dart';
void main(List args) => grind(args);
@DefaultTask()
void print() {
log(context.invocation.arguments.arguments.toString());
}
@Task()
@Depends(const TaskInvocation('print'))
void printTest() {
}
```
Contributor guide
Assessment
This issue has not been assessed yet.