Skip to content

Commit

Permalink
action: install apktool with choco and use os.path.join to combine pa…
Browse files Browse the repository at this point in the history
…th in gen_smali.py
  • Loading branch information
KuhakuPixel committed Mar 8, 2024
1 parent 4db0afc commit e67d230
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ jobs:
- uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: '21'
java-version: '17'

- name: "install build tools"
run: choco install apktool --version=2.5.0

- name: generating code for injection
working-directory: ./Modder/injector
Expand Down
15 changes: 10 additions & 5 deletions Modder/injector/gen_smali.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
import tempfile

# ============================= paths ==================
APK_SOURCE_ROOT_DIR = "./apk_source/hello-libs"
APK_SOURCE_ROOT_DIR = os.path.join("apk_source", "hello-libs")
APK_BUILT_OUTPUT_PATH = (
"apk_source/hello-libs/app/build/outputs/apk/debug/app-debug.apk"
os.path.join("apk_source", "hello-libs", "app","build","outputs","apk", "debug", "app-debug.apk")
)

OUT_CODE_FOR_INJECT_DIR = (
"../../Modder/modder/src/main/resources/AceAndroidLib/code_to_inject"
os.path.join("..", "..", "Modder","modder","src","main", "resources", "AceAndroidLib", "code_to_inject")
)
SMALI_RELATIVE_DIR = "smali/com/AceInjector"
SMALI_RELATIVE_DIR = os.path.join("smali", "com", "AceInjector")

OUT_SMALI_DIR = os.path.join(OUT_CODE_FOR_INJECT_DIR, SMALI_RELATIVE_DIR)
OUT_SMALI_DIR_ZIPPED_FILE = OUT_SMALI_DIR
Expand All @@ -59,7 +59,12 @@ def cp_folder(src: str, dest: str):
generated_native_lib_dir = os.path.join(temp_decompiled_apk_dir, "lib")

print("Generating temporary apk")
subprocess.run("./gradlew assembleDebug", cwd=APK_SOURCE_ROOT_DIR, shell=True)


if os.name == "posix":
subprocess.run("./gradlew assembleDebug", cwd=APK_SOURCE_ROOT_DIR, shell=True)
else:
subprocess.run("gradlew assembleDebug", cwd=APK_SOURCE_ROOT_DIR, shell=True)

# decode without resources and
# put the smali results in smali folder
Expand Down

0 comments on commit e67d230

Please sign in to comment.