Always use local mapping file if it matches
Locally the retracing is broken and if there are many tests failures this is also super slow
Bug: b/231659727
Change-Id: Ic5333a60c28d71ad14ef9d312ca9cd7b59826085
diff --git a/tools/retrace.py b/tools/retrace.py
index a2df6ef..a7ff23d 100755
--- a/tools/retrace.py
+++ b/tools/retrace.py
@@ -122,6 +122,9 @@
else:
args.commit_hash = r8_version_or_hash
map_path = None
+ if get_hash_from_map_file(utils.R8LIB_MAP) == maphash:
+ return utils.R8LIB_MAP
+
try:
map_path = utils.find_cloud_storage_file_from_options(
'r8lib' + ('-exclude-deps' if is_excldeps else '') + '.jar.map', args)
@@ -134,23 +137,25 @@
return map_path
# If no other map file was found, use the local mapping file.
- return utils.R8LIB_JAR + '.map'
+ return utils.R8LIB_MAP
def check_maphash(mapping_path, maphash, args):
+ infile_maphash = get_hash_from_map_file(mapping_path)
+ if infile_maphash != maphash:
+ print('ERROR: The mapping file hash does not match the R8 line')
+ print(' In mapping file: ' + infile_maphash)
+ print(' In source file: ' + maphash)
+ if (not args.exclude_deps):
+ print('If this could be a version without internalized dependencies '
+ + 'try passing --exclude-deps')
+ sys.exit(1)
+
+def get_hash_from_map_file(mapping_path):
map_hash_header = "# pg_map_hash: SHA-256 "
for line in open(mapping_path, 'r'):
if line.startswith(map_hash_header):
- infile_maphash = line[len(map_hash_header):].strip()
- if infile_maphash != maphash:
- print('ERROR: The mapping file hash does not match the R8 line')
- print(' In mapping file: ' + infile_maphash)
- print(' In source file: ' + maphash)
- if (not args.exclude_deps):
- print('If this could be a version without internalized dependencies '
- + 'try passing --exclude-deps')
- sys.exit(1)
-
+ return line[len(map_hash_header):].strip()
def main():
args = parse_arguments()
diff --git a/tools/utils.py b/tools/utils.py
index 27a8feb..85fda69 100644
--- a/tools/utils.py
+++ b/tools/utils.py
@@ -54,7 +54,7 @@
R8_JAR = os.path.join(LIBS, 'r8.jar')
R8_WITH_RELOCATED_DEPS_JAR = os.path.join(LIBS, 'r8_with_relocated_deps.jar')
R8LIB_JAR = os.path.join(LIBS, 'r8lib.jar')
-R8LIB_MAP = os.path.join(LIBS, 'r8lib.jar.map')
+R8LIB_MAP = '%s.map' % R8LIB_JAR
R8_SRC_JAR = os.path.join(LIBS, 'r8-src.jar')
R8LIB_EXCLUDE_DEPS_JAR = os.path.join(LIBS, 'r8lib-exclude-deps.jar')
R8_FULL_EXCLUDE_DEPS_JAR = os.path.join(LIBS, 'r8-full-exclude-deps.jar')