| OLD | NEW |
| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 } | 214 } |
| 215 | 215 |
| 216 String _moduleForLibrary( | 216 String _moduleForLibrary( |
| 217 String moduleRoot, Source source, CompilerOptions compilerOpts) { | 217 String moduleRoot, Source source, CompilerOptions compilerOpts) { |
| 218 if (source is InSummarySource) { | 218 if (source is InSummarySource) { |
| 219 var summaryPath = source.summaryPath; | 219 var summaryPath = source.summaryPath; |
| 220 var ext = '.${compilerOpts.summaryExtension}'; | 220 var ext = '.${compilerOpts.summaryExtension}'; |
| 221 if (path.isWithin(moduleRoot, summaryPath) && summaryPath.endsWith(ext)) { | 221 if (path.isWithin(moduleRoot, summaryPath) && summaryPath.endsWith(ext)) { |
| 222 var buildUnitPath = | 222 var buildUnitPath = |
| 223 summaryPath.substring(0, summaryPath.length - ext.length); | 223 summaryPath.substring(0, summaryPath.length - ext.length); |
| 224 return path.relative(buildUnitPath, from: moduleRoot); | 224 return path.url |
| 225 .joinAll(path.split(path.relative(buildUnitPath, from: moduleRoot))); |
| 225 } | 226 } |
| 226 | 227 |
| 227 _usageException('Imported file ${source.uri} is not within the module root ' | 228 _usageException('Imported file ${source.uri} is not within the module root ' |
| 228 'directory $moduleRoot'); | 229 'directory $moduleRoot'); |
| 229 } | 230 } |
| 230 | 231 |
| 231 _usageException( | 232 _usageException( |
| 232 'Imported file "${source.uri}" was not found as a summary or source ' | 233 'Imported file "${source.uri}" was not found as a summary or source ' |
| 233 'file. Please pass in either the summary or the source file ' | 234 'file. Please pass in either the summary or the source file ' |
| 234 'for this import.'); | 235 'for this import.'); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 254 } | 255 } |
| 255 | 256 |
| 256 void _usageException(String message) { | 257 void _usageException(String message) { |
| 257 throw new UsageException(message, _usageMessage); | 258 throw new UsageException(message, _usageMessage); |
| 258 } | 259 } |
| 259 | 260 |
| 260 /// Thrown when the input source code has errors. | 261 /// Thrown when the input source code has errors. |
| 261 class CompileErrorException implements Exception { | 262 class CompileErrorException implements Exception { |
| 262 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; | 263 toString() => '\nPlease fix all errors before compiling (warnings are okay).'; |
| 263 } | 264 } |
| OLD | NEW |