forked from muhleder/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_javadoc.py
executable file
·78 lines (66 loc) · 2.71 KB
/
gen_javadoc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/usr/bin/env python
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import argparse
import os
import subprocess
import sys
ANDROID_SRC_ROOT = 'flutter/shell/platform/android'
def main():
parser = argparse.ArgumentParser(description='Runs javadoc on Flutter Android libraries')
parser.add_argument('--out-dir', type=str, required=True)
parser.add_argument('--android-source-root', type=str, default=ANDROID_SRC_ROOT)
parser.add_argument('--build-config-path', type=str)
parser.add_argument('--third-party', type=str, default='third_party')
args = parser.parse_args()
if not os.path.exists(args.android_source_root):
print('This script must be run at the root of the Flutter source tree, or '
'the --android-source-root must be set.')
return 1
if not os.path.exists(args.out_dir):
os.makedirs(args.out_dir)
classpath = [
args.android_source_root,
args.third_party + '/android_support/android_support_compat.jar',
args.third_party + '/android_support/android_support_annotations.jar',
args.third_party + '/android_support/android_support_fragment.jar',
args.third_party + '/android_support/android_arch_lifecycle_common.jar',
args.third_party + '/android_support/android_arch_lifecycle_common_java8.jar',
args.third_party + '/android_support/android_arch_lifecycle_runtime.jar',
args.third_party + '/android_support/android_arch_lifecycle_viewmodel.jar',
args.third_party + '/android_tools/sdk/platforms/android-29/android.jar',
]
if args.build_config_path:
classpath.append(args.build_config_path)
packages = [
'io.flutter.app',
'io.flutter.embedding.android',
'io.flutter.embedding.engine',
'io.flutter.embedding.engine.dart',
'io.flutter.embedding.engine.loader',
'io.flutter.embedding.engine.plugins',
'io.flutter.embedding.engine.plugins.activity',
'io.flutter.embedding.engine.plugins.broadcastreceiver',
'io.flutter.embedding.engine.plugins.contentprovider',
'io.flutter.embedding.engine.plugins.lifecycle',
'io.flutter.embedding.engine.plugins.service',
'io.flutter.embedding.engine.plugins.shim',
'io.flutter.embedding.engine.renderer',
'io.flutter.embedding.engine.systemchannels',
'io.flutter.plugin.common',
'io.flutter.plugin.editing',
'io.flutter.plugin.platform',
'io.flutter.util',
'io.flutter.view',
]
command = [
'javadoc',
'-classpath', ':'.join(classpath),
'-d', args.out_dir,
'-link', 'https://developer.android.com/reference/',
] + packages
print(' '.join(command))
return subprocess.call(command)
if __name__ == '__main__':
sys.exit(main())