208
208
209
209
-- get the program and name of the given tool kind
210
210
function _instance :tool (toolkind )
211
+ assert (self :_is_checked ())
211
212
-- ensure to do load for initializing toolset first
212
213
-- @note we cannot call self:check() here, because it can only be called on config
213
214
self :_load ()
270
271
-- do check, we only check it once for all architectures
271
272
function _instance :check ()
272
273
local checkok = true
273
- if not self ._CHECKED then
274
+ local checked = self :_is_checked ()
275
+ if not checked then
274
276
local on_check = self :_on_check ()
275
277
if on_check then
276
278
local ok , results_or_errors = sandbox .load (on_check , self )
@@ -280,7 +282,9 @@ function _instance:check()
280
282
os .raise (results_or_errors )
281
283
end
282
284
end
283
- self ._CHECKED = true
285
+ -- we need to persist this state
286
+ self :config_set (" __checked" , true )
287
+ self :configs_save ()
284
288
end
285
289
return checkok
286
290
end
@@ -374,6 +378,11 @@ function _instance:_is_loaded()
374
378
return self :info ():get (" __loaded" )
375
379
end
376
380
381
+ -- is checked?
382
+ function _instance :_is_checked ()
383
+ return self :config (" __checked" ) == true
384
+ end
385
+
377
386
-- get the tool description from the tool kind
378
387
function _instance :_description (toolkind )
379
388
local descriptions = self ._DESCRIPTIONS
@@ -708,8 +717,6 @@ function toolchain.load_fromfile(filepath, opt)
708
717
local scope_opt = {interpreter = toolchain ._interpreter (), deduplicate = true , enable_filter = true }
709
718
local info = scopeinfo .new (" toolchain" , fileinfo .info , scope_opt )
710
719
local instance = toolchain .load_withinfo (fileinfo .name , info , opt )
711
- -- we need to skip check
712
- instance ._CHECKED = true
713
720
return instance
714
721
end
715
722
@@ -800,6 +807,7 @@ function toolchain.toolconfig(toolchains, name, opt)
800
807
local toolconfig = cache :get2 (cachekey , name )
801
808
if toolconfig == nil then
802
809
for _ , toolchain_inst in ipairs (toolchains ) do
810
+ assert (toolchain_inst :_is_checked ())
803
811
local values = toolchain_inst :get (name )
804
812
if values then
805
813
toolconfig = toolconfig or {}
0 commit comments