| Index: pkg/polymer/lib/component_build.dart
|
| diff --git a/pkg/polymer/lib/component_build.dart b/pkg/polymer/lib/component_build.dart
|
| index 316124eb45feb2614fb2f3e12b31841d9e559988..6766152b51b600ba2466e23c446f6c285286169d 100644
|
| --- a/pkg/polymer/lib/component_build.dart
|
| +++ b/pkg/polymer/lib/component_build.dart
|
| @@ -32,8 +32,7 @@ import 'src/compiler_options.dart';
|
| * [entryPoints] listed. On clean commands, the directory where [entryPoints]
|
| * live will be scanned for generated files to delete them.
|
| */
|
| -// TODO(jmesserly): we need a better way to automatically detect input files
|
| -Future<List<dwc.CompilerResult>> build(List<String> arguments,
|
| +Future<List<dwc.AnalysisResult>> build(List<String> arguments,
|
| List<String> entryPoints,
|
| {bool printTime: true, bool shouldPrint: true}) {
|
| bool useColors = stdioType(stdout) == StdioType.TERMINAL;
|
| @@ -54,29 +53,11 @@ Future<List<dwc.CompilerResult>> build(List<String> arguments,
|
|
|
| var options = CompilerOptions.parse(args.rest, checkUsage: false);
|
|
|
| - // [outputOnlyDirs] contains directories known to only have output files.
|
| - // When outputDir is not specified, we create a new directory which only
|
| - // contains output files. If options.outputDir is specified, we don't know
|
| - // if the output directory may also have input files. In which case,
|
| - // [_handleCleanCommand] and [_isInputFile] are more conservative.
|
| - //
|
| - // TODO(sigmund): get rid of this. Instead, use the compiler to understand
|
| - // which files are input or output files.
|
| - var outputOnlyDirs = options.outputDir == null ? []
|
| - : entryPoints.map((e) => _outDir(e)).toList();
|
| -
|
| - if (cleanBuild) {
|
| - _handleCleanCommand(outputOnlyDirs);
|
| - } else if (fullBuild
|
| - || changedFiles.any((f) => _isInputFile(f, outputOnlyDirs))
|
| - || removedFiles.any((f) => _isInputFile(f, outputOnlyDirs))) {
|
| + 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');
|
| - // We'll set 'out/' as the out folder, unless an output directory was
|
| - // already specified in the command line.
|
| - if (options.outputDir == null) dwcArgs.addAll(['-o', _outDir(file)]);
|
| dwcArgs.add(file);
|
| // Chain tasks to that we run one at a time.
|
| lastTask = lastTask.then((_) => dwc.run(dwcArgs, printTime: printTime,
|
| @@ -88,16 +69,6 @@ Future<List<dwc.CompilerResult>> build(List<String> arguments,
|
| if (shouldPrint) print(message);
|
| res.messages.add(message);
|
| }
|
| - // Print for the Editor messages about mappings and generated files
|
| - res.outputs.forEach((out, input) {
|
| - if (out.endsWith(".html") && input != null) {
|
| - appendMessage({
|
| - "method": "mapping",
|
| - "params": {"from": input, "to": out},
|
| - });
|
| - }
|
| - appendMessage({"method": "generated", "params": {"file": out}});
|
| - });
|
| return res;
|
| });
|
| }
|
| @@ -108,38 +79,6 @@ Future<List<dwc.CompilerResult>> build(List<String> arguments,
|
| }, printTime: printTime, useColors: useColors);
|
| }
|
|
|
| -String _outDir(String file) => path.join(path.dirname(file), 'out');
|
| -
|
| -/** Tell whether [filePath] is a generated file. */
|
| -bool _isGeneratedFile(String filePath, List<String> outputOnlyDirs) {
|
| - var dirPrefix = path.dirname(filePath);
|
| - for (var outDir in outputOnlyDirs) {
|
| - if (dirPrefix.startsWith(outDir)) return true;
|
| - }
|
| - return path.basename(filePath).startsWith('_');
|
| -}
|
| -
|
| -/** Tell whether [filePath] is an input file. */
|
| -bool _isInputFile(String filePath, List<String> outputOnlyDirs) {
|
| - var ext = path.extension(filePath);
|
| - return (ext == '.dart' || ext == '.html') &&
|
| - !_isGeneratedFile(filePath, outputOnlyDirs);
|
| -}
|
| -
|
| -/**
|
| - * Delete all generated files. Currently we only delete files under directories
|
| - * that are known to contain only generated code.
|
| - */
|
| -void _handleCleanCommand(List<String> outputOnlyDirs) {
|
| - for (var dirPath in outputOnlyDirs) {
|
| - var dir = new Directory(dirPath);
|
| - if (!dir.existsSync()) continue;
|
| - for (var f in dir.listSync(recursive: false)) {
|
| - if (f is File && _isGeneratedFile(f.path, outputOnlyDirs)) f.deleteSync();
|
| - }
|
| - }
|
| -}
|
| -
|
| /** Process the command-line arguments. */
|
| ArgResults _processArgs(List<String> arguments) {
|
| var parser = new ArgParser()
|
| @@ -147,7 +86,8 @@ ArgResults _processArgs(List<String> arguments) {
|
| allowMultiple: true)
|
| ..addOption("removed", help: "the file was removed since the last build",
|
| allowMultiple: true)
|
| - ..addFlag("clean", negatable: false, help: "remove any build artifacts")
|
| + ..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")
|
|
|