ykit/buildtool/task/merge_resources.py

28 lines
859 B
Python

from .util import *
from . import fileutil
import shutil
# Task dependencies
from .patch_resources import patch_resources
from .patch_smali import patch_smali
# Merges resources from all the previous steps
def merge_resources():
_ = patch_resources()
_ = patch_smali()
first_time = False
# Copy original resources only the first time
if not MERGED_RSC_DIR.exists():
print("Merging original resources...")
shutil.copytree(EXTRACTED_DIR, MERGED_RSC_DIR, ignore=shutil.ignore_patterns("smali*"))
first_time = True
print("Merging patched resources...")
_ = fileutil.merge_into(PATCHED_RSC_DIR, MERGED_RSC_DIR, check_date=not first_time)
print("Merging patched smali...")
_ = fileutil.merge_into(PATCHED_SMALI_DIR, MERGED_RSC_DIR, check_date=not first_time)