Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: pkg/polymer/lib/component_build.dart

Issue 23898009: Switch polymer's build.dart to use the new linter. This CL does the following (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: addressing john comments (part 2) - renamed files Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/polymer/lib/builder.dart ('k') | pkg/polymer/lib/deploy.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/component_build.dart
diff --git a/pkg/polymer/lib/component_build.dart b/pkg/polymer/lib/component_build.dart
index 7184787bc9f0f183650ec1ab8ea0ecd306244425..6a923f0a15cdd147ffc5499d3d00ecb1639e5b55 100644
--- a/pkg/polymer/lib/component_build.dart
+++ b/pkg/polymer/lib/component_build.dart
@@ -2,105 +2,21 @@
// 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.
-/**
- * Common logic to make it easy to create a `build.dart` for your project.
- *
- * The `build.dart` script is invoked automatically by the Editor whenever a
- * file in the project changes. It must be placed in the root of a project
- * (where pubspec.yaml lives) and should be named exactly 'build.dart'.
- *
- * A common `build.dart` would look as follows:
- *
- * import 'dart:io';
- * import 'package:polymer/component_build.dart';
- *
- * main() => build(new Options().arguments, ['web/index.html']);
- */
+/** This library is deprecated. Please use `builder.dart` instead. */
+@deprecated
library build_utils;
-import 'dart:async';
-import 'dart:convert';
-import 'dart:io';
-import 'package:args/args.dart';
+import 'package:meta/meta.dart';
-import 'dwc.dart' as dwc;
-import 'src/utils.dart';
-import 'src/compiler_options.dart';
+import 'builder.dart' as builder;
/**
- * Set up 'build.dart' to compile with the dart web components compiler every
- * [entryPoints] listed. On clean commands, the directory where [entryPoints]
- * live will be scanned for generated files to delete them.
+ * This function is deprecated. Please use `build` from `builder.dart`
+ * instead.
*/
-Future<List<dwc.AnalysisResults>> build(List<String> arguments,
- List<String> entryPoints,
+@deprecated
+Future build(List<String> arguments, List<String> entryPoints,
{bool printTime: true, bool shouldPrint: true}) {
- bool useColors = stdioType(stdout) == StdioType.TERMINAL;
- return asyncTime('Total time', () {
- var args = _processArgs(arguments);
- var tasks = new FutureGroup();
- var lastTask = new Future.value(null);
- tasks.add(lastTask);
-
- var changedFiles = args["changed"];
- var removedFiles = args["removed"];
- var cleanBuild = args["clean"];
- var machineFormat = args["machine"];
- // Also trigger a full build if the script was run from the command line
- // with no arguments
- var fullBuild = args["full"] || (!machineFormat && changedFiles.isEmpty &&
- removedFiles.isEmpty && !cleanBuild);
-
- var options = CompilerOptions.parse(args.rest, checkUsage: false);
-
- if (fullBuild || !changedFiles.isEmpty || !removedFiles.isEmpty) {
- for (var file in entryPoints) {
- var dwcArgs = new List.from(args.rest);
- if (machineFormat) dwcArgs.add('--json_format');
- if (!useColors) dwcArgs.add('--no-colors');
- dwcArgs.add(file);
- // Chain tasks to that we run one at a time.
- lastTask = lastTask.then((_) => dwc.run(dwcArgs, printTime: printTime,
- shouldPrint: shouldPrint));
- if (machineFormat) {
- lastTask = lastTask.then((res) {
- appendMessage(Map jsonMessage) {
- var message = JSON.encode([jsonMessage]);
- if (shouldPrint) print(message);
- res.messages.add(message);
- }
- return res;
- });
- }
- tasks.add(lastTask);
- }
- }
- return tasks.future.then((r) => r.where((v) => v != null));
- }, printTime: printTime, useColors: useColors);
-}
-
-/** Process the command-line arguments. */
-ArgResults _processArgs(List<String> arguments) {
- var parser = new ArgParser()
- ..addOption("changed", help: "the file has changed since the last build",
- allowMultiple: true)
- ..addOption("removed", help: "the file was removed since the last build",
- allowMultiple: true)
- ..addFlag("clean", negatable: false, help: "currently a noop, may be used "
- "in the future to remove any build artifacts")
- ..addFlag("full", negatable: false, help: "perform a full build")
- ..addFlag("machine", negatable: false,
- help: "produce warnings in a machine parseable format")
- ..addFlag("help", abbr: 'h',
- negatable: false, help: "displays this help and exit");
- var args = parser.parse(arguments);
- if (args["help"]) {
- print('A build script that invokes the web-ui compiler (dwc).');
- print('Usage: dart build.dart [options] [-- [dwc-options]]');
- print('\nThese are valid options expected by build.dart:');
- print(parser.getUsage());
- print('\nThese are valid options expected by dwc:');
- dwc.run(['-h']).then((_) => exit(0));
- }
- return args;
+ return builder.build(
+ entryPoints: entryPoints, options: parseOptions(arguments));
}
« no previous file with comments | « pkg/polymer/lib/builder.dart ('k') | pkg/polymer/lib/deploy.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698