update_prebuilts.py: copy library dependencies into updated build tools
The libconscrypt_openjdk_jni dependency of signapk and the
libwinpthread-1 dependency for lld were manually copied into the
build tools, and each time update_prebuilts.py is run they are deleted,
requiring manual restoration. Preserve them by moving them into the
downloaded artifacts directory before overwriting the tools directory
with the downloaded artifacts.
Bug: 180055535
Test: ./update_prebuilts.py -b 6752562
Change-Id: Icd964ab6a7c45ca3e0d09c70787d024dbe386015
diff --git a/update_prebuilts/update_prebuilts.py b/update_prebuilts/update_prebuilts.py
index 47f9bcf..c71ffa1 100755
--- a/update_prebuilts/update_prebuilts.py
+++ b/update_prebuilts/update_prebuilts.py
@@ -577,6 +577,21 @@
top_level_dir = os.listdir(artifact_path)[0]
src_path = os.path.join(artifact_path, top_level_dir)
dst_path = path(buildtools_dir, arch)
+
+ # There are a few libraries that have been manually added to the
+ # build tools, copy them from the destination back to the source
+ # before the destination is overwritten.
+ files_to_save = (
+ 'lib64/libconscrypt_openjdk_jni.dylib',
+ 'lib64/libconscrypt_openjdk_jni.so',
+ 'bin/lib64/libwinpthread-1.dll',
+ )
+ for file in files_to_save:
+ src_file = os.path.join(dst_path, file)
+ dst_file = os.path.join(src_path, file)
+ if os.path.exists(dst_path):
+ mv(src_file, dst_file)
+
mv(src_path, dst_path)
# Move all top-level files to /bin and make them executable