diff --git a/buildtool/task/assemble_apk.py b/buildtool/task/assemble_apk.py index a354512..6c0bd81 100644 --- a/buildtool/task/assemble_apk.py +++ b/buildtool/task/assemble_apk.py @@ -14,6 +14,9 @@ def assemble_apk(): # Assemble 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 \ No newline at end of file diff --git a/buildtool/task/fileutil.py b/buildtool/task/fileutil.py index 639cc4c..3654372 100644 --- a/buildtool/task/fileutil.py +++ b/buildtool/task/fileutil.py @@ -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) # 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 dest_file.parent.mkdir(parents=True, exist_ok=True) diff --git a/buildtool/task/merge_resources.py b/buildtool/task/merge_resources.py index c0ec436..f0f199c 100644 --- a/buildtool/task/merge_resources.py +++ b/buildtool/task/merge_resources.py @@ -23,9 +23,11 @@ def merge_resources(): 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...") - 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...") - 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 \ No newline at end of file diff --git a/buildtool/task/sign_apk.py b/buildtool/task/sign_apk.py index 13b5f2a..f8a848d 100644 --- a/buildtool/task/sign_apk.py +++ b/buildtool/task/sign_apk.py @@ -15,7 +15,10 @@ def align_apk(): # Align the APK print("Aligning APK...") 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(): updated = align_apk()