diff options
| author | ruki <[email protected]> | 2023-02-27 23:10:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-02-27 23:10:14 +0800 |
| commit | e965be5351fdad4e51f6dc5a925b936a3a6d0369 (patch) | |
| tree | 3e90e2bfae5c559fab75a1e40d358cdf0352f8f0 | |
| parent | ba3b6f151515c3ea1e400e489e2661f87ce2e032 (diff) | |
fix load tool
| -rw-r--r-- | xmake/core/tool/compiler.lua | 7 | ||||
| -rw-r--r-- | xmake/core/tool/linker.lua | 7 |
2 files changed, 8 insertions, 6 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 diff --git a/xmake/core/tool/linker.lua b/xmake/core/tool/linker.lua index 2682acc9a..717936b6c 100644 --- a/xmake/core/tool/linker.lua +++ b/xmake/core/tool/linker.lua @@ -177,9 +177,6 @@ function linker.load(targetkind, sourcekinds, target) -- init flag kinds instance._FLAGKINDS = {linkerinfo.linkerflag} - -- save this instance - builder._INSTANCES[cachekey] = instance - -- add toolchains flags to the linker tool -- add special lanugage flags first, e.g. go.gcldflags or gcc.ldflags or gcldflags or ldflags local toolkind = linkertool:kind() @@ -202,6 +199,10 @@ function linker.load(targetkind, sourcekinds, 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. + builder._INSTANCES[cachekey] = instance return instance end |
