diff options
| -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 |
