<commit_before>// Copyright (c) 2013, Google Inc. Please see the AUTHORS file for details.
// 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:convert';
import 'dart:io';

import 'package:grinder/grinder.dart';
import 'package:intl/intl.dart';
import 'package:path/path.dart' as path;

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([List<String> args]) {
  defineTask('setup', taskFunction: setup);

  defineTask('mode-notest', taskFunction: (c) => _changeMode(useTestMode: false));
  defineTask('mode-test', taskFunction: (c) => _changeMode(useTestMode: true));

  defineTask('compile', taskFunction: compile, depends : ['setup']);
  defineTask('deploy', taskFunction: deploy, depends : ['setup']);

  defineTask('docs', taskFunction: docs, depends : ['setup']);
  defineTask('stats', taskFunction: stats);
  defineTask('archive', taskFunction: archive, depends : ['mode-notest', 'deploy']);

  // For now, we won't be building the webstore version from Windows.
  if (!Platform.isWindows) {
    defineTask('release', taskFunction: release, depends : ['mode-notest', 'deploy']);
    defineTask('release-nightly',
               taskFunction : releaseNighly,
               depends : ['mode-notest', 'deploy']);
  }

  defineTask('clean', taskFunction: clean);

  startGrinder(args);
}

/**
 * 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"
        "Please set the DART_SDK environment variable to the SDK path.\n"
        "  e.g.: 'export DART_SDK=your/path/to/dart/dart-sdk'");
  }

  PubTools pub = new PubTools();
  pub.get(context);

  _populateSdk(context);

  // copy from ./packages to ./app/packages
  copyDirectory(getDir('packages'), getDir('app/packages'), context);

  BUILD_DIR.createSync();
  DIST_DIR.createSync();
}

/**
 * Compile the Spark non-Polymer entry-point. This step will be removed soon in
 * favor of the Polymer-oriented [deploy].
 */
@deprecated
void compile(GrinderContext context) {
  _dart2jsCompile(context, new Directory('app'), 'spark.dart');
}

/**
 * Copy all source to `build/deploy`. Do a polymer deploy to `build/deploy-out`.
 * This builds the regular (non-test) version of the app.
 */
void deploy(GrinderContext context) {
  Directory sourceDir = joinDir(BUILD_DIR, ['deploy']);
  Directory destDir = joinDir(BUILD_DIR, ['deploy-out']);

  _polymerDeploy(context, sourceDir, destDir);

  _dart2jsCompile(context, joinDir(destDir, ['web']),
      'spark_polymer.html_bootstrap.dart', true);
  _dart2jsCompile(context, joinDir(destDir, ['web']),
      'spark_polymer_ui.html_bootstrap.dart', true);
  // TODO(ussuri): this is needed only in the interim while we still want to
  // switch back to non-Polymer UI for reference. Remove this once the
  // switchover to Polymer is complete.
  _dart2jsCompile(context, joinDir(destDir, ['web']),
      'spark.html_bootstrap.dart', true);
}

