summaryrefslogtreecommitdiff
path: root/xmake/core/package/component.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-10-17 22:55:54 +0800
committerruki <[email protected]>2022-10-17 22:55:54 +0800
commita481c634dcc591198fb4d64a2f376a8da795e23c (patch)
treeb272020bfd0ef70cac780d5d2f12dae4d70c67a4 /xmake/core/package/component.lua
parent3cf635758acdcdafcc7199adc6e05d8747c5910a (diff)
get components
Diffstat (limited to 'xmake/core/package/component.lua')
-rw-r--r--xmake/core/package/component.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/xmake/core/package/component.lua b/xmake/core/package/component.lua
index d9f9b78dd..c37742662 100644
--- a/xmake/core/package/component.lua
+++ b/xmake/core/package/component.lua
@@ -36,11 +36,12 @@ local memcache = require("cache/memcache")
local config = require("project/config")
-- new an instance
-function _instance.new(name, info, opt)
+function _instance.new(name, opt)
opt = opt or {}
local instance = table.inherit(_instance)
- instance._NAME = name
- instance._INFO = info
+ instance._NAME = name
+ instance._INFO = nil -- TODO
+ instance._PACKAGE = opt.package
return instance
end
@@ -54,6 +55,11 @@ function _instance:type()
return "component"
end
+-- get the it's package
+function _instance:package()
+ return self._PACKAGE
+end
+
-- get the component configuration
function _instance:get(name)
return self._INFO:get(name)
@@ -84,8 +90,8 @@ function _instance:extraconf_set(name, item, key, value)
end
-- new component
-function component.new(name, info, opt)
- return _instance.new(name, info, opt)
+function component.new(name, opt)
+ return _instance.new(name, opt)
end
-- return module