gen_javadoc.py 1.8 KB
Newer Older
1
#!/usr/bin/env python
M
Michael Goderbauer 已提交
2
# Copyright 2013 The Flutter Authors. All rights reserved.
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
# 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():
  if not os.path.exists(ANDROID_SRC_ROOT):
    print 'This script must be run at the root of the Flutter source tree'
    return 1

  parser = argparse.ArgumentParser(description='Runs javadoc on Flutter Android libraries')
  parser.add_argument('--out-dir', type=str, required=True)
  args = parser.parse_args()

  if not os.path.exists(args.out_dir):
    os.makedirs(args.out_dir)

  classpath = [
    ANDROID_SRC_ROOT,
28 29 30 31 32
    'third_party/android_support/android_arch_lifecycle_common.jar',
    'third_party/android_support/android_arch_lifecycle_viewmodel.jar',
    'third_party/android_support/android_support_annotations.jar',
    'third_party/android_support/android_support_compat.jar',
    'third_party/android_support/android_support_fragment.jar',
33
    'third_party/android_tools/sdk/platforms/android-29/android.jar',
34 35 36 37 38
    'base/android/java/src',
    'third_party/jsr-305/src/ri/src/main/java',
  ]
  packages = [
    'io.flutter.app',
39 40 41 42 43
    'io.flutter.embedding.android',
    'io.flutter.embedding.engine',
    'io.flutter.embedding.engine.dart',
    'io.flutter.embedding.engine.renderer',
    'io.flutter.embedding.engine.systemchannels',
44
    'io.flutter.plugin.common',
45
    'io.flutter.plugin.editing',
46
    'io.flutter.plugin.platform',
47 48
    'io.flutter.util',
    'io.flutter.view',
49 50
  ]

51
  command = [
52 53 54
    'javadoc',
    '-classpath', ':'.join(classpath),
    '-d', args.out_dir,
55 56 57 58 59
    '-link', 'https://developer.android.com/reference/',
  ] + packages
  print(' '.join(command))

  return subprocess.call(command)
60 61 62 63


if __name__ == '__main__':
  sys.exit(main())