2024-08-17 20:16:36 +00:00
|
|
|
from .util import *
|
|
|
|
from . import fileutil
|
|
|
|
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
# Task dependencies
|
|
|
|
from .patch_resources import patch_resources
|
2024-08-17 22:39:32 +00:00
|
|
|
from .compile_smali import compile_smali
|
2024-08-17 20:16:36 +00:00
|
|
|
|
|
|
|
# Merges resources from all the previous steps
|
|
|
|
|
|
|
|
def merge_resources():
|
|
|
|
_ = patch_resources()
|
2024-08-17 22:39:32 +00:00
|
|
|
_ = compile_smali()
|
2024-08-17 20:16:36 +00:00
|
|
|
|
|
|
|
first_time = False
|
|
|
|
|
|
|
|
# Copy original resources only the first time
|
|
|
|
if not MERGED_RSC_DIR.exists():
|
|
|
|
print("Merging original resources...")
|
2024-08-17 22:39:32 +00:00
|
|
|
shutil.copytree(EXTRACTED_DIR, MERGED_RSC_DIR, ignore=shutil.ignore_patterns("smali", "smali_classes*"))
|
2024-08-17 20:16:36 +00:00
|
|
|
first_time = True
|
|
|
|
|
2024-08-19 18:27:16 +00:00
|
|
|
updated = first_time
|
|
|
|
|
2024-08-19 23:24:18 +00:00
|
|
|
# Make sure to place "or updated" *after* the statement, not before, because 'and' and 'or' are short-circuting... ya idiot
|
|
|
|
|
2024-08-17 20:16:36 +00:00
|
|
|
print("Merging patched resources...")
|
2024-08-19 23:24:18 +00:00
|
|
|
updated = fileutil.merge_into(PATCHED_RSC_DIR, MERGED_RSC_DIR, check_date=not first_time) or updated
|
2024-08-17 22:39:32 +00:00
|
|
|
print("Merging dex files...")
|
2024-08-19 23:24:18 +00:00
|
|
|
updated = fileutil.merge_into(COMPILED_SMALI_DIR, MERGED_RSC_DIR, check_date=not first_time) or updated
|
2024-08-19 18:27:16 +00:00
|
|
|
|
|
|
|
return updated
|