old_contents: #!/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')
    parser.add_argument('--quiet', default=False, action='store_true')
    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,
      os.path.join(args.third_party, 'android_embedding_dependencies', 'lib', '*'),
      os.path.join(args.third_party, 'android_tools/sdk//platforms/android-30/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.mutatorsstack',
      '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
  
    if not args.quiet:
      print(' '.join(command))
  
    try:
      output = subprocess.check_output(command, stderr=subprocess.STDOUT)
      if not args.quiet:
        print(output)
    except subprocess.CalledProcessError as e:
      print(e.output)
      return e.returncode
  
    return 0
  
  
  if __name__ == '__main__':
    sys.exit(main())
  
new_contents: #!/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')
    parser.add_argument('--quiet', default=False, action='store_true')
    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,
      os.path.join(args.third_party, 'android_tools/sdk//platforms/android-30/android.jar'),
      os.path.join(args.third_party, 'android_embedding_dependencies', 'lib', '*'),
    ]
    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.mutatorsstack',
      '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
  
    if not args.quiet:
      print(' '.join(command))
  
    try:
      output = subprocess.check_output(command, stderr=subprocess.STDOUT)
      if not args.quiet:
        print(output)
    except subprocess.CalledProcessError as e:
      print(e.output)
      return e.returncode
  
    return 0
  
  
  if __name__ == '__main__':
    sys.exit(main())
  
subject: Move the Android API JAR ahead of the third-party dependencies in the Javadoc classpath (#27125)