summaryrefslogtreecommitdiff
path: root/xmake/core/tool/compiler.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2023-02-27 23:10:14 +0800
committerruki <[email protected]>2023-02-27 23:10:14 +0800
commite965be5351fdad4e51f6dc5a925b936a3a6d0369 (patch)
tree3e90e2bfae5c559fab75a1e40d358cdf0352f8f0 /xmake/core/tool/compiler.lua
parentba3b6f151515c3ea1e400e489e2661f87ce2e032 (diff)
fix load tool
Diffstat (limited to 'xmake/core/tool/compiler.lua')
-rw-r--r--xmake/core/tool/compiler.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmake/core/tool/compiler.lua b/xmake/core/tool/compiler.lua
index c610116c7..b20591d3c 100644
--- a/xmake/core/tool/compiler.lua
+++ b/xmake/core/tool/compiler.lua
@@ -153,9 +153,6 @@ function compiler.load(sourcekind, target)
-- init flag kinds
instance._FLAGKINDS = table.wrap(result:sourceflags()[sourcekind])
- -- save this instance
- compiler._INSTANCES[cachekey] = instance
-
-- add toolchains flags to the compiler tool, e.g. gcc.cxflags or cxflags
local toolname = compiler_tool:name()
if target and target.toolconfig then
@@ -174,6 +171,10 @@ function compiler.load(sourcekind, target)
if not ok then
return nil, errors
end
+
+ -- @note we have to save it after the load to avoid
+ -- other concurrent processes going ahead and getting an incomplete instance of the tool.
+ compiler._INSTANCES[cachekey] = instance
return instance
end