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

Unified Diff: pkg/docgen/lib/docgen.dart

Issue 19695013: "Reverting 25378" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | pkg/docgen/test/single_library_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/docgen.dart
diff --git a/pkg/docgen/lib/docgen.dart b/pkg/docgen/lib/docgen.dart
index aa8cb12275508584504641c3d0d05d13b9c893a1..59c4b963b8334279cb9db2a2a70448430c5fe4ab 100644
--- a/pkg/docgen/lib/docgen.dart
+++ b/pkg/docgen/lib/docgen.dart
@@ -83,7 +83,7 @@ Future<bool> docgen(List<String> files, {String packageRoot,
linkResolver = (name) =>
fixReference(name, _currentLibrary, _currentClass, _currentMember);
- return getMirrorSystem(files, packageRoot: packageRoot, parseSdk: parseSdk)
+ return getMirrorSystem(files, packageRoot, parseSdk: parseSdk)
.then((MirrorSystem mirrorSystem) {
if (mirrorSystem.libraries.isEmpty) {
throw new StateError('No library mirrors were created.');
@@ -119,8 +119,7 @@ List<String> _listDartFromDir(String args) {
// containing '/packages' will be added. The only exception is if the file to
// analyze already has a '/package' in its path.
return files.where((f) => f.endsWith('.dart') &&
- (!f.contains('${path.separator}packages') ||
- args.contains('${path.separator}packages'))).toList()
+ (!f.contains('/packages') || args.contains('/packages'))).toList()
..forEach((lib) => logger.info('Added to libraries: $lib'));
}
@@ -128,9 +127,9 @@ String _findPackageRoot(String directory) {
var files = listDir(directory, recursive: true);
// Return '' means that there was no pubspec.yaml and therefor no packageRoot.
String packageRoot = files.firstWhere((f) =>
- f.endsWith('${path.separator}pubspec.yaml'), orElse: () => '');
+ f.endsWith('/pubspec.yaml'), orElse: () => '');
if (packageRoot != '') {
- packageRoot = path.join(path.dirname(packageRoot), 'packages');
+ packageRoot = path.dirname(packageRoot) + '/packages';
}
return packageRoot;
}
@@ -150,8 +149,8 @@ List<String> _listSdk() {
* Analyzes set of libraries by getting a mirror system and triggers the
* documentation of the libraries.
*/
-Future<MirrorSystem> getMirrorSystem(List<String> args, {String packageRoot,
- bool parseSdk:false}) {
+Future<MirrorSystem> getMirrorSystem(List<String> args, String packageRoot,
+ {bool parseSdk:false}) {
var libraries = !parseSdk ? _listLibraries(args) : _listSdk();
if (libraries.isEmpty) throw new StateError('No Libraries.');
// DART_SDK should be set to the root of the SDK library.
@@ -161,10 +160,10 @@ Future<MirrorSystem> getMirrorSystem(List<String> args, {String packageRoot,
} else {
// If DART_SDK is not defined in the environment,
// assuming the dart executable is from the Dart SDK folder inside bin.
- sdkRoot = path.join(path.dirname(path.dirname(path.dirname(path.dirname(
- path.absolute(new Options().script))))), 'sdk');
+ sdkRoot = path.dirname(path.dirname(new Options().executable));
logger.info('SDK Root: ${sdkRoot}');
}
+
return _analyzeLibraries(libraries, sdkRoot, packageRoot: packageRoot);
}
@@ -181,10 +180,10 @@ Future<MirrorSystem> _analyzeLibraries(List<String> libraries,
SourceFileProvider provider = new SourceFileProvider();
api.DiagnosticHandler diagnosticHandler =
new FormattingDiagnosticHandler(provider).diagnosticHandler;
- Uri libraryUri = new Uri(scheme: 'file', path: appendSlash(libraryRoot));
+ Uri libraryUri = currentDirectory.resolve(appendSlash('$libraryRoot'));
Uri packageUri = null;
if (packageRoot != null) {
- packageUri = new Uri(scheme: 'file', path: appendSlash(packageRoot));
+ packageUri = currentDirectory.resolve(appendSlash('$packageRoot'));
}
List<Uri> librariesUri = <Uri>[];
libraries.forEach((library) {
« no previous file with comments | « no previous file | pkg/docgen/test/single_library_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698