Much debugging later...

This commit is contained in:
maelstrom 2024-08-20 01:24:18 +02:00
parent ab484a0350
commit ae7b361482
4 changed files with 13 additions and 5 deletions

View file

@ -14,6 +14,9 @@ def assemble_apk():
# Assemble # Assemble
print("Assembling APK...") print("Assembling APK...")
_ = subprocess.run([JAVA_BIN, '-jar', APKTOOL, 'b', MERGED_RSC_DIR, '-o', ASSEMBLED_APK]) res = subprocess.run([JAVA_BIN, '-jar', APKTOOL, 'b', MERGED_RSC_DIR, '-o', ASSEMBLED_APK])
if res.returncode != 0:
print("Error ocurred while assembling")
exit(res.returncode)
return True return True

View file

@ -24,7 +24,7 @@ def merge_into(src: Path | str, dest: Path | str, check_date: bool = True, touch
dest_file = dest / src_file.relative_to(src) dest_file = dest / src_file.relative_to(src)
# Don't update if dest is newer than source # Don't update if dest is newer than source
if check_date and dest_file.exists() and src_file.stat().st_mtime <= dest_file.stat().st_mtime: if check_date and dest_file.exists() and src_file.stat().st_mtime < dest_file.stat().st_mtime:
continue continue
dest_file.parent.mkdir(parents=True, exist_ok=True) dest_file.parent.mkdir(parents=True, exist_ok=True)

View file

@ -23,9 +23,11 @@ def merge_resources():
updated = first_time updated = first_time
# Make sure to place "or updated" *after* the statement, not before, because 'and' and 'or' are short-circuting... ya idiot
print("Merging patched resources...") print("Merging patched resources...")
updated = updated or fileutil.merge_into(PATCHED_RSC_DIR, MERGED_RSC_DIR, check_date=not first_time) updated = fileutil.merge_into(PATCHED_RSC_DIR, MERGED_RSC_DIR, check_date=not first_time) or updated
print("Merging dex files...") print("Merging dex files...")
updated = updated or fileutil.merge_into(COMPILED_SMALI_DIR, MERGED_RSC_DIR, check_date=not first_time) updated = fileutil.merge_into(COMPILED_SMALI_DIR, MERGED_RSC_DIR, check_date=not first_time) or updated
return updated return updated

View file

@ -15,7 +15,10 @@ def align_apk():
# Align the APK # Align the APK
print("Aligning APK...") print("Aligning APK...")
ALIGNED_APK.parent.mkdir(exist_ok=True) ALIGNED_APK.parent.mkdir(exist_ok=True)
_ = subprocess.run([ZIPALIGN, '-pvf', '4', ASSEMBLED_APK, ALIGNED_APK]) res = subprocess.run([ZIPALIGN, '-pvf', '4', ASSEMBLED_APK, ALIGNED_APK])
if res.returncode != 0:
print("Error ocurred while aligning")
exit(res.returncode)
def sign_apk(): def sign_apk():
updated = align_apk() updated = align_apk()