summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2024-07-02 22:51:34 +0800
committerruki <[email protected]>2024-07-02 22:51:34 +0800
commitdaaf89c5108e92db407532f3002493d071f9e88f (patch)
treed0dbd4d9d3a55a44ec9a9e43b7f595a8a3550bed
parent9fd0a10896cc92a94afb07675c75e7bea86bf83d (diff)
fix load targets repeatly #5288
-rw-r--r--xmake/actions/test/main.lua3
-rw-r--r--xmake/core/sandbox/modules/import/core/project/project.lua12
-rw-r--r--xmake/plugins/pack/main.lua3
3 files changed, 6 insertions, 12 deletions
diff --git a/xmake/actions/test/main.lua b/xmake/actions/test/main.lua
index 852f00662..e2cc57be2 100644
--- a/xmake/actions/test/main.lua
+++ b/xmake/actions/test/main.lua
@@ -348,9 +348,6 @@ function main()
-- load config first
task.run("config", {}, {disable_dump = true})
- -- load targets
- project.load_targets()
-
-- get tests
local tests = {}
local group_pattern = option.get("group")
diff --git a/xmake/core/sandbox/modules/import/core/project/project.lua b/xmake/core/sandbox/modules/import/core/project/project.lua
index c197ff770..401fc9d61 100644
--- a/xmake/core/sandbox/modules/import/core/project/project.lua
+++ b/xmake/core/sandbox/modules/import/core/project/project.lua
@@ -200,12 +200,12 @@ end
-- load project targets
function sandbox_core_project.load_targets(opt)
-
- -- load package rules for targets
- sandbox_core_project._load_package_rules_for_targets()
-
- -- config targets
- sandbox_core_project._config_targets(opt)
+ local loaded = sandbox_core_project._LOADED
+ if not loaded then
+ sandbox_core_project._LOADED = true
+ sandbox_core_project._load_package_rules_for_targets()
+ sandbox_core_project._config_targets(opt)
+ end
end
-- get the filelock of the whole project directory
diff --git a/xmake/plugins/pack/main.lua b/xmake/plugins/pack/main.lua
index 960bebe03..9ca47074f 100644
--- a/xmake/plugins/pack/main.lua
+++ b/xmake/plugins/pack/main.lua
@@ -126,9 +126,6 @@ function main()
_build_targets()
end
- -- load targets
- project.load_targets()
-
-- do pack
_pack_packages()