Flutter Engine
The Flutter Engine
Functions
write_dartdoc_options_file Namespace Reference

Functions

def ParseArgs (args)
 
def Main (argv)
 

Function Documentation

◆ Main()

def write_dartdoc_options_file.Main (   argv)

Definition at line 26 of file write_dartdoc_options_file.py.

26def Main(argv):
27 args = ParseArgs(argv)
28 # TODO(jcollins-g): switch to version numbers when github has its tags synced
29 revision = None
30 if not args.no_git_hash:
31 revision = utils.GetGitRevision()
32 if revision is None:
33 revision = 'main'
34 output = '''dartdoc:
35 categoryOrder: ["Core", "VM", "Web", "Web (Legacy)"]
36 categories:
37 'Web':
38 external:
39 - name: 'package:web'
40 url: https://pub.dev/documentation/web/latest/
41 docs: >-
42 This package exposes browser APIs. It's intended to replace
43 dart:html and similar Dart SDK libraries. It will support access to
44 browser APIs from Dart code compiled to either JavaScript or
45 WebAssembly.
46 'Web (Legacy)':
47 external:
48 - name: 'package:js'
49 url: https://pub.dev/documentation/js/latest/
50 docs: >-
51 Use this package when you want to call JavaScript APIs from Dart
52 code, or vice versa.
53 linkToSource:
54 root: '.'
55 uriTemplate: 'https://github.com/dart-lang/sdk/blob/%s/sdk/%%f%%#L%%l%%'
56 errors:
57 # Default errors of dartdoc:
58 - duplicate-file
59 - invalid-parameter
60 - no-defining-library-found
61 - tool-error
62 - unresolved-export
63 # Warnings that are elevated to errors:
64 - ambiguous-doc-reference
65 - ambiguous-reexport
66 - broken-link
67 - category-order-gives-missing-package-name
68 - deprecated
69 - ignored-canonical-for
70 - missing-from-search-index
71 - no-canonical-found
72 - no-documentable-libraries
73 - no-library-level-docs
74 - not-implemented
75 - orphaned-file
76 - reexported-private-api-across-packages
77 # - unknown-directive # Disabled due to https://github.com/dart-lang/dartdoc/issues/2353
78 - unknown-file
79 - unknown-macro
80 - unresolved-doc-reference
81 header:
82 - ../../../tools/bots/dartdoc_header.html
83 footer:
84 - ../../../tools/bots/dartdoc_footer.html
85 footerText:
86 - ../../../tools/bots/dartdoc_footer_text.html
87''' % revision
88 with open(args.output, 'w') as f:
89 f.write(output)
90 return 0
91
92
def GetGitRevision(git_revision_file=None, repo_path=DART_DIR)
Definition: utils.py:415

◆ ParseArgs()

def write_dartdoc_options_file.ParseArgs (   args)

Definition at line 11 of file write_dartdoc_options_file.py.

11def ParseArgs(args):
12 args = args[1:]
13 parser = argparse.ArgumentParser(
14 description='A script to write a custom dartdoc_options.yaml to a file')
15
16 parser.add_argument(
17 '--output', '-o', type=str, required=True, help='File to write')
18 parser.add_argument('--no-git-hash',
19 help='Omit the git hash in the output',
20 dest='no_git_hash',
21 action='store_true')
22
23 return parser.parse_args(args)
24
25