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

Unified Diff: sdk/lib/_internal/pub/lib/src/command/build.dart

Issue 219333008: Allow configuring build directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix year. Created 6 years, 9 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 | « no previous file | sdk/lib/_internal/pub/lib/src/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/command/build.dart
diff --git a/sdk/lib/_internal/pub/lib/src/command/build.dart b/sdk/lib/_internal/pub/lib/src/command/build.dart
index 51aba71c47495f5977e69ca756389bd25067db9f..61e46ef142657d4e0177b530ecb64b38bf03f7e6 100644
--- a/sdk/lib/_internal/pub/lib/src/command/build.dart
+++ b/sdk/lib/_internal/pub/lib/src/command/build.dart
@@ -24,9 +24,8 @@ class BuildCommand extends BarbackCommand {
String get usage => "pub build [options] [directories...]";
List<String> get aliases => const ["deploy", "settle-up"];
- // TODO(nweiz): make this configurable.
/// The path to the application's build output directory.
- String get target => 'build';
+ String get outputDirectory => commandOptions["output"];
BarbackMode get defaultMode => BarbackMode.RELEASE;
@@ -39,10 +38,14 @@ class BuildCommand extends BarbackCommand {
commandParser.addOption("format",
help: "How output should be displayed.",
allowed: ["text", "json"], defaultsTo: "text");
+
+ commandParser.addOption("output", abbr: "o",
+ help: "Directory to write build outputs to.",
+ defaultsTo: "build");
}
Future onRunTransformerCommand() {
- cleanDir(target);
+ cleanDir(outputDirectory);
var errorsJson = [];
var logJson = [];
@@ -93,11 +96,11 @@ class BuildCommand extends BarbackCommand {
return Future.wait(assets.map(_writeAsset)).then((_) {
builtFiles += _copyBrowserJsFiles(dart2JSEntrypoints);
log.message('Built $builtFiles ${pluralize('file', builtFiles)} '
- 'to "$target".');
+ 'to "$outputDirectory".');
log.json.message({
"buildResult": "success",
- "outputDirectory": target,
+ "outputDirectory": outputDirectory,
"numFiles": builtFiles,
"log": logJson
});
@@ -189,7 +192,7 @@ class BuildCommand extends BarbackCommand {
/// directory.
Future _writeOutputFile(Asset asset, String relativePath) {
builtFiles++;
- var destPath = path.join(target, relativePath);
+ var destPath = path.join(outputDirectory, relativePath);
ensureDir(path.dirname(destPath));
return createFileFromStream(asset.read(), destPath);
}
@@ -232,7 +235,7 @@ class BuildCommand extends BarbackCommand {
/// under `packages/browser/`.
void _addBrowserJs(String directory, String name) {
var jsPath = path.join(entrypoint.root.dir,
- target, directory, 'packages', 'browser', '$name.js');
+ outputDirectory, directory, 'packages', 'browser', '$name.js');
ensureDir(path.dirname(jsPath));
// TODO(rnystrom): This won't work if we get rid of symlinks and the top
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/lib/src/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698