addStandaloneTasks function

void addStandaloneTasks()

Enables tasks for building standalone Dart VM packages.

Implementation

void addStandaloneTasks() {
  if (_addedStandaloneTasks) return;
  _addedStandaloneTasks = true;

  freezeSharedVariables();
  standaloneName.freeze();

  addTask(GrinderTask('pkg-compile-snapshot',
      taskFunction: () => _compileSnapshot(release: true),
      description: 'Build Dart script snapshot(s) in release mode.'));

  addTask(GrinderTask('pkg-compile-snapshot-dev',
      taskFunction: () => _compileSnapshot(release: false),
      description: 'Build Dart script snapshot(s) in dev mode.'));

  addTask(GrinderTask('pkg-compile-native',
      taskFunction: _compileNative,
      description: 'Build Dart native executable(s).'));

  addTask(GrinderTask('pkg-standalone-dev',
      taskFunction: _buildDev,
      description: 'Build standalone executable(s) for testing.',
      // TODO(nweiz): Build a native executable on platforms that support it
      // when dart-lang/sdk#39973 is fixed.
      depends: ['pkg-compile-snapshot-dev']));

  var tasks = {
    for (var platform in CliPlatform.all)
      platform: GrinderTask('pkg-standalone-$platform',
          taskFunction: () => _buildPackage(platform),
          description:
              'Build a standalone package for ${platform.toHumanString()}.',
          depends: platform.useNative
              ? ['pkg-compile-native']
              : ['pkg-compile-snapshot'])
  };
  tasks.values.forEach(addTask);

  addTask(GrinderTask('pkg-standalone-all',
      description: 'Build all standalone packages.',
      depends: [
        for (var MapEntry(key: platform, value: task) in tasks.entries)
          // Omit Fuchsia tasks because we can't run those unless we're actually
          // running on Fuchsia ourselves.
          if (!platform.os.isFuchsia || platform.isCurrent) task.name
      ]));
}