mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add a few bits of documentation to package:sky
I can't really make further progress until at least: https://github.com/dart-lang/dartdoc/issues/766 is resolved, ideally also: https://github.com/dart-lang/dartdoc/issues/763 @abarth
This commit is contained in:
parent
5855b1581a
commit
d5fcb7b4ea
@ -7,17 +7,17 @@ import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import webbrowser
|
||||
from skypy.url_mappings import URLMappings
|
||||
|
||||
SKY_TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
SKY_ROOT = os.path.dirname(SKY_TOOLS_DIR)
|
||||
SRC_ROOT = os.path.dirname(SKY_ROOT)
|
||||
WORKBENCH_ROOT = os.path.join(SRC_ROOT, 'sky', 'packages', 'workbench')
|
||||
|
||||
from skypy.url_mappings import URLMappings
|
||||
|
||||
|
||||
DARTDOC = 'dartdoc'
|
||||
|
||||
|
||||
def main():
|
||||
try:
|
||||
subprocess.check_output([DARTDOC, '--version'])
|
||||
@ -27,20 +27,32 @@ def main():
|
||||
|
||||
parser = argparse.ArgumentParser(description='Sky Documentation Generator')
|
||||
parser.add_argument('build_dir', type=str, help='Path to build output')
|
||||
parser.add_argument('--open', action='store_true',
|
||||
help='Open docs after building.')
|
||||
args = parser.parse_args()
|
||||
|
||||
build_dir = os.path.abspath(args.build_dir)
|
||||
|
||||
sky_package = os.path.join(SRC_ROOT, 'sky/packages/sky')
|
||||
doc_dir = os.path.join(build_dir, 'gen/dart-pkg/sky/doc')
|
||||
|
||||
# dartdoc doesn't understand sdk_ext yet, so we still need url_mappings:
|
||||
# https://github.com/dart-lang/dartdoc/issues/763
|
||||
url_mappings = URLMappings(SRC_ROOT, build_dir)
|
||||
|
||||
analyzer_args = [
|
||||
DARTDOC,
|
||||
'--input', sky_package,
|
||||
'--output', doc_dir,
|
||||
# dartdoc appears to ignore --package-root:
|
||||
# https://github.com/dart-lang/dartdoc/issues/766
|
||||
'--package-root', os.path.join(WORKBENCH_ROOT, 'packages')
|
||||
] + url_mappings.as_args
|
||||
subprocess.check_call(analyzer_args)
|
||||
|
||||
if args.open:
|
||||
webbrowser.open(os.path.join(doc_dir, 'index.html'))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user