0

fetch_all.py: Fix script //third_party/android_deps/libs is removed

I recently added a jetify step to fetch_all.py, but it turns out that
jetify relies on .jar files within //third_party/android_deps to run.

To work around this, tell jetify where to find the freshly-downloaded
libraries.

Bug: 997894
Change-Id: I45b06e4ef94436655a26de86fad816e2da3d00df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2196930
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Reviewed-by: Sam Maier <smaier@chromium.org>
Commit-Queue: Sam Maier <smaier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#767961}
This commit is contained in:
Andrew Grieve
2020-05-12 21:13:34 +00:00
committed by Commit Bot
parent b306fe7493
commit 5dc3627da6
2 changed files with 9 additions and 4 deletions
third_party
android_deps
jetifier_standalone

@ -324,9 +324,10 @@ def GenerateCipdUploadCommand(cipd_pkg_info):
pkg_path, pkg_name, pkg_tag)
def _JetifyAll(aar_files):
def _JetifyAll(aar_files, libs_dir):
env = os.environ.copy()
env['JAVA_HOME'] = _JAVA_HOME
env['ANDROID_DEPS'] = libs_dir
# Don't jetify support lib or androidx.
EXCLUDE = ('android_arch_', 'androidx_', 'com_android_support_')
@ -348,7 +349,9 @@ def _JetifyAll(aar_files):
for cmd, proc in jobs:
output = proc.communicate()[0]
if proc.returncode:
raise Exception('Jetify failed for command: ' + ' '.join(cmd))
raise Exception(
'Jetify failed for command: {}\nOutput:\n{}'.format(
' '.join(cmd), output))
if "You don't need to run Jetifier" not in output:
logging.info('Needed jetify: %s', cmd[-1])
num_required += 1
@ -512,7 +515,7 @@ def main():
logging.info('# Jetify all libraries.')
aar_files = FindInDirectory(libs_dir, '*.aar')
_JetifyAll(aar_files)
_JetifyAll(aar_files, libs_dir)
logging.info(
'# Generate Android .aar info and third-party license files.')

@ -81,7 +81,9 @@ case "`uname`" in
;;
esac
ANDROID_DEPS=$THIRD_PARTY_DIR/android_deps/libs
if [ -z "$ANDROID_DEPS" ]; then
ANDROID_DEPS=$THIRD_PARTY_DIR/android_deps/libs
fi
CLASSPATH=$APP_HOME/lib/jetifier-standalone.jar:$ANDROID_DEPS/com_android_tools_build_jetifier_jetifier_processor/jetifier-processor-1.0.0-beta08.jar:$ANDROID_DEPS/commons_cli_commons_cli/commons-cli-1.3.1.jar:$ANDROID_DEPS/com_android_tools_build_jetifier_jetifier_core/jetifier-core-1.0.0-beta08.jar:$ANDROID_DEPS/org_ow2_asm_asm_util/asm-util-7.0.jar:$ANDROID_DEPS/org_ow2_asm_asm_commons/asm-commons-7.0.jar:$ANDROID_DEPS/org_ow2_asm_asm_tree/asm-tree-7.0.jar:$ANDROID_DEPS/org_ow2_asm_asm/asm-7.0.jar:$ANDROID_DEPS/org_jdom_jdom2/jdom2-2.0.6.jar:$ANDROID_DEPS/org_jetbrains_kotlin_kotlin_stdlib/kotlin-stdlib-1.3.50.jar:$ANDROID_DEPS/com_google_code_gson_gson/gson-2.8.0.jar:$ANDROID_DEPS/org_jetbrains_kotlin_kotlin_stdlib_common/kotlin-stdlib-common-1.3.50.jar:$ANDROID_DEPS/org_jetbrains_annotations/annotations-13.0.jar
# Determine the Java command to use to start the JVM.