summaryrefslogtreecommitdiff
path: root/xmake/core/project
diff options
context:
space:
mode:
authorruki <[email protected]>2021-03-20 00:50:56 +0800
committerruki <[email protected]>2021-03-20 00:50:56 +0800
commit7556e19a1193841aa49871ffab35bc3e56bd481e (patch)
tree2a72103ca495abb12797a6a4ee08a3fbaa81da64 /xmake/core/project
parentc1261619d8e7330a1a99e50a73b5baddf2dd66f4 (diff)
pass extraconf to package
Diffstat (limited to 'xmake/core/project')
-rw-r--r--xmake/core/project/project.lua26
1 files changed, 21 insertions, 5 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index aa2c36ff2..e1e328914 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -194,10 +194,8 @@ function project._load(force, disable_filter)
end
-- save the root info
- for name, value in pairs(rootinfo_target:info()) do
- rootinfo:set("target." .. name, value)
- end
project._memcache():set("rootinfo", rootinfo)
+ project._memcache():set("rootinfo_target", rootinfo_target)
-- leave the project directory
oldir, errors = os.cd(oldir)
@@ -844,12 +842,30 @@ function project.filelock()
return filelock, errors
end
--- get the project info from the given name
+-- get the root configuration
function project.get(name)
- local rootinfo = project._memcache():get("rootinfo")
+ local rootinfo
+ if name and name:startswith("target.") then
+ name = name:sub(8)
+ rootinfo = project._memcache():get("rootinfo_target")
+ else
+ rootinfo = project._memcache():get("rootinfo")
+ end
return rootinfo and rootinfo:get(name) or nil
end
+-- get the root extra configuration
+function project.extraconf(name, item, key)
+ local rootinfo
+ if name and name:startswith("target.") then
+ name = name:sub(8)
+ rootinfo = project._memcache():get("rootinfo_target")
+ else
+ rootinfo = project._memcache():get("rootinfo")
+ end
+ return rootinfo and rootinfo:extraconf(name, item, key) or nil
+end
+
-- get the project name
function project.name()
local name = project.get("project")