summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-04-15 22:35:22 +0800
committerruki <[email protected]>2021-04-15 22:35:22 +0800
commit4309e9b5d443ad3f4bf3b6b5c444b6668f1781a7 (patch)
tree534fc87c8c164b5f0a18a275780c17dd3af7824c
parent452296643e9565ca2c7bd5be047f0f42836fd0de (diff)
improve xrepo env
-rw-r--r--xmake/actions/config/configheader.lua14
-rw-r--r--xmake/core/project/project.lua5
-rw-r--r--xmake/modules/private/xrepo/action/env.lua1
3 files changed, 9 insertions, 11 deletions
diff --git a/xmake/actions/config/configheader.lua b/xmake/actions/config/configheader.lua
index 7372f07c8..f57e3efaf 100644
--- a/xmake/actions/config/configheader.lua
+++ b/xmake/actions/config/configheader.lua
@@ -78,16 +78,12 @@ end
-- make the configure file for the given target and dependents
function _make_for_target_with_deps(targetname)
-
- -- the target
local target = project.target(targetname)
-
- -- make configure for the target
- _make_for_target(target)
-
- -- make configure for the dependent targets?
- for _, dep in ipairs(target:get("deps")) do
- _make_for_target_with_deps(dep)
+ if target then
+ _make_for_target(target)
+ for _, dep in ipairs(target:get("deps")) do
+ _make_for_target_with_deps(dep)
+ end
end
end
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index 2250bfa53..9bdb4ca4d 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -907,7 +907,8 @@ end
-- get the given target
function project.target(name)
- return project.targets()[name]
+ local targets = project.targets()
+ return targets and targets[name]
end
-- get targets
@@ -916,7 +917,7 @@ function project.targets()
if not targets then
local ordertargets, errors
targets, ordertargets, errors = project._load_targets()
- if not targets or not ordertargets then
+ if errors then
os.raise(errors)
end
project._memcache():set("targets", targets)
diff --git a/xmake/modules/private/xrepo/action/env.lua b/xmake/modules/private/xrepo/action/env.lua
index a6461dceb..703c497fc 100644
--- a/xmake/modules/private/xrepo/action/env.lua
+++ b/xmake/modules/private/xrepo/action/env.lua
@@ -210,6 +210,7 @@ end
function _package_getenvs()
local envs = os.getenvs()
if os.isfile(os.projectfile()) and not option.get("packages") then
+ task.run("config", {target = "all"}, {disable_dump = true})
local requires, requires_extra = get_requires()
for _, instance in ipairs(package.load_packages(requires, {requires_extra = requires_extra})) do
_package_addenvs(envs, instance)