34 parser = argparse.ArgumentParser(description='Runs javadoc on Flutter Android libraries')
35 parser.add_argument('--out-dir', type=str, required=True)
36 parser.add_argument('--android-source-root', type=str, default=ANDROID_SRC_ROOT)
37 parser.add_argument('--build-config-path', type=str)
38 parser.add_argument('--src-dir', type=str, default='.')
39 parser.add_argument('--quiet', default=False, action='store_true')
40 args = parser.parse_args()
41
42 if not os.path.exists(args.android_source_root):
44 'This script must be run at the root of the Flutter source tree, or '
45 'the --android-source-root must be set.'
46 )
47 return 1
48
49 if not os.path.exists(args.out_dir):
50 os.makedirs(args.out_dir)
51
52 android_jar_path = os.path.join(
53 args.src_dir, 'flutter', 'third_party', 'android_tools', 'sdk', 'platforms', 'android-34',
54 'android.jar'
55 )
56 if not os.path.exists(android_jar_path):
57 print(
'Android SDK not found at %s' % android_jar_path)
58 return 1
59
60 classpath = [
61 args.android_source_root,
62 android_jar_path,
63 os.path.join(args.src_dir, 'third_party', 'android_embedding_dependencies', 'lib', '*'),
64 ]
65 if args.build_config_path:
66 classpath.append(args.build_config_path)
67
68 packages = [
69 'io.flutter.app',
70 'io.flutter.embedding.android',
71 'io.flutter.embedding.engine',
72 'io.flutter.embedding.engine.dart',
73 'io.flutter.embedding.engine.loader',
74 'io.flutter.embedding.engine.mutatorsstack',
75 'io.flutter.embedding.engine.plugins',
76 'io.flutter.embedding.engine.plugins.activity',
77 'io.flutter.embedding.engine.plugins.broadcastreceiver',
78 'io.flutter.embedding.engine.plugins.contentprovider',
79 'io.flutter.embedding.engine.plugins.lifecycle',
80 'io.flutter.embedding.engine.plugins.service',
81 'io.flutter.embedding.engine.plugins.shim',
82 'io.flutter.embedding.engine.renderer',
83 'io.flutter.embedding.engine.systemchannels',
84 'io.flutter.plugin.common',
85 'io.flutter.plugin.editing',
86 'io.flutter.plugin.platform',
87 'io.flutter.util',
88 'io.flutter.view',
89 ]
90
91 android_package_list = os.path.join(SCRIPT_DIR, 'android_reference')
92
93 command = [
95 '-classpath',
97 '-d',
98 args.out_dir,
99 '-linkoffline',
100 'https://developer.android.com/reference/',
101 android_package_list,
102 '-source',
103 '1.8',
104 ] + packages
105
106 if not args.quiet:
108
109 try:
110 output = subprocess.check_output(command, stderr=subprocess.STDOUT)
111 if not args.quiet:
113 except subprocess.CalledProcessError as e:
114 print(e.output.decode(
'utf-8'))
115 return e.returncode
116
117 return 0
118
119
def print(*args, **kwargs)
static SkString join(const CommandLineFlags::StringArray &)