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

Unified Diff: utils/apidoc/scripts/list_files.dart

Issue 9705088: Generate API docs during build. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix arg parsing. Created 8 years, 9 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: utils/apidoc/scripts/list_files.dart
diff --git a/utils/apidoc/scripts/list_files.dart b/utils/apidoc/scripts/list_files.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e62a8254aa2c5b9e10f296d4fa3f5431a2454952
--- /dev/null
+++ b/utils/apidoc/scripts/list_files.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/**
+ * Traverses apidoc and dartdoc and lists all possible input files that are
+ * used when building API documentation. Used by gyp to determine when apidocs
+ * need to be regenerated (see `apidoc.gyp`).
+ */
+#library('list_files');
+
+#import('dart:io');
+
+final allowedExtensions = const [
+ '.css', '.dart', '.ico', '.js', '.json', '.png', '.sh', '.txt'
+];
+
+void main() {
+ final scriptDir = new File(new Options().script).directorySync().path;
+ final dartDir = '$scriptDir/../../../';
+ listFiles('$dartDir/utils/apidoc');
+ listFiles('$dartDir/lib/dartdoc');
+}
+
+void listFiles(String dirPath) {
+ final dir = new Directory(dirPath);
+
+ dir.onFile = (path) {
+ if (allowedExtensions.indexOf(extension(path)) != -1) {
+ print(path);
+ }
+ };
+
+ dir.list(recursive: true);
+}
+
+String extension(String path) {
+ int lastDot = path.lastIndexOf('.');
+ if (lastDot == -1) return '';
+
+ return path.substring(lastDot);
+}

Powered by Google App Engine
This is Rietveld 408576698