diff options
| author | ruki <[email protected]> | 2020-04-10 22:58:21 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-10 11:50:12 +0800 |
| commit | 1307e332023cd31e061e0bd954201c5f41a44026 (patch) | |
| tree | a5e4f9f8854f3d1c8dab7c44ceae09e1fbbc4ce7 | |
| parent | 25121b2721dbcee151eaad958c55a54617eea60a (diff) | |
improve install and uninstall app
| -rw-r--r-- | xmake/actions/install/install.lua | 4 | ||||
| -rw-r--r-- | xmake/actions/uninstall/uninstall.lua | 17 | ||||
| -rw-r--r-- | xmake/rules/xcode/application/install.lua | 13 | ||||
| -rw-r--r-- | xmake/rules/xcode/application/load.lua | 5 | ||||
| -rw-r--r-- | xmake/rules/xcode/application/uninstall.lua | 23 |
5 files changed, 51 insertions, 11 deletions
diff --git a/xmake/actions/install/install.lua b/xmake/actions/install/install.lua index 6a03cfc4c..44d358c5f 100644 --- a/xmake/actions/install/install.lua +++ b/xmake/actions/install/install.lua @@ -114,7 +114,7 @@ function _do_install_target(target) end -- trace - print("installing to %s ...", installdir) + print("installing to %s ..", installdir) -- the scripts local scripts = @@ -143,7 +143,7 @@ function _on_install_target(target) end -- trace - print("installing %s ...", target:name()) + print("installing %s ..", target:name()) -- build target with rules local done = false diff --git a/xmake/actions/uninstall/uninstall.lua b/xmake/actions/uninstall/uninstall.lua index e120b0853..2d0909f3e 100644 --- a/xmake/actions/uninstall/uninstall.lua +++ b/xmake/actions/uninstall/uninstall.lua @@ -74,6 +74,15 @@ end -- do uninstall target function _do_uninstall_target(target) + -- get install directory + local installdir = target:installdir() + if not installdir then + return + end + + -- trace + print("uninstalling from %s ..", installdir) + -- the scripts local scripts = { @@ -100,14 +109,8 @@ function _on_uninstall_target(target) return end - -- get install directory - local installdir = target:installdir() - if not installdir then - return - end - -- trace - print("uninstalling %s from %s ...", target:name(), installdir) + print("uninstalling %s ..", target:name()) -- build target with rules local done = false diff --git a/xmake/rules/xcode/application/install.lua b/xmake/rules/xcode/application/install.lua index ffb34230c..fd90694f6 100644 --- a/xmake/rules/xcode/application/install.lua +++ b/xmake/rules/xcode/application/install.lua @@ -36,14 +36,23 @@ function _install_for_ios(target) -- do install os.vrunv(ideviceinstaller.program, {"-i", ipafile}) +end + +-- install for macosx +function _install_for_macosx(target) + + -- get app directory + local appdir = target:data("xcode.bundle.rootdir") - -- trace - cprint("${color.success}install ok!") + -- do install + os.vcp(appdir, target:installdir() or "/Applications/") end -- main entry function main (target) if is_plat("iphoneos") then _install_for_ios(target) + elseif is_plat("macosx") then + _install_for_macosx(target) end end diff --git a/xmake/rules/xcode/application/load.lua b/xmake/rules/xcode/application/load.lua index 071b94901..ddac69126 100644 --- a/xmake/rules/xcode/application/load.lua +++ b/xmake/rules/xcode/application/load.lua @@ -45,6 +45,11 @@ function main (target) target:set("targetdir", bundledir) end + -- set install directory + if is_plat("macosx") and not target:get("installdir") then + target:set("installdir", "/Applications") + end + -- add frameworks if is_plat("macosx") then target:add("frameworks", "AppKit") diff --git a/xmake/rules/xcode/application/uninstall.lua b/xmake/rules/xcode/application/uninstall.lua index 9f190bf60..31d0c899c 100644 --- a/xmake/rules/xcode/application/uninstall.lua +++ b/xmake/rules/xcode/application/uninstall.lua @@ -18,6 +18,29 @@ -- @file uninstall.lua -- +-- imports +import("lib.detect.find_tool") + +-- uninstall for ios +function _uninstall_for_ios(target) + -- TODO +end + +-- uninstall for macosx +function _uninstall_for_macosx(target) + + -- get app directory + local appdir = target:data("xcode.bundle.rootdir") + + -- do uninstall + os.rm(path.join(target:installdir() or "/Applications", path.filename(appdir))) +end + -- main entry function main (target) + if is_plat("iphoneos") then + _uninstall_for_ios(target) + elseif is_plat("macosx") then + _uninstall_for_macosx(target) + end end |
