diff --git a/DEPS b/DEPS index 7ec8a4e8da270..7b875e8e53b01 100644 --- a/DEPS +++ b/DEPS @@ -408,6 +408,14 @@ hooks = [ 'src/tools/android/download_android_tools.py', ], }, + { + 'name': 'download_android_support', + 'pattern': '.', + 'action': [ + 'python', + 'src/flutter/tools/android_support/download_android_support.py', + ], + }, { 'name': 'buildtools', 'pattern': '.', diff --git a/tools/android_support/VERSION_SUPPORT_V13 b/tools/android_support/VERSION_SUPPORT_V13 new file mode 100644 index 0000000000000..f7d827f42df7f --- /dev/null +++ b/tools/android_support/VERSION_SUPPORT_V13 @@ -0,0 +1 @@ +https://maven.google.com/com/android/support/support-fragment/28.0.0/support-fragment-28.0.0.aar diff --git a/tools/android_support/download_android_support.py b/tools/android_support/download_android_support.py new file mode 100644 index 0000000000000..63a73a0bc820d --- /dev/null +++ b/tools/android_support/download_android_support.py @@ -0,0 +1,47 @@ +#!/usr/bin/env python +# Copyright 2018 The Chromium 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 os +import sys +import urllib2 +import cStringIO +import zipfile + +# Path constants. (All of these should be absolute paths.) +THIS_DIR = os.path.abspath(os.path.dirname(__file__)) +FLUTTER_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) +INSTALL_DIR = os.path.join(FLUTTER_DIR, 'third_party', 'android_support') + +def GetInstalledVersion(version_stamp): + version_file = os.path.join(INSTALL_DIR, version_stamp) + if not os.path.exists(version_file): + return None + with open(version_file) as f: + return f.read().strip() + +def main(): + # Read latest version. + version_stamp = 'VERSION_SUPPORT_V13' + version = '' + with open(os.path.join(THIS_DIR, version_stamp)) as f: + version = f.read().strip() + # Return if installed binaries are up to date. + if version == GetInstalledVersion(version_stamp): + return + + # Download the AAR and extract the JAR. + aar = urllib2.urlopen(version).read() + aar_zip = zipfile.ZipFile(cStringIO.StringIO(aar)) + if not os.path.exists(INSTALL_DIR): + os.mkdir(INSTALL_DIR) + with open(os.path.join(INSTALL_DIR, 'android_support_v13.jar'), 'w') as f: + f.write(aar_zip.read('classes.jar')) + + # Write version as the last step. + with open(os.path.join(INSTALL_DIR, version_stamp), 'w') as f: + f.write('%s\n' % version) + +if __name__ == '__main__': + sys.exit(main()) diff --git a/tools/licenses/lib/main.dart b/tools/licenses/lib/main.dart index 00442400a06dc..bb256015c0fc8 100644 --- a/tools/licenses/lib/main.dart +++ b/tools/licenses/lib/main.dart @@ -1938,6 +1938,7 @@ class RepositoryRootThirdPartyDirectory extends RepositoryGenericThirdPartyDirec && entry.name != 'binutils' // build-time dependency only && entry.name != 'instrumented_libraries' // unused according to chinmay && entry.name != 'android_tools' // excluded on advice + && entry.name != 'android_support' // build-time only && entry.name != 'googletest' // only used by tests && entry.name != 'skia' // treated as a separate component && super.shouldRecurse(entry);