| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | |
| 3 # for details. All rights reserved. Use of this source code is governed by a | |
| 4 # BSD-style license that can be found in the LICENSE file. | |
| 5 | |
| 6 # Traverses apidoc and dartdoc and lists all possible input files that are | |
| 7 # used when building API documentation. Used by gyp to determine when apidocs | |
| 8 # need to be regenerated (see `apidoc.gyp`). | |
| 9 | |
| 10 # TODO(rnystrom): Port this to dart. It can be run before dart has been built | |
| 11 # (which is when this script is invoked by gyp) by using the prebuild dart in | |
| 12 # tools/testing/bin. | |
| 13 | |
| 14 import os | |
| 15 import sys | |
| 16 | |
| 17 def handle_walk(root, directories, files, start): | |
| 18 for filename in files: | |
| 19 if filename.endswith(( | |
| 20 '.css', '.dart', '.ico', '.js', '.json', '.png', '.sh', '.txt')): | |
| 21 print os.path.relpath(os.path.join(root, filename), start=start) | |
| 22 | |
| 23 | |
| 24 def main(argv): | |
| 25 if len(argv) == 1: | |
| 26 dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), | |
| 27 os.pardir, os.pardir, os.pardir) | |
| 28 else: | |
| 29 dir = argv[1] | |
| 30 start = os.path.join(dir, 'utils', 'apidoc') | |
| 31 for root, directories, files in os.walk(os.path.join(dir, 'utils', 'apidoc')): | |
| 32 handle_walk(root, directories, files, start) | |
| 33 for root, directories, files in os.walk(os.path.join(dir, 'lib', 'dartdoc')): | |
| 34 handle_walk(root, directories, files, start) | |
| 35 | |
| 36 if __name__ == '__main__': | |
| 37 sys.exit(main(sys.argv)) | |
| OLD | NEW |