Ensure Compose-specific TEST_MAPPING is not removed on updates
Adding these tests in ag/20311162
Bug: 257292433
Change-Id: I19102a21b47c7b1f5d90589e7b4b3a7f652257e0
Test: ./update_prebuilts.py -x 9186669 --include androidx/compose --exclude androidx/compose/compiler/compiler-hosted
diff --git a/update_prebuilts/update_prebuilts.py b/update_prebuilts/update_prebuilts.py
index 741525f..46d8e44 100755
--- a/update_prebuilts/update_prebuilts.py
+++ b/update_prebuilts/update_prebuilts.py
@@ -29,6 +29,7 @@
androidx_owners = os.path.join(androidx_dir, 'OWNERS')
java_plugins_bp_path = os.path.join(androidx_dir, 'JavaPlugins.bp')
test_mapping_file = os.path.join(androidx_dir, 'TEST_MAPPING')
+compose_test_mapping_file = os.path.join(androidx_dir, 'm2repository/androidx/compose/TEST_MAPPING')
gmaven_dir = os.path.join(current_path, 'gmaven')
extras_dir = os.path.join(current_path, 'extras')
buildtools_dir = 'tools'
@@ -707,7 +708,13 @@
f.write('\nbuild = ["JavaPlugins.bp"]\n')
# Keep OWNERs file, JavaPlugins.bp file, and TEST_MAPPING files untouched.
- subprocess.check_call(['git', 'restore', androidx_owners, java_plugins_bp_path, test_mapping_file])
+ files_to_restore = [androidx_owners, java_plugins_bp_path, test_mapping_file,
+ compose_test_mapping_file]
+ for file_to_restore in files_to_restore:
+ # Ignore any output or error - these files are not gauranteed to exist, but
+ # if they do, we want to restore them.
+ subprocess.call(['git', 'restore', file_to_restore],
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
return True