summaryrefslogtreecommitdiff
path: root/xmake/rules/xcode
diff options
context:
space:
mode:
authorruki <[email protected]>2020-04-09 23:03:47 +0800
committerruki <[email protected]>2020-04-09 12:22:44 +0800
commit0a3f80680dc4cea8b3f6ac95c5cfc0380567a227 (patch)
tree3df6e66203d7cf6423ef98f243750f2215fec581 /xmake/rules/xcode
parent1cc0dbcfb9fa9d07fb84dd641b52a06259ec04cb (diff)
install ipa
Diffstat (limited to 'xmake/rules/xcode')
-rw-r--r--xmake/rules/xcode/application/install.lua30
-rw-r--r--xmake/rules/xcode/application/package.lua15
-rw-r--r--xmake/rules/xcode/application/uninstall.lua3
3 files changed, 37 insertions, 11 deletions
diff --git a/xmake/rules/xcode/application/install.lua b/xmake/rules/xcode/application/install.lua
index f235870ec..ffb34230c 100644
--- a/xmake/rules/xcode/application/install.lua
+++ b/xmake/rules/xcode/application/install.lua
@@ -18,12 +18,32 @@
-- @file install.lua
--
+-- imports
+import("lib.detect.find_tool")
+
+-- install for ios
+function _install_for_ios(target)
+
+ -- get app directory
+ local appdir = target:data("xcode.bundle.rootdir")
+
+ -- get *.ipa file
+ local ipafile = path.join(path.directory(appdir), path.basename(appdir) .. ".ipa")
+ assert(ipafile, "please run `xmake package` first!")
+
+ -- find ideviceinstaller
+ local ideviceinstaller = assert(find_tool("ideviceinstaller"), "ideviceinstaller not found!")
+
+ -- do install
+ os.vrunv(ideviceinstaller.program, {"-i", ipafile})
+
+ -- trace
+ cprint("${color.success}install ok!")
+end
+
-- main entry
function main (target)
- local bundledir = path.absolute(target:data("xcode.bundle.rootdir"))
- local installdir = target:installdir()
- if not os.isdir(installdir) then
- os.mkdir(installdir)
+ if is_plat("iphoneos") then
+ _install_for_ios(target)
end
- os.vcp(bundledir, installdir)
end
diff --git a/xmake/rules/xcode/application/package.lua b/xmake/rules/xcode/application/package.lua
index c9fd9dc51..059b7b219 100644
--- a/xmake/rules/xcode/application/package.lua
+++ b/xmake/rules/xcode/application/package.lua
@@ -21,17 +21,26 @@
-- imports
import("private.tools.ipagen")
--- main entry
-function main (target, opt)
+-- package for ios
+function _package_for_ios(target)
-- get app directory
local appdir = target:data("xcode.bundle.rootdir")
- -- generate *.ipa file
+ -- get *.ipa file
local ipafile = path.join(path.directory(appdir), path.basename(appdir) .. ".ipa")
+
+ -- generate *.ipa file
ipagen(appdir, ipafile)
-- trace
cprint("output: ${bright}%s", ipafile)
cprint("${color.success}package ok!")
end
+
+-- main entry
+function main (target, opt)
+ if is_plat("iphoneos") then
+ _package_for_ios(target)
+ end
+end
diff --git a/xmake/rules/xcode/application/uninstall.lua b/xmake/rules/xcode/application/uninstall.lua
index 1f9edb008..9f190bf60 100644
--- a/xmake/rules/xcode/application/uninstall.lua
+++ b/xmake/rules/xcode/application/uninstall.lua
@@ -20,7 +20,4 @@
-- main entry
function main (target)
- local bundledir = path.absolute(target:data("xcode.bundle.rootdir"))
- local installdir = target:installdir()
- os.tryrm(path.join(installdir, path.filename(bundledir)))
end