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

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

Issue 16364004: Add dartdoc to the generated utils snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed editor tests. Created 7 years, 6 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
Index: sdk/lib/_internal/dartdoc/lib/dartdoc.dart
diff --git a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
index dfc0f457bde7c3b2608f2be37d42e7af33a4fc03..76638b97527cf89a6617679fb58e9e20f2f28a69 100644
--- a/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
+++ b/sdk/lib/_internal/dartdoc/lib/dartdoc.dart
@@ -783,30 +783,47 @@ class Dartdoc {
endFile();
}
+ /// Whether dartdoc is running from within the Dart SDK or the
+ /// Dart source repository.
+ bool get runningFromSdk => pathos.extension(new Options().script) ==
+ '.snapshot';
nweiz 2013/06/04 22:54:00 This overflow is kind of ugly. Just put the entire
Andrei Mouravski 2013/06/05 00:18:49 Done.
+
+ /// Gets the path to the root directory of the SDK.
+ String get rootDirectory {
+ return pathos.dirname(pathos.dirname(new Options().executable));
nweiz 2013/06/04 22:54:00 Style nit: use "=>"
Andrei Mouravski 2013/06/05 00:18:49 Done.
+ }
+
+ /// Gets the path to the dartdoc directory normalized for running in different
+ /// places.
nweiz 2013/06/04 22:54:00 What is "the dartdoc directory"? The directory con
Andrei Mouravski 2013/06/05 00:18:49 Done.
+ String get normalizedDartdocPath => runningFromSdk ?
nweiz 2013/06/04 22:54:00 Why aren't you using this in bin/dartdoc to get at
Andrei Mouravski 2013/06/05 00:18:49 Done.
+ pathos.join(rootDirectory, 'lib', '_internal', 'dartdoc') :
+ dartdocPath.toString();
+
+ String get tmpPath => pathos.join(normalizedDartdocPath, 'tmp');
dgrove 2013/06/04 22:51:42 How will this work in the SDK when dart-sdk/lib/_i
nweiz 2013/06/04 22:54:00 Document this. Also, why is your temp path in you
Andrei Mouravski 2013/06/05 00:18:49 Will be addressed in next CL.
Andrei Mouravski 2013/06/05 00:18:49 Done.
+
void docNavigationDart() {
- final dir = new Directory.fromPath(tmpPath);
- if (!dir.existsSync()) {
+ var tmpDir = new Directory(tmpPath);
+ if (!tmpDir.existsSync()) {
// TODO(3914): Hack to avoid 'file already exists' exception
// thrown due to invalid result from dir.existsSync() (probably due to
// race conditions).
try {
- dir.createSync();
+ tmpDir.createSync();
} on DirectoryIOException catch (e) {
// Ignore.
}
}
String jsonString = json.stringify(createNavigationInfo());
String dartString = jsonString.replaceAll(r"$", r"\$");
- final filePath = tmpPath.append('nav.dart');
- writeString(new File.fromPath(filePath),
+
+ var navPath = pathos.join(tmpPath, 'nav.dart');
+ writeString(new File(navPath),
'''part of client;
- get json => $dartString;''');
+ get json => $dartString;''');
}
- Path get tmpPath => dartdocPath.append('tmp');
-
void cleanup() {
- final dir = new Directory.fromPath(tmpPath);
+ final dir = new Directory(tmpPath);
if (dir.existsSync()) {
dir.deleteSync(recursive: true);
}

Powered by Google App Engine
This is Rietveld 408576698