New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use doc comments to define task description #103
Comments
+1! |
I'm finding the new task format a little hard to read: @Task(
depends: const ['init'],
description: 'Compile stuff.')
compile(GrinderContext context) {
context.log("Compiling stuff...");
} But, I very much like the move towards annotations in general. I think a more-easily-read format would be something like: /// Compile stuff.
@Task(depends: init)
compile(GrinderContext context) {
context.log("Compiling stuff...");
}
or
/// Compile stuff.
@task
@depends(init)
compile(GrinderContext context) {
context.log("Compiling stuff...");
} But those re-worked formats require us having the ability to pull dartdoc out of our code at runtime. Brian, what's the feasibility of using the analyzer to do this? Given a path to a library file and a symbol name ( |
If the name is defined in the library file (rather than a part), then the only thing you need to do is read, scan, and parse the file, then find the symbol in the file. If it might be in a part, then you might have to repeat those steps after resolving the part URI's. That should be reasonably performant. |
That'd be awesome if we can use the analyzer. Regarding splitting into multiple annotations e.g. @task('Compile stuff.')
@depends(init)
compile(GrinderContext context) {
context.log("Compiling stuff...");
} but then it would have to be |
Ah, so use |
Here's a blizzard of different styles: https://gist.github.com/devoncarew/459faa419d87ef850b82 I really like this style:
Shown in lower case annotations. Is the consensus that they should be uppercase? Or, only lowercase if they're constants and not constructors? |
The standard in the core library appears to be to follow normal case conventions: upper case for constructors and lower case for constants. |
My vote: /// Compile stuff.
@Task
@Depends(init)
compile() {
...
} or keep annotations on the same line: /// Compile stuff.
@Task @Depends(init)
compile() {
...
} The style guide says: DO use UpperCamelCase names for classes intended to be used in metadata annotations. So that would mean |
I'd be fine with lowercase too, I just think we should lobby to have the style guide changed in that case. |
Let's keep it as is for now: @Task('Compile stuff')
@Depends(init) and keep the dartdoc option on the table for some future iteration: /// Compile stuff.
@Task
@Depends(init) |
sgtm, we could do it as a non-breaking change in the future by allowing dartdoc in addition to the current method. |
Closing this for now; the documentation in task annotations works pretty well. We can always revisit this in the future. |
instead of:
This would allow producing nice dartdocs for reusable task libraries!
Of course, it's not currently possible, see: http://dartbug.com/15704.
The text was updated successfully, but these errors were encountered: