Dart workflows, automated.

See the README for detailed usage information.

Typedefs

TaskFunction(GrinderContext context) → dynamic

Used to define a method body for a task. Note: a task's context is now available as a global variable ('context'). Your task functions should no longer be definied with a single GrinderContext parameter.

Properties

BIN_DIR → Directory

read-only
binDir → Directory

read-only
BUILD_DIR → Directory

read-only
buildDir → Directory

read-only
context GrinderContext

Get the GrinderContext for the currently executing task.

read-only
dartVM → File

read-only
defaultTask GrinderTask

The default task run when no tasks are specified on the command line.

read / write
LIB_DIR → Directory

read-only
libDir → Directory

read-only
sdkDir → Directory

Return the path to the current Dart SDK. This will return null if we are unable to locate the Dart SDK.

read-only
WEB_DIR → Directory

read-only
webDir → Directory

read-only

Functions

addTask(GrinderTask task) → void

Programmatically add a task to the global Grinder instance.

baseName(FileSystemEntity entity) → String

Return the first n - 1 segments of the file path.

copy(FileSystemEntity entity, Directory destDir, [GrinderContext context]) → void

copyDirectory(Directory srcDir, Directory destDir, [GrinderContext context]) → void

copyFile(File srcFile, Directory destDir, [GrinderContext context]) → void

defaultClean([GrinderContext context]) → void

A default implementation of a clean task. This task deletes all generated artifacts in the build/.

defaultInit([GrinderContext context]) → void

A default implementation of an init task. This task verifies that the grind script is executed from the project root.

delete(FileSystemEntity entity) → void

Delete the given file entity reference.

deleteEntity(FileSystemEntity entity, [GrinderContext context]) → void

fail(String message) → void

Halt task execution; throws an exception with the given error message.

fileExt(FileSystemEntity entity) → String

Return the file's extension without the period. This will return null if there is no extension.

fileName(FileSystemEntity entity) → String

Return the last segment of the file path.

getDir(String path) → Directory

Return the directory pointed to by the given path. This method converts the given path to a platform dependent path.

getFile(String path) → File

Return the file pointed to by the given path. This method converts the given path to a platform dependent path.

getSdkDir([List<String> cliArgs]) → Directory

Return the path to the current Dart SDK. This will return null if we are unable to locate the Dart SDK.

grind(List<String> args, {bool verifyProjectRoot: true}) → Future

Run the grinder file.

grinderArgs() → List<String>

joinDir(Directory dir, List<String> files) → Directory

joinFile(Directory dir, List<String> files) → File

log(String message) → void

Log an informational message to Grinder's output.

run(String executable, {List<String> arguments: const [], RunOptions runOptions, bool quiet: false, String workingDirectory}) → String

Synchronously run an executable.

runAsync(String executable, {List<String> arguments: const [], RunOptions runOptions, bool quiet: false, String workingDirectory}) → Future<String>

Asynchronously run an executable.

runDartScript(String script, {List<String> arguments: const [], bool quiet: false, String packageRoot, RunOptions runOptions, int vmNewGenHeapMB, int vmOldGenHeapMB, String workingDirectory}) → String

Run a dart script using run_lib.run.

runProcess(String executable, {List<String> arguments: const [], RunOptions runOptions, bool quiet: false, String workingDirectory}) → String

Synchronously run an executable.

runProcessAsync(String executable, {List<String> arguments: const [], RunOptions runOptions, String workingDirectory, bool quiet: false}) → Future<String>

Asynchronously run an executable.

startGrinder(List<String> args, {bool verifyProjectRoot: true}) → Future

Start the build process. This should be called at the end of the main() method. If there is a task failure, this method will halt task execution and throw.

task(String name, [Function taskFunction, List<String> depends = const []]) → void

Add a new task definition to the global Grinder instance. A name is required. If specified, a taskFunction is invoked when the task starts. Any dependencies of the task, that need to run before it, should be passed in via depends.

Classes

Analyzer

Utility tasks for invoking the analyzer.

BrowserInstance

Chrome

ContentShell

Dart

Utility tasks for for getting information about the Dart VM and for running Dart applications.

Dart2js

Utility tasks for invoking dart2js.

DartFmt

Utility class for invoking dartfmt from the SDK. This wrapper requires the dartfmt from SDK 1.9 and greater.

Dartium

A wrapper around the Dartium browser.

DefaultTask

An annotation to define the default GrinderTask to run when no tasks are specified on the command line.

Depends

An annotation to define a Task's dependencies.

FilePath

A class to make it easier to manipulate file system entites. Once paths or entites are converted into Paths, they can be easily copied, deleted, joined, and their name retrieved.

FileSet

A class to handle defining, composing, and comparing groups of files.

Grinder

A class representing a running instance of a Grinder.

GrinderContext

A GrinderContext is used to give the currently running Grinder task the ability to introspect the running state. It can get the current Grinder instance and get a reference to the current GrinderTask instance (as well as the previous and next tasks, if any).

GrinderTask

Represents a Grinder task. These can be created automatically using the Task and Depends annotations.

Pub

Utility tasks for executing pub commands.

PubApp

A Dart command-line application, installed via pub global activate.

PubGlobal

Access the pub global commands.

RunOptions

Arguments passed to Process.run or Process.start. See Process.run for more details.

Task

An annotation to mark a GrinderTask definition.

TestRunner

A wrapper around the test package. This class is used to run your unit tests.

Tests

A utility class to run tests for your project.

Exceptions / Errors

GrinderException

An exception class for the Grinder library.

ProcessException

An exception from a process which exited with a non-zero exit code.