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

Side by Side Diff: mojo/public/tools/dart_list_mojoms.py

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « mojo/public/tools/dart_analyze.py ('k') | mojo/public/tools/dart_list_packages_contents.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved. 2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # This script scans a directory tree for any .mojom files and outputs a list of 6 # This script scans a directory tree for any .mojom files and outputs a list.
7 # .mojom.dart files.
8 7
9 import argparse 8 import argparse
10 import os 9 import os
11 import sys 10 import sys
12 11
13 def main(args): 12 def main(args):
14 parser = argparse.ArgumentParser( 13 parser = argparse.ArgumentParser(
15 description='Prints list of generated dart binding source files.') 14 description='Prints list of generated dart binding source files.')
16 parser.add_argument('source_directory', 15 parser.add_argument('source_directory',
17 metavar='source_directory', 16 metavar='source_directory',
18 help='Path to source directory tree containing .mojom' 17 help='Path to source directory tree containing .mojom'
19 ' files') 18 ' files')
20 parser.add_argument('relative_directory_root', 19 parser.add_argument('relative_directory_root',
21 metavar='relative_directory_root', 20 metavar='relative_directory_root',
22 help='Path to directory which all outputted paths will' 21 help='Path to directory which all outputted paths will'
23 'be relative to.') 22 'be relative to.')
24 args = parser.parse_args() 23 args = parser.parse_args()
25 # Directory to start searching for .mojom files. 24 # Directory to start searching for .mojom files.
26 source_directory = args.source_directory 25 source_directory = args.source_directory
27 # Prefix to chop off output. 26 # Prefix to chop off output.
28 root_prefix = os.path.abspath(args.relative_directory_root) 27 root_prefix = os.path.abspath(args.relative_directory_root)
29 for dirname, _, filenames in os.walk(source_directory): 28 for dirname, _, filenames in os.walk(source_directory):
30 # filter for .mojom.dart files. 29 # filter for .mojom files.
31 filenames = [f for f in filenames if f.endswith('.mojom')] 30 filenames = [f for f in filenames if f.endswith('.mojom')]
32 for f in filenames: 31 for f in filenames:
33 # Ignore tests.
34 if dirname.endswith('tests'):
35 continue;
36 path = os.path.abspath(os.path.join(dirname, f)) 32 path = os.path.abspath(os.path.join(dirname, f))
37 path = os.path.relpath(path, root_prefix) 33 path = os.path.relpath(path, root_prefix)
38 # Append .dart.
39 path += '.dart'
40 print(path) 34 print(path)
41 35
42 if __name__ == '__main__': 36 if __name__ == '__main__':
43 sys.exit(main(sys.argv[1:])) 37 sys.exit(main(sys.argv[1:]))
44 38
OLDNEW
« no previous file with comments | « mojo/public/tools/dart_analyze.py ('k') | mojo/public/tools/dart_list_packages_contents.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698