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

Unified Diff: sdk/lib/_internal/dartdoc/bin/dartdoc.dart

Issue 13990004: Revert "Attempt to re-commit Dartdoc exports." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/bin/dartdoc ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/dartdoc/bin/dartdoc.dart
diff --git a/sdk/lib/_internal/dartdoc/bin/dartdoc.dart b/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
index 0616f0add4a1c1a31fbffb21be7c7e452d046283..ec63c06ccb4a1df099eec7d87041f68e9f5807e3 100644
--- a/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/bin/dartdoc.dart
@@ -18,11 +18,9 @@ library dartdoc;
import 'dart:async';
import 'dart:io';
-import 'dart:uri';
// TODO(rnystrom): Use "package:" URL (#4968).
import '../lib/dartdoc.dart';
-import '../lib/src/dartdoc/utils.dart';
import 'package:args/args.dart';
import 'package:pathos/path.dart' as path;
@@ -41,7 +39,7 @@ main() {
final Path libPath = scriptDir.append('../../../../');
- String packageRoot;
+ Path packageRoot;
argParser.addFlag('no-code',
help: 'Do not include source code in the documentation.',
@@ -168,7 +166,7 @@ main() {
' the entrypoint.',
callback: (packageDir) {
if(packageDir != null) {
- packageRoot = packageDir;
+ packageRoot = new Path(packageDir);
}
});
@@ -177,7 +175,7 @@ main() {
help: 'Deprecated: same as --package-root.',
callback: (packageDir) {
if(packageDir != null) {
- packageRoot = packageDir;
+ packageRoot = new Path(packageDir);
}
});
@@ -190,22 +188,21 @@ main() {
exit(1);
}
- final entrypoints = <Uri>[];
+ final entrypoints = <Path>[];
try {
final option = argParser.parse(args);
// This checks to see if the root of all entrypoints is the same.
// If it is not, then we display a warning, as package imports might fail.
var entrypointRoot;
- for (final entrypoint in option.rest) {
- var uri = Uri.parse(entrypoint);
- if (uri.scheme == '') uri = pathToFileUri(entrypoint);
- entrypoints.add(uri);
+ for(final arg in option.rest) {
+ var entrypoint = new Path(arg);
+ entrypoints.add(entrypoint);
- if (uri.scheme != 'file') continue;
if (entrypointRoot == null) {
- entrypointRoot = path.dirname(entrypoint);
- } else if (entrypointRoot != path.dirname(entrypoint)) {
+ entrypointRoot = entrypoint.directoryPath;
+ } else if (entrypointRoot.toNativePath() !=
+ entrypoint.directoryPath.toNativePath()) {
print('Warning: entrypoints are at different directories. "package:"'
' imports may fail.');
}
@@ -223,7 +220,25 @@ main() {
exit(1);
}
- if (packageRoot == null) packageRoot = _getPackageRoot(entrypoints);
+ if (packageRoot == null) {
+ // Check if there's a `packages` directory in the entry point directory.
+ var script = path.normalize(path.absolute(entrypoints[0].toNativePath()));
+ var dir = path.join(path.dirname(script), 'packages/');
+ if (new Directory(dir).existsSync()) {
+ // TODO(amouravski): convert all of dartdoc to use pathos.
+ packageRoot = new Path(dir);
+ } else {
+ // If there is not, then check if the entrypoint is somewhere in a `lib`
+ // directory.
+ dir = path.dirname(script);
+ var parts = path.split(dir);
+ var libDir = parts.lastIndexOf('lib');
+ if (libDir > 0) {
+ packageRoot = new Path(path.join(path.joinAll(parts.take(libDir)),
+ 'packages'));
+ }
+ }
+ }
cleanOutputDirectory(dartdoc.outputDir);
@@ -252,25 +267,3 @@ main() {
})
.whenComplete(() => dartdoc.cleanup());
}
-
-String _getPackageRoot(List<Uri> entrypoints) {
- // Check if there's a `packages` directory in the entry point directory.
- var fileEntrypoint = entrypoints.firstWhere(
- (entrypoint) => entrypoint.scheme == 'file',
- orElse: () => null);
- if (fileEntrypoint == null) return;
-
- var script = path.normalize(path.absolute(fileUriToPath(fileEntrypoint)));
- var dir = path.join(path.dirname(script), 'packages/');
- if (new Directory(dir).existsSync()) return dir;
-
- // If there is not, then check if the entrypoint is somewhere in a `lib`
- // directory.
- var parts = path.split(path.dirname(script));
- var libDir = parts.lastIndexOf('lib');
- if (libDir > 0) {
- return path.join(path.joinAll(parts.take(libDir)), 'packages');
- } else {
- return null;
- }
-}
« no previous file with comments | « sdk/bin/dartdoc ('k') | sdk/lib/_internal/dartdoc/lib/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698