summaryrefslogtreecommitdiff
path: root/xmake/rules/xcode
diff options
context:
space:
mode:
authorruki <[email protected]>2020-12-16 23:49:44 +0800
committerruki <[email protected]>2020-12-16 23:49:44 +0800
commitc3bec4b1e483f5bcf443cf1a26b3b8bd8cfa2fba (patch)
tree5ba61ef9a096a332a2862cb158fe4c19fd38d76f /xmake/rules/xcode
parentc0aafd82e851cbdbba2292e02df4ac23d00f9ae6 (diff)
improve app rules
Diffstat (limited to 'xmake/rules/xcode')
-rw-r--r--xmake/rules/xcode/application/build.lua4
-rw-r--r--xmake/rules/xcode/application/install.lua6
-rw-r--r--xmake/rules/xcode/application/load.lua6
-rw-r--r--xmake/rules/xcode/application/package.lua2
-rw-r--r--xmake/rules/xcode/application/run.lua4
-rw-r--r--xmake/rules/xcode/application/uninstall.lua4
-rw-r--r--xmake/rules/xcode/bundle/xmake.lua4
-rw-r--r--xmake/rules/xcode/storyboard/xmake.lua2
-rw-r--r--xmake/rules/xcode/xcassets/xmake.lua2
9 files changed, 17 insertions, 17 deletions
diff --git a/xmake/rules/xcode/application/build.lua b/xmake/rules/xcode/application/build.lua
index 432ab8bf9..a83e42684 100644
--- a/xmake/rules/xcode/application/build.lua
+++ b/xmake/rules/xcode/application/build.lua
@@ -41,7 +41,7 @@ function main (target, opt)
-- copy target file
local binarydir = contentsdir
- if is_plat("macosx") then
+ if target:is_plat("macosx") then
binarydir = path.join(contentsdir, "MacOS")
end
os.vcp(target:targetfile(), path.join(binarydir, path.filename(target:targetfile())))
@@ -72,7 +72,7 @@ function main (target, opt)
-- generate embedded.mobileprovision to *.app/embedded.mobileprovision
local mobile_provision_embedded = path.join(bundledir, "embedded.mobileprovision")
local mobile_provision = target:values("xcode.mobile_provision") or get_config("xcode_mobile_provision")
- if mobile_provision and is_plat("iphoneos") then
+ if mobile_provision and target:is_plat("iphoneos") then
os.tryrm(mobile_provision_embedded)
local provisions = codesign.mobile_provisions()
if provisions then
diff --git a/xmake/rules/xcode/application/install.lua b/xmake/rules/xcode/application/install.lua
index bc76248ab..dee303ce4 100644
--- a/xmake/rules/xcode/application/install.lua
+++ b/xmake/rules/xcode/application/install.lua
@@ -62,13 +62,13 @@ end
-- main entry
function main (target)
- if is_plat("iphoneos") then
- if is_arch("x86_64", "i386") then
+ if target:is_plat("iphoneos") then
+ if target:is_arch("x86_64", "i386") then
_install_for_ios_simulator(target)
else
_install_for_ios(target)
end
- elseif is_plat("macosx") then
+ elseif target: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 e4f76191e..7cf0625f0 100644
--- a/xmake/rules/xcode/application/load.lua
+++ b/xmake/rules/xcode/application/load.lua
@@ -29,7 +29,7 @@ function main (target)
-- get contents and resources directory
local contentsdir = bundledir
local resourcesdir = bundledir
- if is_plat("macosx") then
+ if target:is_plat("macosx") then
contentsdir = path.join(bundledir, "Contents")
resourcesdir = path.join(bundledir, "Contents", "Resources")
end
@@ -41,12 +41,12 @@ function main (target)
target:set("filename", target:basename())
-- set install directory
- if is_plat("macosx") and not target:get("installdir") then
+ if target:is_plat("macosx") and not target:get("installdir") then
target:set("installdir", "/Applications")
end
-- add frameworks
- if is_plat("macosx") then
+ if target:is_plat("macosx") then
target:add("frameworks", "AppKit")
else
target:add("frameworks", "UIKit")
diff --git a/xmake/rules/xcode/application/package.lua b/xmake/rules/xcode/application/package.lua
index d7aa9cbfd..bcf8d60fe 100644
--- a/xmake/rules/xcode/application/package.lua
+++ b/xmake/rules/xcode/application/package.lua
@@ -40,7 +40,7 @@ end
-- main entry
function main (target, opt)
- if is_plat("iphoneos") then
+ if target:is_plat("iphoneos") then
_package_for_ios(target)
end
end
diff --git a/xmake/rules/xcode/application/run.lua b/xmake/rules/xcode/application/run.lua
index 19bbf9b85..14a7c0f12 100644
--- a/xmake/rules/xcode/application/run.lua
+++ b/xmake/rules/xcode/application/run.lua
@@ -87,9 +87,9 @@ end
-- main entry
function main (target, opt)
- if is_plat("macosx") then
+ if target:is_plat("macosx") then
_run_on_macosx(target, opt)
- elseif is_plat("iphoneos") and is_arch("x86_64", "i386") then
+ elseif target:is_plat("iphoneos") and target:is_arch("x86_64", "i386") then
_run_on_simulator(target, opt)
else
raise("we can only run application on macOS or simulator!")
diff --git a/xmake/rules/xcode/application/uninstall.lua b/xmake/rules/xcode/application/uninstall.lua
index be06e9fff..421cb8e83 100644
--- a/xmake/rules/xcode/application/uninstall.lua
+++ b/xmake/rules/xcode/application/uninstall.lua
@@ -38,9 +38,9 @@ end
-- main entry
function main (target)
- if is_plat("iphoneos") then
+ if target:is_plat("iphoneos") then
_uninstall_for_ios(target)
- elseif is_plat("macosx") then
+ elseif target:is_plat("macosx") then
_uninstall_for_macosx(target)
end
end
diff --git a/xmake/rules/xcode/bundle/xmake.lua b/xmake/rules/xcode/bundle/xmake.lua
index c96fc72ac..9cbd92b6f 100644
--- a/xmake/rules/xcode/bundle/xmake.lua
+++ b/xmake/rules/xcode/bundle/xmake.lua
@@ -35,7 +35,7 @@ rule("xcode.bundle")
-- get contents and resources directory
local contentsdir = bundledir
local resourcesdir = bundledir
- if is_plat("macosx") then
+ if target:is_plat("macosx") then
contentsdir = path.join(bundledir, "Contents")
resourcesdir = path.join(bundledir, "Contents", "Resources")
end
@@ -74,7 +74,7 @@ rule("xcode.bundle")
progress.show(opt.progress, "${color.build.target}generating.xcode.$(mode) %s", path.filename(bundledir))
-- copy target file
- if is_plat("macosx") then
+ if target:is_plat("macosx") then
os.vcp(target:targetfile(), path.join(contentsdir, "MacOS", path.filename(target:targetfile())))
else
os.vcp(target:targetfile(), path.join(contentsdir, path.filename(target:targetfile())))
diff --git a/xmake/rules/xcode/storyboard/xmake.lua b/xmake/rules/xcode/storyboard/xmake.lua
index 95a9c9aed..bfa88e6e1 100644
--- a/xmake/rules/xcode/storyboard/xmake.lua
+++ b/xmake/rules/xcode/storyboard/xmake.lua
@@ -86,7 +86,7 @@ rule("xcode.storyboard")
-- do link
argv = {"--errors", "--warnings", "--notices", "--auto-activate-custom-fonts", "--output-format", "human-readable-text"}
- if is_plat("macosx") then
+ if target:is_plat("macosx") then
table.insert(argv, "--target-device")
table.insert(argv, "mac")
end
diff --git a/xmake/rules/xcode/xcassets/xmake.lua b/xmake/rules/xcode/xcassets/xmake.lua
index 31c26a56d..d20fc278c 100644
--- a/xmake/rules/xcode/xcassets/xmake.lua
+++ b/xmake/rules/xcode/xcassets/xmake.lua
@@ -88,7 +88,7 @@ rule("xcode.xcassets")
end
table.insert(argv, "--app-icon")
table.insert(argv, "AppIcon")
- if is_plat("iphoneos") then
+ if target:is_plat("iphoneos") then
table.insert(argv, "--enable-on-demand-resources")
table.insert(argv, "YES")
table.insert(argv, "--compress-pngs")