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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/command_deploy.dart

Issue 15741021: Get deploy tests working on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/deploy/compiles_dart_entrypoints_to_dart_and_js_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library command_deploy; 5 library command_deploy;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:analyzer_experimental/analyzer.dart'; 10 import 'package:analyzer_experimental/analyzer.dart';
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if (!dirExists(source)) { 42 if (!dirExists(source)) {
43 throw new ApplicationException("There is no '$source' directory."); 43 throw new ApplicationException("There is no '$source' directory.");
44 } 44 }
45 45
46 return entrypoint.packageFiles(beneath: source).then((files) { 46 return entrypoint.packageFiles(beneath: source).then((files) {
47 log.message("Finding entrypoints..."); 47 log.message("Finding entrypoints...");
48 _findEntrypoints(files); 48 _findEntrypoints(files);
49 _computeLogSize(); 49 _computeLogSize();
50 50
51 cleanDir(target); 51 cleanDir(target);
52 _logAction("Copying", "${path.relative(source)}/", 52 _logAction("Copying", "${path.relative(source)}${path.separator}",
53 "${path.relative(target)}/"); 53 "${path.relative(target)}${path.separator}");
54 copyFiles(files.where((file) => path.extension(file) != '.dart'), 54 copyFiles(files.where((file) => path.extension(file) != '.dart'),
55 source, target); 55 source, target);
56 56
57 return Future.forEach(_entrypoints, (sourceFile) { 57 return Future.forEach(_entrypoints, (sourceFile) {
58 var targetFile = 58 var targetFile =
59 path.join(target, path.relative(sourceFile, from: source)); 59 path.join(target, path.relative(sourceFile, from: source));
60 var relativeTargetFile = path.relative(targetFile); 60 var relativeTargetFile = path.relative(targetFile);
61 var relativeSourceFile = path.relative(sourceFile); 61 var relativeSourceFile = path.relative(sourceFile);
62 62
63 ensureDir(path.dirname(targetFile)); 63 ensureDir(path.dirname(targetFile));
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 /// Computes the maximum widths of words that will be used in log output for 100 /// Computes the maximum widths of words that will be used in log output for
101 /// the deploy command so we know how much padding to add when printing them. 101 /// the deploy command so we know how much padding to add when printing them.
102 /// This should only be run after [_findEntrypoints]. 102 /// This should only be run after [_findEntrypoints].
103 void _computeLogSize() { 103 void _computeLogSize() {
104 _maxVerbLength = ["Copying", "Compiling"] 104 _maxVerbLength = ["Copying", "Compiling"]
105 .map((verb) => verb.length).reduce(math.max); 105 .map((verb) => verb.length).reduce(math.max);
106 var sourceLengths = new List.from( 106 var sourceLengths = new List.from(
107 _entrypoints.map((file) => path.relative(file).length)) 107 _entrypoints.map((file) => path.relative(file).length))
108 ..add("${path.relative(source)}/".length); 108 ..add("${path.relative(source)}${path.separator}".length);
109 if (_shouldAddDartJs) sourceLengths.add("package:browser/dart.js".length); 109 if (_shouldAddDartJs) sourceLengths.add("package:browser/dart.js".length);
110 _maxSourceLength = sourceLengths.reduce(math.max); 110 _maxSourceLength = sourceLengths.reduce(math.max);
111 } 111 }
112 112
113 /// Log a deployment action. This should only be run after [_computeLogSize]. 113 /// Log a deployment action. This should only be run after [_computeLogSize].
114 void _logAction(String verb, String source, String target) { 114 void _logAction(String verb, String source, String target) {
115 verb = padRight(verb, _maxVerbLength); 115 verb = padRight(verb, _maxVerbLength);
116 source = padRight(source, _maxSourceLength); 116 source = padRight(source, _maxSourceLength);
117 log.message("$verb $source $_arrow $target"); 117 log.message("$verb $source $_arrow $target");
118 } 118 }
(...skipping 13 matching lines...) Expand all
132 } 132 }
133 133
134 /// Whether we should copy the browser package's dart.js file into the 134 /// Whether we should copy the browser package's dart.js file into the
135 /// deployed app. 135 /// deployed app.
136 bool get _shouldAddDartJs { 136 bool get _shouldAddDartJs {
137 return !_entrypoints.isEmpty && 137 return !_entrypoints.isEmpty &&
138 entrypoint.root.dependencies.any((dep) => 138 entrypoint.root.dependencies.any((dep) =>
139 dep.name == 'browser' && dep.source == 'hosted'); 139 dep.name == 'browser' && dep.source == 'hosted');
140 } 140 }
141 } 141 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/pub/test/deploy/compiles_dart_entrypoints_to_dart_and_js_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698