14 parser = argparse.ArgumentParser(
15 "Verifies that all .dart files are included in sources, and sources don't include nonexsitent files"
16 )
17 parser.add_argument(
18 "--source_dir", help="Path to the directory containing the package sources", required=True
19 )
20 parser.add_argument("--stamp", help="File to touch when source checking succeeds", required=True)
21 parser.add_argument("sources", help="source files", nargs=argparse.REMAINDER)
22 args = parser.parse_args()
23
24 actual_sources =
set()
25
26 src_dir_path = pathlib.Path(args.source_dir)
27 for (dirpath, dirnames, filenames) in os.walk(src_dir_path, topdown=True):
28 relpath_to_src_root = pathlib.Path(dirpath).relative_to(src_dir_path)
29 actual_sources.update(
30 os.path.normpath(relpath_to_src_root.joinpath(filename))
31 for filename in filenames
32 if pathlib.Path(filename).suffix == ".dart"
33 )
34
35 expected_sources =
set(args.sources)
36
37 actual_sources.update([
38 s for s in (expected_sources - actual_sources) if src_dir_path.joinpath(s).resolve().exists()
39 ],)
40
41 if actual_sources == expected_sources:
42 with open(args.stamp, "w") as stamp:
43 stamp.write("Success!")
44 return 0
45
46 def sources_to_abs_path(sources):
47 return sorted(str(src_dir_path.joinpath(s)) for s in sources)
48
49 missing_sources = actual_sources - expected_sources
50 if missing_sources:
52 '\nSource files found that were missing from the "sources" parameter:\n{}\n'.
format(
53 "\n".
join(sources_to_abs_path(missing_sources))
54 ),
55 )
56 nonexistent_sources = expected_sources - actual_sources
57 if nonexistent_sources:
59 '\nSource files listed in "sources" parameter but not found:\n{}\n'.
format(
60 "\n".
join(sources_to_abs_path(nonexistent_sources))
61 ),
62 )
63 return 1
64
65
uint32_t uint32_t * format
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not set
def print(*args, **kwargs)
static SkString join(const CommandLineFlags::StringArray &)