| 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);
|
| +}
|
|
|