21 depfile = argv[1]
22 directory = argv[2]
23 if not os.path.isabs(directory):
24 directory = os.path.realpath(directory)
25
26 pattern = None
28 pattern = re.compile(argv[3])
29
30
31 out = open(depfile, 'w')
32 out.write(os.path.relpath(depfile))
33 out.write(":")
34
35 for root, directories, files in os.walk(directory):
36
37 for skip_dir in ['.git', 'gen', 'test']:
38 if skip_dir in directories:
39 directories.remove(skip_dir)
40
41
42
43 if pattern and root == directory:
44 directories[:] = filter(pattern.match, directories)
45
46 for filename in files:
47 if filename.endswith(
48 '.dart') and not filename.endswith('_test.dart'):
49 fullname = os.path.join(directory, root, filename)
50 fullname = fullname.replace(os.sep, '/')
51 out.write(" \"")
52 out.write(fullname)
53 out.write("\"")
54
55 out.write("\n")
56 out.close()
57
58