diff options
| author | Yi Jianlong <[email protected]> | 2025-12-11 23:17:35 +0800 |
|---|---|---|
| committer | Yi Jianlong <[email protected]> | 2025-12-11 23:17:35 +0800 |
| commit | 55612e6ab2b5b9c4201845244965aa11c3ffabab (patch) | |
| tree | b238113246b4fdb4f44f06ee526203b1fb78e15f | |
| parent | 1d60c8b376198b879685e9bf8a9f199a8697a606 (diff) | |
resolve review comments
| -rw-r--r-- | xmake/rules/android/android_install.lua | 7 | ||||
| -rw-r--r-- | xmake/rules/android/android_run.lua | 2 | ||||
| -rw-r--r-- | xmake/rules/android/xmake.lua | 9 |
3 files changed, 8 insertions, 10 deletions
diff --git a/xmake/rules/android/android_install.lua b/xmake/rules/android/android_install.lua index 5c05ba498..97b78609b 100644 --- a/xmake/rules/android/android_install.lua +++ b/xmake/rules/android/android_install.lua @@ -19,8 +19,7 @@ function main(target, android_sdk_version, android_manifest, android_res, androi if os.exists(source_lib) then os.mv(source_lib, dest_lib) else - cprint("${red}can't find source lib " .. source_lib) - exit(1) + os.raise("can't find source lib: " .. source_lib) end import("core.tool.toolchain") @@ -66,8 +65,8 @@ function main(target, android_sdk_version, android_manifest, android_res, androi --------------------------------------- pack libs local curdir = os.cd(outputpath) - os.vrunv(aapt, {"add", "temp/res_only.apk", "lib/arm64-v8a/libmain.so"}) - cprint("${green}[Android][Packing library]${white} Adding lib/arm64-v8a/libmain.so to res_only.apk...") + os.vrunv(aapt, {"add", "temp/res_only.apk", path.join("lib", target:arch(), "libmain.so")}) + cprint("${green}[Android][Packing library]${white} Adding lib/" .. target:arch() .. "/libmain.so to res_only.apk...") os.cd(curdir) --------------------------------------- align apk diff --git a/xmake/rules/android/android_run.lua b/xmake/rules/android/android_run.lua index d758ba404..c3c3cbaf8 100644 --- a/xmake/rules/android/android_run.lua +++ b/xmake/rules/android/android_run.lua @@ -1,7 +1,7 @@ function main(target, apk_output_path, package_name, activity_name) import("core.tool.toolchain") local toolchain_ndk = toolchain.load("ndk", {plat = target:plat(), arch = target:arch()}) - local android_sdkdir = path.translate(toolchain_ndk:config("android_sdk")) + local android_sdkdir = path.translate(assert(toolchain_ndk:config("android_sdk"), "please run `xmake f --android_sdk=xxx` to set the android sdk directory!")) local adb = path.join(android_sdkdir, "platform-tools", "adb" .. (is_host("windows") and ".exe" or "")) local outputpath = path.join("build", "android", "output") diff --git a/xmake/rules/android/xmake.lua b/xmake/rules/android/xmake.lua index d83041e25..9b7c05350 100644 --- a/xmake/rules/android/xmake.lua +++ b/xmake/rules/android/xmake.lua @@ -15,9 +15,8 @@ rule("android.cpp") local native_app_glue_path = path.join(ndk_root, "sources", "android", "native_app_glue") -- Add glue file and jni interface file to target - local conf = target:extraconf("rules", "android.cpp") - local jni_inferface = conf.jni_interface - target:add("files", jni_inferface) + local conf = target:extraconf("rules", "android.cpp") + target:add("files", conf.jni_interface) target:add("files", path.join(native_app_glue_path, "android_native_app_glue.c")) target:add("includedirs", native_app_glue_path) end) @@ -28,8 +27,8 @@ rule("android.cpp") local android_manifest = conf.android_manifest local android_res = conf.android_res local android_assets = conf.android_assets - local keystore = conf.keystore - local keystore_pass = conf.keystore_pass or "123456" + local keystore = assert(conf.keystore, "android.cpp rule requires `keystore` to be set") + local keystore_pass = assert(conf.keystore_pass, "android.cpp rule requires `keystore_pass` to be set") local apk_output_path = conf.apk_output_path or "." local attachedjar = conf.attachedjar |
