Flutter Engine
The Flutter Engine
Functions | Variables
gen_docs Namespace Reference

Functions

def generate_doxyfile (section, output_dir, log_file, doxy_file)
 
def process_section (name, section, destination)
 
def generate_docs (argv)
 

Variables

 Section = namedtuple('Section', ['title', 'inputs'])
 
dictionary SECTIONS
 

Function Documentation

◆ generate_docs()

def gen_docs.generate_docs (   argv)

Definition at line 84 of file gen_docs.py.

84def generate_docs(argv):
85 if len(argv) != 2:
86 print(
87 'Error: Argument specifying output directory required. '
88 'Directory may be an absolute path, or a relative path from the "src" directory.'
89 )
90 exit(1)
91
92 destination = argv[1]
93 script_path = os.path.realpath(__file__)
94 src_path = os.path.dirname(os.path.dirname(os.path.dirname(script_path)))
95 # Run commands from the Flutter root dir.
96 os.chdir(os.path.join(src_path, 'flutter'))
97 # If the argument isn't an absolute path, assume that it is relative to the src dir.
98 if not os.path.isabs(destination):
99 destination = os.path.join(src_path, destination)
100 os.makedirs(destination, exist_ok=True)
101 for name, section in SECTIONS.items():
102 process_section(name, section, destination)
103
104
exit(kErrorExitCode)
def process_section(name, section, destination)
Definition: gen_docs.py:64
def generate_docs(argv)
Definition: gen_docs.py:84
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ generate_doxyfile()

def gen_docs.generate_doxyfile (   section,
  output_dir,
  log_file,
  doxy_file 
)

Definition at line 51 of file gen_docs.py.

51def generate_doxyfile(section, output_dir, log_file, doxy_file):
52 doxyfile = open('docs/Doxyfile.template', 'r').read()
53 doxyfile = doxyfile.replace('@@OUTPUT_DIRECTORY@@', output_dir)
54 doxyfile = doxyfile.replace('@@LOG_FILE@@', log_file)
55 doxyfile = doxyfile.replace('@@INPUT_DIRECTORIES@@', '"{}"'.format('" "'.join(section.inputs)))
56 doxyfile = doxyfile.replace('@@PROJECT_NAME@@', 'Flutter {}'.format(section.title))
57 doxyfile = doxyfile.replace(
58 '@@DOCSET_FEEDNAME@@', 'Flutter {} Documentation'.format(section.title)
59 )
60 with open(doxy_file, 'w') as f:
61 f.write(doxyfile)
62
63
static bool read(SkStream *stream, void *buffer, size_t amount)
uint32_t uint32_t * format
def generate_doxyfile(section, output_dir, log_file, doxy_file)
Definition: gen_docs.py:51
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

◆ process_section()

def gen_docs.process_section (   name,
  section,
  destination 
)

Definition at line 64 of file gen_docs.py.

64def process_section(name, section, destination):
65 output_dir = tempfile.mkdtemp(prefix="doxygen")
66 log_file = os.path.join(destination, '{}-doxygen.log'.format(name))
67 zip_file = os.path.join(destination, '{}-docs.zip'.format(name))
68 doxy_file = os.path.join(output_dir, 'Doxyfile')
69 generate_doxyfile(section, output_dir, log_file, doxy_file)
70 # Update the Doxyfile format to the latest format.
71 subprocess.call(['doxygen', '-u'], cwd=output_dir)
72 subprocess.call(['doxygen', doxy_file])
73 html_dir = os.path.join(output_dir, 'html')
74 with zipfile.ZipFile(zip_file, 'w') as zip:
75 for root, _, files in os.walk(html_dir):
76 for file in files:
77 filename = os.path.join(root, file)
78 zip.write(filename, os.path.relpath(filename, html_dir))
79 print('Wrote ZIP file for {} to {}'.format(section, zip_file))
80 print('Preserving log file in {}'.format(log_file))
81 shutil.rmtree(output_dir, ignore_errors=True)
82
83

Variable Documentation

◆ Section

gen_docs.Section = namedtuple('Section', ['title', 'inputs'])

Definition at line 15 of file gen_docs.py.

◆ SECTIONS

dictionary gen_docs.SECTIONS

Definition at line 17 of file gen_docs.py.