pub repository
mirror.p-hatan.comgrinder
0.8.6Grinder is a task runner for Dart, helping to define and automate common project workflows.
Readme
Grinder
Dart workflows, automated.
Grinder consists of a library to define project tasks (e.g. test, build,
doc) and a command-line tool to run them.
pub package Build Status Build status Coverage Status
Getting Started
To start using grinder, add it to your
dev_dependencies.
Defining Tasks
Tasks are defined entirely by Dart code allowing you to take advantage of
the whole Dart ecosystem to write and debug them. Task definitions reside
in a tool/grind.dart script. To create a simple grinder script, run:
pub run grinder:init
In general, grinder scripts look something like this:
import 'package:grinder/grinder.dart';
main(args) => grind(args);
@DefaultTask('Build the project.')
build() {
log("Building...");
}
@Task('Test stuff.')
@Depends(build)
test() {
new PubApp.local('test').run([]);
}
@Task('Generate docs.')
doc() {
log("Generating docs...");
}
@Task('Deploy built app.')
@Depends(build, test, doc)
deploy() {
...
}
Any task dependencies (see @Depends above), are run before the dependent task.
Grinder contains a variety of convenience APIs for common task definitions, such
as PubApp referenced above. See the
API Documentation for
full details.
Running Tasks
First install the grind executable:
pub global activate grinder
then use it to run desired tasks:
grind test
grind build doc
or to run a default task (see @DefaultTask above):
grind
or to display a list of available tasks and their dependencies:
grind -h
You can also bypass installing grind and instead use pub run grinder.
Passing parameters to tasks
In order to pass parameters to tasks from the command-line, you query the
TaskArgs instance for your task invocation. For example:
grind build --release --mode=topaz
and:
@Task()
build() {
TaskArgs args = context.invocation.arguments
bool isRelease = args.getFlag('release');
String mode = args.getOption('mode'); // will be set to topaz
...
}
would pass the flag release and the option mode to the build task.
You can pass flags and options to multiple tasks. The following command-line would pass separate flags and options to two different tasks:
grind build --release generate-docs --header=small
Disclaimer
This is not an official Google product.
Changelog
grinder.dart changes
0.8.6
- Declare a
Nullreturn type forfail()andGrinderContext.fail().
0.8.5
- Broaden the
cli_utildependency to be compatible with version 0.2.0.
0.8.4
- Update the code to be
package:pedanticv1.9.0 compliant.
0.8.3+1
- Mark
fail()andGrinderContext.fail()as@alwaysThrows. - Use
package:pedanticto analyze the package.
0.8.3
- Upgrade dependencies for Dart 2
0.8.2
- Address some
--preview-dart-2runtime issues.
0.8.1
- Added the ability to pass parameters to tasks from the command line (using
a
TaskArgsparameter on task functions) - Removed the older way to pass flags and options to tasks (via named and positional parameters on task functions)
- Remove a dependency on a non-strong mode package (
unscripted)
0.8.0+3
- All APIs, including
pub run grinder, always use the same Dart version as the user.
0.8.0+2
- Added
categoriesandextraArgsparameters toDart2Js.compile()andDart2Js.compileAsync()
0.8.0+1 (2015/11/12)
- Fixed a bug with the DDC
--html-reportoption
0.8.0 (2015/10/29)
- Removed deprecated constants: BIN_DIR, BUILD_DIR, LIB_DIR, WEB_DIR
- Removed the 120-col line wrapping on task output
- Added a task for DDC (dev_compiler)
- Fixed an issue where we were emitting overly verbose stack traces on failures
- Fixed an issue where we would emit stdout after a failure, even when the stdout had been emitted as part of the task
- Added
outFileandenableExperimentalMirrorsto the dart2js task - Some grinder output now written using ansi colors
- Removed the deprecated
defaultInitmethod. - Added a task for dartdoc
- Added a new
sdkBin()method
0.7.2 (2015/7/8)
- Auto-expand directories passed to
Analyzer.analyze()to a list of Dart source files using the added methodfindDartSourceFiles(). - Add tests for
Analyzer.analyze()task. - Add
sourceDirsandexistingSourceDirsto return the projects top-level directories usually containing Dart source files. - Deprecate the
Testsclass (in favor ofTestRunner) - Add
lineLengthas an optional argument toDartFmt.format
0.7.1+3 (2015/5/24)
- Fix bug with Dart.run/runAsync. Args were swapped.
0.7.1+2 (2015/5/24)
- Add a
Dart.runAsyncstatic method.
0.7.1+1 (2015/5/19)
- Add a
filesparam toTestRunner.test.
0.7.1 (2015/5/19)
- Added
grind --completion installcommand to install tab-completion for task names and options ingrind. - Improved
grind -h(help) output. Dart.runnow takes an optionalvmArgs, a list of arguments passed to the Dart VM.- Added
downgrademethod doPub. - Introduce
RunOptionsto support allProcess.run/Process.startparameters. TheworkingDirectoryparameter is now deprecated in all methods, useRunOptions.workingDirectoryinstead. - Added
PubApp.runAsync. - In
Dart.run, deprecate the vmNewGenHeapMB and vmOldGenHeapMB options. - Added support for passing lists of files or directories to
DartFmt.format(). Analyzer.analyzeFilesis deprecated in favor ofAnalyzer.analyze.- Added a
Pub.global.list()method to list the installed applications. - added a
TestRunnerclass - a wrapper around the newtestpackage.
0.7.0 (2015/4/20)
- Big changes! Task definitions are now primarily annotation based; see the readme for more information and an example
- The
GrinderContextarg is no longer expected in task functions. Instead, thecontextvariable (and thelogandfailfunctions) are available as global variables. They're injected into the zone running the current task. pub [global] run grinder:grindno longer work, usepub [global] run grinderinstead. Add:grinderif usingpub runin Dart SDK < 1.10.copyFileandcopyDirectoryand deprecated in favor of a newcopymethoddeleteEntityis deprecated in favor of a newdeletemethod- Renamed
runProcess/runProcessAsync/runDartScripttorun/runAsync/Dart.run. Process result info (stdout, stderr, exitCode) is now exposed by these methods and some others which call them. - Added a wrapper class around
pub global activate/run/pub runapplications -PubApp - Grinder can now create a simple starter script for a project - run
pub run grinder:init
0.6.5 (2015/1/13)
- added
defaultInit()anddefaultClean()methods, for common tasks - added methods for Pub.global.activate and Pub.global.run
- added an optional
workingDirectoryargument to more methods - added a
--versioncommand line flag - have the version command check to see if there's a newer version of grinder available
- the dart2js compile tasks now create the output directory if it doesn't exist
0.6.4 (2014/12/18)
- clarify that users should put their build scripts in
tools/grind.dart - add a
getSdkDirmethod
0.6.2 (2014/11/13)
- widen the version constraint on
quiver
0.6.1 (2014/10/12)
- widen the version constraint on
args
0.6.0 (2014/09/22)
The convenience API is now more terse:
- the
defineTask()method has been renamed totask() - instead of named parameters, the
task()function now uses optional positional parameters
Added two new entrypoint files in bin/: grind.dart and grinder.dart. These
let you run grinder via:
pub run grinder test
They look for a corresponding grinder script in the tool directory
(bin/grind.dart looks for tool/grind.dart and bin/grinder.dart looks for
tool/grinder.dart). If they find a corresponding script they run it in a new
Dart VM process. This means that projects will no longer have to have a
grind.sh script in the root of each project.
PubTool's build methods now take an optional workingDirectory argument.
Removed runSdkBinary and runSdkBinaryAsync, and they are no longer needed.
Use runProcess and runProcessAsync instead.
The methods on PubTools and Dart2jsTools are now static - you no longer need
to create an instance to use them. Also, PubTools was renamed to Pub and
Dart2jsTools was renamed to Dart2js. And a new utility class for
dartanalyzer - Analyzer - was created.
0.5.7 (2014/07/28)
- added
runProcessAsync()and related async methods (such asPubTools.buildAsync(...)) - removed duplicated stack traces when the build fails with exceptions
- throw an exception when running SDK binaries, and we are not able to locate the Dart SDK
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add grinderpubspec.yaml
name: grinder
# This version must be updated in tandem with the lib/src/cli.dart version.
version: 0.8.6
description: Grinder is a task runner for Dart, helping to define and automate common project workflows.
homepage: https://github.com/google/grinder.dart
environment:
sdk: '>=2.10.0 <3.0.0'
dependencies:
cli_util: '>=0.1.2 <3.0.0'
glob: ^1.0.0
meta: ^1.1.7
path: ^1.0.0
dev_dependencies:
pedantic: ^1.9.0
test: ^1.0.0
executables:
grind: grinder
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.0.4 | 2013-09-24T19:26:22.204200Z | Download | 9de8fb40e881b3286060ad571473989081cac3a20ba120db20a56c8998df8a9a |
| 0.0.5 | 2013-10-01T16:33:18.998120Z | Download | 11a861daff014f235c41c7282eec2ee00a512b7d0c2f21b7ba8ec398d4414220 |
| 0.0.6 | 2013-10-09T06:40:42.005520Z | Download | 026d1bda256f40090ecaf3d131c92d54d5721bd332fec934746b9d1b92dc1cf7 |
| 0.0.7 | 2013-10-18T19:28:16.196750Z | Download | 9aeeb1a656d5ef5c5ce57072e1dc805bc21ff25a236ca2ac0cf42bb04d62e0c8 |
| 0.1.0 | 2013-10-30T14:15:55.348910Z | Download | 8dcdf8a3a828b9c841eeb7a10e1fd26303f51513ed2eeb57d99a8fca5b41c1b0 |
| 0.4.0 | 2013-11-11T06:01:39.504670Z | Download | 0506fa5a51713181c1851a352f6e10cb3627264d8062b818c538ed790fc1cac6 |
| 0.4.1 | 2013-11-25T20:10:48.730700Z | Download | dec7495160883c9ee784beafb2abb51a858675dc572c0d5c654fca362dbbd082 |
| 0.4.2 | 2013-11-26T00:34:12.674500Z | Download | e0c8fde40af33e0391eb16ad5fd2546184eec83f1eea3e7169b4a0884587f92b |
| 0.4.3 | 2013-11-27T15:26:08.363550Z | Download | 2bd14dd86f92ac02b7c1a493e0b35925fc690829f6a288527bbefdde0c9d849d |
| 0.4.4 | 2013-12-10T16:49:54.210090Z | Download | 977e9974c73d498173bca31387dc8f63d810815c916e3237e14748ca548e8cfb |
| 0.4.5 | 2013-12-21T18:13:09.517720Z | Download | fec4fa7afdd6424f567f622550ab9b44dcadf0cfde3e369c2bd6932a792702a1 |
| 0.5.0 | 2014-01-03T20:33:48.479220Z | Download | 4e9e52c669974e74c98097fdc8711942b992e873391397a5539a728f90c17619 |
| 0.5.1 | 2014-01-06T18:09:33.897210Z | Download | fde18f3e7e41b3cdb6e4ec6ba4e02733116ba8cfe4fd7482fc13e540f9b872ce |
| 0.5.2 | 2014-04-11T22:01:23.705470Z | Download | 86b75995e5bf2f4e281b00e6826d427757e5e7b47358b48eea4c468b2f9a215a |
| 0.5.3 | 2014-05-22T02:16:07.606240Z | Download | 8063a3663120a90b77792c7f53a04b3017c220610253d9c088b35035fd934348 |
| 0.5.4 | 2014-05-23T16:47:32.201730Z | Download | 2a06c90a9a5a1fccae8c421b4559fcca49b694ecdabb3f5d16a56578b8bb06cc |
| 0.5.6 | 2014-07-21T09:30:57.961760Z | Download | 0409881bf126a10818398a9324fe694718fbfb58eb2b4ddf58bf56cccd3bf2e5 |
| 0.5.7 | 2014-07-29T06:13:54.555200Z | Download | 297ac83346613371c115f6fa203d6829953551e703fa7ce13183b737411b9fe9 |
| 0.6.0 | 2014-09-24T03:12:12.333780Z | Download | 2f3b345b6c5d203c4fb69c989327294539244c50178e2c8c7d2228a0e101dc58 |
| 0.6.1 | 2014-10-13T06:54:28.649820Z | Download | 8e7d702dcef50c642444152f07e0a88fabf358471f1658983654d1b07a9ed5fa |
| 0.6.2 | 2014-11-13T19:44:52.284420Z | Download | 56df31701401eb8f854dc8fa5399a99a1988f7d035dcc9b0819e52ae0994ce90 |
| 0.6.3 | 2014-12-11T17:26:01.406320Z | Download | 10a4a0dbeae1fd9ba56fdce4606a9a74d31f42678b973ba580d3fc2707461924 |
| 0.6.4 | 2014-12-18T23:00:56.472410Z | Download | e1c3f8ee0a3cc2c6e22468bfab4257677692bedc37c6d3dd3e2a343ad8293705 |
| 0.6.4+1 | 2014-12-23T19:18:28.453600Z | Download | 80d71af01dce6aadc7dedc19e361b65b1d8a9c3cfc32d37812eb01e920e4af3d |
| 0.6.5 | 2015-01-14T02:03:03.278370Z | Download | d45160a8e7bbf238b7bb4d236c83fea5ade66cea517f47023ee96e63649faba7 |
| 0.6.6 | 2015-01-29T20:09:35.061460Z | Download | 94bcfcbeedfe3cffdc04bbd7af32f80233f3733bf52c8c56c3fc36e106d34385 |
| 0.6.6+1 | 2015-01-31T02:08:26.867600Z | Download | 1408c2e0616ec53a5391766483e64858fc26ec14e357410c701c78fa93d5dfc8 |
| 0.6.6+2 | 2015-01-31T02:22:50.159420Z | Download | 40a33d3a8dba09ed0462af7b1c3acd512ad89d07827676cff663b1edc26a638e |
| 0.6.6+3 | 2015-02-05T23:53:48.663120Z | Download | 29081f9c3fcf90b74ed5016b409105e85efe819a2914512431f8a535b7daf0bf |
| 0.7.0-dev.1 | 2015-03-29T01:58:20.731920Z | Download | 66e4961ad1743c708f70c2c5a3f7fcf2e6bbf6e5337c9eb5fbbabbe3f297767c |
| 0.7.0-dev.2 | 2015-04-10T23:41:10.965890Z | Download | d1ef1ac62089b1b5cf9575af41f324ed548b1ea715220b15bd50c527fff588ac |
| 0.7.0 | 2015-04-21T14:37:53.523970Z | Download | 0ed2a62548fd25e99c551a01848c3d76448d309a0ad03467c55a72a5bf8569f6 |
| 0.7.1 | 2015-05-19T22:54:41.103070Z | Download | 517a659ed6ac3da529ccfe857fbabf9c51e41e1bb5c8c0b839063c7161147a66 |
| 0.7.1+1 | 2015-05-20T13:25:20.556240Z | Download | 2f2363a4c68a92df23a56daaace719d3d4530d4f11baa2801bcb027a40657a72 |
| 0.7.1+2 | 2015-05-24T18:27:09.788Z | Download | 48203ae87b6bba802520bbd9e73332e6add92689b632fc69d2e2722f97d619bb |
| 0.7.1+3 | 2015-05-24T21:31:17.303Z | Download | 35450802cfeffbbf8a27a71281de98b45ba5176ebb997a877920c98bf34ba96c |
| 0.7.2 | 2015-07-09T02:07:05.133Z | Download | 4fa504d5b0fefd2e82a402d2626f329a8ccbe6b47097b609b2967037a766229e |
| 0.8.0-dev.1 | 2015-10-26T16:48:09.867Z | Download | 704fe8b8c721c274de45f727b312f1cde40b9fad11c845f2a3b4324bd35db868 |
| 0.8.0-dev.2 | 2015-10-29T13:17:58.292Z | Download | 91bb8f197a606113f10e94495d4d80ebe1336bd259a9660e053dfaeb739ad2fc |
| 0.8.0 | 2015-10-29T14:09:31.998Z | Download | b12b054bc5792d5a44feedd7fb85d6190183d99c1e5f0546f17f8f1d8d4a03e5 |
| 0.8.0+1 | 2015-11-13T07:59:35.321Z | Download | 7714a971da2483b2e30526b200280179212919f767b2dedcef62879bc900fbfc |
| 0.8.0+2 | 2016-01-27T00:45:44.773Z | Download | 9b65c1fd680a23cc6b86a25dcbfae44a80781deba37897aaa392295880ee9c0f |
| 0.8.0+3 | 2016-10-16T09:24:29.061Z | Download | 5dc15642a03e26cdef83467587ff6cbdcd4aa457ab9f203ba26cf722d395cadf |
| 0.8.1 | 2017-12-19T02:03:53.397955Z | Download | 5b0b44252ed8a7b6ec7ee79c3877078ffac42f7c4ab65d041eb0bd2caee84f1d |
| 0.8.2 | 2018-05-10T10:17:52.516341Z | Download | 6636532c45eadabd20f3390d3801613d4a26afe6c150e05c5227b89d28bf91f7 |
| 0.8.3 | 2018-07-20T00:22:45.062783Z | Download | 8284e19b321e2ea157d43d3151ca712d62c10bf2fce2e8042499c90483b13f0d |
| 0.8.3+1 | 2019-07-21T22:47:23.080630Z | Download | 9653d450012e31fe41edc6a0fd7beed254c8b9de7e298d0f2fd92b2c0e29d19f |
| 0.8.4 | 2020-03-18T21:07:23.466885Z | Download | fdc35bbe1c903e0a34b918329eb49aaadf40f7b324cbeb600bca360efc318f2a |
| 0.8.5 | 2020-06-09T18:25:50.083602Z | Download | 7fd2bed35260317ce91eaada2f229526759d789134782b471fe4d60d1a442c9b |
| 0.8.6 | 2020-10-13T21:53:31.319869Z | Download | 29e927659629265ae2c512841f4c130ca314fe010b32904ab4340fc9ebcb37f1 |
| 0.9.0-nullsafety.0 | 2021-01-17T01:10:10.140942Z | Download | d6ddb4d11a96ec905f6c243f921e257861cb406ebfc549b83bff43b2e88c8bfa |
| 0.9.0 | 2021-03-18T20:38:01.718841Z | Download | 2961d5bf164ad2b91e0a0259f04ee5a625f4a4bf0c9f294a0503eb98e5cf0fb9 |
| 0.9.1 | 2022-04-04T19:06:54.807913Z | Download | 2e8c01865aecf9ca1df55973f12bf0455a6a6ceb23867cd3277a803a4060fb19 |
| 0.9.2 | 2022-06-22T04:05:33.785923Z | Download | b24948a441fc65d07bc8b219d7ee8d6cc0af4cdb13823e0d3be6d848eb787b04 |
| 0.9.3 | 2023-02-06T16:37:29.469679Z | Download | 1dabcd70f0d3975f9143d0cebf48a09cf56d4f5e0922f1d1931781e1047c8d00 |
| 0.9.4 | 2023-04-27T16:03:41.502429Z | Download | 48495acdb3df702c55c952c6536faf11631b8401a292eb0d182ef332fc568b56 |
| 0.9.5 | 2023-11-09T23:02:11.294655Z | Download | e1996e485d2b56bb164a8585679758d488fbf567273f51c432c8733fee1f6188 |
| 0.10.0 | 2026-07-01T21:26:49.695381Z | Download | 8c65fc6c0c0748c2d9080c1fb603d7a9640bf5a5eda29f35099bd351cc45093f |
| 0.10.1 | 2026-09-03T00:13:15.873220Z | Download | 7e0969c3e1e4fcc2a24385457df52626adf0efcba72a43209f72b986a79dc8f3 |
| 0.10.2 | 2026-10-21T19:48:17.933603Z | Download | f8cf4d64aa7b71460ea6b0a2a288b83b40a74be93849d140579cd96db86d644a |
Dependencies
cli_util "\u003e=0.1.2 \u003c3.0.0"
glob "^1.0.0"
meta "^1.1.7"
path "^1.0.0"