blob: 8932b847a6cccda6c7e1b4dc782fbcfe9d18db32 [file] [log] [blame]
Alexander Thomasb5c63ce2021-04-15 10:10:20 +00001#!/usr/bin/env python3
Janice Collins1c8f5712019-02-07 18:46:31 +00002# 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
Nate Bosch55f81f22019-08-05 20:34:31 +000010
Janice Collins1c8f5712019-02-07 18:46:31 +000011def ParseArgs(args):
Nate Bosch55f81f22019-08-05 20:34:31 +000012 args = args[1:]
13 parser = argparse.ArgumentParser(
14 description='A script to write a custom dartdoc_options.yaml to a file')
Janice Collins1c8f5712019-02-07 18:46:31 +000015
Nate Bosch55f81f22019-08-05 20:34:31 +000016 parser.add_argument(
17 '--output', '-o', type=str, required=True, help='File to write')
Janice Collins1c8f5712019-02-07 18:46:31 +000018
Nate Bosch55f81f22019-08-05 20:34:31 +000019 return parser.parse_args(args)
Janice Collins1c8f5712019-02-07 18:46:31 +000020
21
22def Main(argv):
Nate Bosch55f81f22019-08-05 20:34:31 +000023 args = ParseArgs(argv)
24 # TODO(jcollins-g): switch to version numbers when github has its tags synced
25 revision = utils.GetGitRevision()
26 if revision is None:
27 revision = 'master'
28 output = '''dartdoc:
Janice Collins1c8f5712019-02-07 18:46:31 +000029 categoryOrder: ["Core", "VM", "Web"]
30 linkToSource:
31 root: '.'
32 uriTemplate: 'https://github.com/dart-lang/sdk/blob/%s/sdk/%%f%%#L%%l%%'
Janice Collins1426aff2021-06-29 19:31:28 +000033 errors:
34 # Default errors of dartdoc:
35 - duplicate-file
36 - invalid-parameter
37 - no-defining-library-found
38 - tool-error
39 - unresolved-export
40 # Warnings that are elevated to errors:
41 - ambiguous-doc-reference
42 - ambiguous-reexport
43 - broken-link
44 - category-order-gives-missing-package-name
45 - deprecated
46 - ignored-canonical-for
47 - missing-from-search-index
48 - no-canonical-found
49 - no-documentable-libraries
50 - no-library-level-docs
51 - not-implemented
52 - orphaned-file
53 - reexported-private-api-across-packages
54 # - unknown-directive # Disabled due to https://github.com/dart-lang/dartdoc/issues/2353
55 - unknown-file
56 - unknown-macro
57 - unresolved-doc-reference
Janice Collins1c8f5712019-02-07 18:46:31 +000058''' % revision
Nate Bosch55f81f22019-08-05 20:34:31 +000059 with open(args.output, 'w') as f:
60 f.write(output)
61 return 0
62
Janice Collins1c8f5712019-02-07 18:46:31 +000063
64if __name__ == '__main__':
Nate Bosch55f81f22019-08-05 20:34:31 +000065 sys.exit(Main(sys.argv))