Flutter Engine
The Flutter Engine
Functions
verify_sources Namespace Reference

Functions

def main ()
 

Function Documentation

◆ main()

def verify_sources.main ( )

Definition at line 13 of file verify_sources.py.

13def main():
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 # Get all dart sources from source directory.
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 # It is possible for sources to include dart files outside of source_dir.
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:
51 print(
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:
58 print(
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
Definition: switches.h:76
def print(*args, **kwargs)
Definition: run_tests.py:49
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741