anchor.diff:  // All rights reserved. Use of this source code is governed by a BSD-style
   // license that can be found in the LICENSE file.
   
  -import 'dart:async';
   import 'dart:convert';
   import 'dart:io';
   
   import 'package:grinder/grinder.dart';
   import 'package:intl/intl.dart';
  -import 'package:polymer/builder.dart' as polymer;
   
   final NumberFormat _NF = new NumberFormat.decimalPattern();
   
  +// TODO: make the deploy-test and deploy tasks incremental
  +
  +final Directory BUILD_DIR = new Directory('build');
  +final Directory DIST_DIR = new Directory('dist');
  +
   void main() {
  -  defineTask('init', taskFunction: init);
  -  defineTask('sdk', taskFunction: populateSdk, depends: ['init']);
  -  defineTask('packages', taskFunction: packages, depends: ['init', 'sdk']);
  -
  -  defineTask('analyze', taskFunction: analyze, depends: ['packages']);
  -  defineTask('compile', taskFunction: compile, depends: ['packages', 'sdk']);
  -
  -  defineTask('archive', taskFunction : archive,
  -             depends : ['compile', 'mode-notest']);
  -  defineTask('release', taskFunction : release,
  -             depends : ['compile', 'mode-notest']);
  -
  -  defineTask('mode-test', taskFunction: (c) => changeMode(c, true));
  -  defineTask('mode-notest', taskFunction: (c) => changeMode(c, false));
  +  defineTask('setup', taskFunction: setup);
  +
  +  defineTask('mode-notest', taskFunction: (c) => _changeMode(c, false));
  +  defineTask('mode-test', taskFunction: (c) => _changeMode(c, true));
  +
  +  defineTask('deploy', taskFunction: deploy, depends : ['setup', 'mode-notest']);
  +  defineTask('deploy-test', taskFunction: deployTest, depends : ['setup', 'mode-test']);
  +
  +  defineTask('docs', taskFunction : docs, depends : ['setup']);
  +  defineTask('archive', taskFunction : archive, depends : ['deploy']);
  +  defineTask('release', taskFunction : release, depends : ['deploy']);
   
     defineTask('clean', taskFunction: clean);
   
     startGrinder();
   }
   
  -bool runCommandSync(GrinderContext context, String command) {
  -  context.log(command);
  -  var result = Process.runSync('/bin/sh', ['-c', command]);
  -  if (result.stdout.isNotEmpty) {
  -    context.log(result.stdout);
  -  }
  -  if (result.stderr.isNotEmpty) {
  -    context.log(result.stderr);
  -  }
  -  return (result.exitCode == 0);
  -}
  -
  -String getCommandOutput(String command) {
  -  var result = Process.runSync('/bin/sh', ['-c', command]);
  -  return result.stdout.trim();
  -}
  -
  -void init(GrinderContext context) {
  +/**
  + * Init needed dependencies.
  + */
  +void setup(GrinderContext context) {
     // check to make sure we can locate the SDK
     if (sdkDir == null) {
       context.fail("Unable to locate the Dart SDK\n"
  
positive.code:  * Recursively create `.files` json files in the given directory; these files
   * serve as directory listings.
   */
  void createDirectoryListings(Directory dir) {
    List<String> files = [];
  
    String parentName = fileName(dir);
  
negative.code:   FileSet srcVer = new FileSet.fromFile(srcVersionFile);
    FileSet destVer = new FileSet.fromFile(destVersionFile);
  
    // check the state of the sdk/version file, to see if things are up-to-date
    if (!destVer.upToDate(srcVer)) {
      // copy files over
      context.log('copying SDK');
      copyFile(srcVersionFile, destSdkDir);
      copyDirectory(joinDir(srcSdkDir, ['lib']), joinDir(destSdkDir, ['lib']));
  
      // lib/_internal/compiler, dartdoc, and pub are not sdk libraries, but do
      // take up a lot of space; remove them
      _runCommandSync(context, 'rm -rf app/sdk/lib/_internal/compiler');
      _runCommandSync(context, 'rm -rf app/sdk/lib/_internal/dartdoc');
      _runCommandSync(context, 'rm -rf app/sdk/lib/_internal/pub');
  
      // traverse directories, creating a .files json directory listing
      context.log('creating SDK directory listings');
      _createDirectoryListings(destSdkDir);
    }
  }
  
  