// Creates a release build to be uploaded to Chrome Web Store.
// It will perform the following steps:
// - Sources will be compiled in Javascript using "compile" task
// - If the current branch/repo is not releasable, we just create an archive
//   tagged with a revision number.
// - Using increaseBuildNumber, for a given revision number a.b.c where a, b
//   and c are integers, we increase c, the build number and write it to the
//   manifest.json file.
// - We duplicate the manifest.json file to build/polymer-build/web since we'll
//   create the Chrome App from here.
// - "archive" task will create a spark.zip file in dist/, based on the content
//   of build/polymer-build/web.
// - If everything is successful and no exception interrupted the process,
//   we'll commit the new manifest.json containing the updated version number
//   to the repository. The developer still needs to push it to the remote
//   repository.
// - We eventually rename dist/spark.zip to dist/spark-a.b.c.zip to reflect the
//   new version number.
void release(GrinderContext context) {
  // If repository is not original repository of Spark and the branch is not
  // master.
  if (!_canReleaseFromHere()) {
    _archiveWithRevision(context);<commit_msg>Removed dart2js for spark.html from the deployment process<commit_after>// Copyright (c) 2013, Google Inc. Please see the AUTHORS file for details.
// 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:convert';
import 'dart:io';

import 'package:grinder/grinder.dart';
import 'package:intl/intl.dart';
import 'package:path/path.dart' as path;

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([List<String> args]) {
  defineTask('setup', taskFunction: setup);

  defineTask('mode-notest', taskFunction: (c) => _changeMode(useTestMode: false));
  defineTask('mode-test', taskFunction: (c) => _changeMode(useTestMode: true));

  defineTask('compile', taskFunction: compile, depends : ['setup']);
  defineTask('deploy', taskFunction: deploy, depends : ['setup']);

  defineTask('docs', taskFunction: docs, depends : ['setup']);
  defineTask('stats', taskFunction: stats);
  defineTask('archive', taskFunction: archive, depends : ['mode-notest', 'deploy']);

  // For now, we won't be building the webstore version from Windows.
  if (!Platform.isWindows) {
    defineTask('release', taskFunction: release, depends : ['mode-notest', 'deploy']);
    defineTask('release-nightly',
               taskFunction : releaseNighly,
               depends : ['mode-notest', 'deploy']);
  }

  defineTask('clean', taskFunction: clean);

  startGrinder(args);
}

/**
 * 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"
        "Please set the DART_SDK environment variable to the SDK path.\n"
        "  e.g.: 'export DART_SDK=your/path/to/dart/dart-sdk'");
  }

  PubTools pub = new PubTools();
  pub.get(context);

  _populateSdk(context);

  // copy from ./packages to ./app/packages
  copyDirectory(getDir('packages'), getDir('app/packages'), context);

  BUILD_DIR.createSync();
  DIST_DIR.createSync();
}

/**
 * Compile the Spark non-Polymer entry-point. This step will be removed soon in
 * favor of the Polymer-oriented [deploy].
 */
@deprecated
void compile(GrinderContext context) {
  _dart2jsCompile(context, new Directory('app'), 'spark.dart');
}

/**
 * Copy all source to `build/deploy`. Do a polymer deploy to `build/deploy-out`.
 * This builds the regular (non-test) version of the app.
 */
void deploy(GrinderContext context) {
  Directory sourceDir = joinDir(BUILD_DIR, ['deploy']);
  Directory destDir = joinDir(BUILD_DIR, ['deploy-out']);

  _polymerDeploy(context, sourceDir, destDir);

  _dart2jsCompile(context, joinDir(destDir, ['web']),
      'spark_polymer.html_bootstrap.dart', true);
  _dart2jsCompile(context, joinDir(destDir, ['web']),
      'spark_polymer_ui.html_bootstrap.dart', true);
}

// Creates a release build to be uploaded to Chrome Web Store.
// It will perform the following steps:
// - Sources will be compiled in Javascript using "compile" task
// - If the current branch/repo is not releasable, we just create an archive
//   tagged with a revision number.
// - Using increaseBuildNumber, for a given revision number a.b.c where a, b
//   and c are integers, we increase c, the build number and write it to the
//   manifest.json file.
// - We duplicate the manifest.json file to build/polymer-build/web since we'll
//   create the Chrome App from here.
// - "archive" task will create a spark.zip file in dist/, based on the content
//   of build/polymer-build/web.
// - If everything is successful and no exception interrupted the process,
//   we'll commit the new manifest.json containing the updated version number
//   to the repository. The developer still needs to push it to the remote
//   repository.
// - We eventually rename dist/spark.zip to dist/spark-a.b.c.zip to reflect the
//   new version number.
void release(GrinderContext context) {
  // If repository is not original repository of Spark and the branch is not
  // master.
  if (!_canReleaseFromHere()) {
    _archiveWithRevision(context);
{'fraction_non_alphanumeric': 0.12412847182535147, 'fraction_numerical': 0.001828780432049377, 'mean_word_length': 3.9575070821529743, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '190491', 'n_tokens_mistral': 2659, 'n_tokens_neox': 2515, 'n_words': 896}