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

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

Issue 23445009: Prune the old deploy code. This CL does a few changes: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
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..5757187a4e38c41fa93774633176361f15da2913 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()

Powered by Google App Engine
This is Rietveld 408576698