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

Side by Side Diff: pkg/dev_compiler/lib/src/compiler/command.dart

Issue 2836483002: Snapshot DDC trained on itself (Closed)
Patch Set: Test/fix for windows Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:io'; 5 import 'dart:io';
6 import 'package:analyzer/src/command_line/arguments.dart' 6 import 'package:analyzer/src/command_line/arguments.dart'
7 show 7 show
8 defineAnalysisArguments, 8 defineAnalysisArguments,
9 filterUnknownArguments, 9 filterUnknownArguments,
10 ignoreUnrecognizedFlagsFlag; 10 ignoreUnrecognizedFlagsFlag;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 _usageException('Number of output files (${outPaths.length}) must match ' 154 _usageException('Number of output files (${outPaths.length}) must match '
155 'number of module formats (${moduleFormats.length}).'); 155 'number of module formats (${moduleFormats.length}).');
156 } 156 }
157 157
158 // TODO(jmesserly): for now the first one is special. This will go away once 158 // TODO(jmesserly): for now the first one is special. This will go away once
159 // we've removed the "root" and "module name" variables. 159 // we've removed the "root" and "module name" variables.
160 var firstOutPath = outPaths[0]; 160 var firstOutPath = outPaths[0];
161 161
162 var libraryRoot = argResults['library-root'] as String; 162 var libraryRoot = argResults['library-root'] as String;
163 if (libraryRoot != null) { 163 if (libraryRoot != null) {
164 libraryRoot = path.absolute(libraryRoot); 164 libraryRoot = path.canonicalize(libraryRoot);
165 } else { 165 } else {
166 libraryRoot = Directory.current.path; 166 libraryRoot = Directory.current.path;
167 } 167 }
168 var moduleRoot = argResults['module-root'] as String; 168 var moduleRoot = argResults['module-root'] as String;
169 String modulePath; 169 String modulePath;
170 if (moduleRoot != null) { 170 if (moduleRoot != null) {
171 moduleRoot = path.absolute(moduleRoot); 171 moduleRoot = path.canonicalize(moduleRoot);
172 if (!path.isWithin(moduleRoot, firstOutPath)) { 172 if (!path.isWithin(moduleRoot, firstOutPath)) {
173 _usageException('Output file $firstOutPath must be within the module ' 173 _usageException('Output file $firstOutPath must be within the module '
174 'root directory $moduleRoot'); 174 'root directory $moduleRoot');
175 } 175 }
176 modulePath = 176 modulePath =
177 path.withoutExtension(path.relative(firstOutPath, from: moduleRoot)); 177 path.withoutExtension(path.relative(firstOutPath, from: moduleRoot));
178 } else { 178 } else {
179 moduleRoot = path.dirname(firstOutPath); 179 moduleRoot = path.dirname(firstOutPath);
180 modulePath = path.basenameWithoutExtension(firstOutPath); 180 modulePath = path.basenameWithoutExtension(firstOutPath);
181 } 181 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 254 }
255 255
256 void _usageException(String message) { 256 void _usageException(String message) {
257 throw new UsageException(message, _usageMessage); 257 throw new UsageException(message, _usageMessage);
258 } 258 }
259 259
260 /// Thrown when the input source code has errors. 260 /// Thrown when the input source code has errors.
261 class CompileErrorException implements Exception { 261 class CompileErrorException implements Exception {
262 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; 262 toString() => '\nPlease fix all errors before compiling (warnings are okay).';
263 } 263 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698