summaryrefslogtreecommitdiff
path: root/xmake/core/project
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-12 21:27:13 +0800
committerruki <[email protected]>2025-01-12 21:27:13 +0800
commit543fa337184df181eae18b35eb8f80c125ab8a84 (patch)
treedf9a70fea3cec29276a389fda86983c761ad16ac /xmake/core/project
parent5bc5ce579fe5af900fc5dd653dfde7be486ea9a1 (diff)
fix errors for apis
Diffstat (limited to 'xmake/core/project')
-rw-r--r--xmake/core/project/option.lua12
-rw-r--r--xmake/core/project/rule.lua4
-rw-r--r--xmake/core/project/target.lua4
3 files changed, 13 insertions, 7 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index 18b9dc363..0124c9f5f 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -45,11 +45,13 @@ local sandbox_module = require("sandbox/modules/import/core/sandbox/module")
-- new an instance
function _instance.new(name, info)
local instance = table.inherit(_instance)
- local parts = name:split("::", {plain = true})
- instance._NAME = parts[#parts]
- table.remove(parts)
- if #parts > 0 then
- instance._NAMESPACE = table.concat(parts, "::")
+ if name then
+ local parts = name:split("::", {plain = true})
+ instance._NAME = parts[#parts]
+ table.remove(parts)
+ if #parts > 0 then
+ instance._NAMESPACE = table.concat(parts, "::")
+ end
end
instance._INFO = info
instance._CACHEID = 1
diff --git a/xmake/core/project/rule.lua b/xmake/core/project/rule.lua
index 5d44f7c25..571790fc5 100644
--- a/xmake/core/project/rule.lua
+++ b/xmake/core/project/rule.lua
@@ -347,7 +347,9 @@ end
function rule.new(name, info, opt)
opt = opt or {}
local instance = table.inherit(_instance)
- instance:name_set(name)
+ if name then
+ instance:name_set(name)
+ end
instance._INFO = info
instance._PACKAGE = opt.package
if opt.package then
diff --git a/xmake/core/project/target.lua b/xmake/core/project/target.lua
index a8796076c..360edb9cc 100644
--- a/xmake/core/project/target.lua
+++ b/xmake/core/project/target.lua
@@ -57,7 +57,9 @@ function _instance.new(name, info)
local instance = table.inherit(_instance)
instance._INFO = info
instance._CACHEID = 1
- instance:name_set(name)
+ if name then
+ instance:name_set(name)
+ end
return instance
end