diff options
| author | ruki <[email protected]> | 2022-09-28 23:32:11 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-09-28 23:32:11 +0800 |
| commit | 82bfc71e7810157e8f71d43d4a2d82b609c17bf9 (patch) | |
| tree | b4423cbcb251fa833f3773242f37af6b899768fd /xmake/core/project | |
| parent | 39237af067f83918549427b27e95b0f479984e47 (diff) | |
improve to load targets
Diffstat (limited to 'xmake/core/project')
| -rw-r--r-- | xmake/core/project/project.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua index 40ae3a74f..e47463a89 100644 --- a/xmake/core/project/project.lua +++ b/xmake/core/project/project.lua @@ -875,6 +875,7 @@ end -- get targets function project.targets() + local loading = false local targets = project._memcache():get("targets") if not targets then local errors @@ -883,6 +884,18 @@ function project.targets() os.raise(errors) end project._memcache():set("targets", targets) + loading = true + end + if loading then + -- do after_load() for targets + -- @note we must call it after finishing to cache targets + -- because we maybe will call project.targets() in after_load, we need avoid dead recursion loop + for _, t in ipairs(project.ordertargets()) do + local ok, errors = t:_load_after() + if not ok then + os.raise(errors or string.format("load target %s failed", t:name())) + end + end end return targets end |
