Flutter Engine
The Flutter Engine
write_dartdoc_options_file.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
3# for details. All rights reserved. Use of this source code is governed by a
4# BSD-style license that can be found in the LICENSE file.
5
6import argparse
7import sys
8import utils
9
10
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
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
93if __name__ == '__main__':
94 sys.exit(Main(sys.argv))
def GetGitRevision(git_revision_file=None, repo_path=DART_DIR)
Definition: utils.py:415