diff options
| author | ruki <[email protected]> | 2025-12-17 00:35:47 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-12-17 00:35:47 +0800 |
| commit | 838e5387f94de362bbb58cff2d93ae193b72689f (patch) | |
| tree | db88434daab1cd053bb4f9af38f7c87c99d08734 /xmake/rules | |
| parent | e9cc5c5f4627b2df658310371e43557ae00c2e1e (diff) | |
add custom glue test
Diffstat (limited to 'xmake/rules')
| -rw-r--r-- | xmake/rules/platform/android/package.lua | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/xmake/rules/platform/android/package.lua b/xmake/rules/platform/android/package.lua index 00142a85f..42e4ac80e 100644 --- a/xmake/rules/platform/android/package.lua +++ b/xmake/rules/platform/android/package.lua @@ -35,6 +35,19 @@ function main(target, opt) assert(android_sdk_version, "android sdk version not set") assert(android_manifest, "android manifest not set") + if not path.is_absolute(android_manifest) then + android_manifest = path.join(target:scriptdir(), android_manifest) + end + if keystore and not path.is_absolute(keystore) then + keystore = path.join(target:scriptdir(), keystore) + end + if android_res and not path.is_absolute(android_res) then + android_res = path.join(target:scriptdir(), android_res) + end + if android_assets and not path.is_absolute(android_assets) then + android_assets = path.join(target:scriptdir(), android_assets) + end + local final_apk = path.join(target:targetdir(), target:basename() .. ".apk") -- add dependencies @@ -55,7 +68,15 @@ function main(target, opt) os.mkdir(path.join(tmp_path, "lib", target:arch())) -- copy the target library to temp folder with name libmain.so - local libfile = path.join(tmp_path, "lib", target:arch(), "libmain.so") + local libname = "libmain.so" + local manifest_xml = io.readfile(android_manifest) + if manifest_xml then + local lib_name_meta = manifest_xml:match('android:name="android.app.lib_name"%s+android:value="([^"]+)"') + if lib_name_meta then + libname = "lib" .. lib_name_meta .. ".so" + end + end + local libfile = path.join(tmp_path, "lib", target:arch(), libname) os.cp(target:targetfile(), libfile) -- get android tool path @@ -87,7 +108,7 @@ function main(target, opt) os.vrunv(aapt, aapt_argv) -- pack libs - os.vrunv(aapt, {"add", "res_only.apk", "lib/" .. target:arch() .."/libmain.so"}, {curdir = tmp_path}) + os.vrunv(aapt, {"add", "res_only.apk", "lib/" .. target:arch() .."/" .. libname}, {curdir = tmp_path}) -- align apk local aligned_apk = path.join(tmp_path, "unsigned.apk") |
