@@ -119,9 +119,31 @@ define function load-workspace
119119 & dp-file
120120 & (ws-file.locator-directory ~= dp-file.locator-directory))));
121121 ws-file & load-workspace-config(ws, ws-file);
122+ if (~ws.workspace-default-library-name)
123+ ws.workspace-default-library-name := find-default-library(ws);
124+ end ;
122125 ws
123126end function ;
124127
128+ define function find-default-library
129+ (ws :: <workspace>) => (name :: false-or (<string> ))
130+ block (return)
131+ let fallback = #f ;
132+ for (lids keyed-by package in ws.lids-by-release)
133+ for (lid in lids)
134+ let name = lid.library-name;
135+ fallback := fallback | name;
136+ if (ends-with?(name, "-test-suite-app" )
137+ | ends-with?(name, "-test-suite" )
138+ | ends-with?(name, "-tests" ))
139+ return(name);
140+ end ;
141+ end for ;
142+ end for ;
143+ fallback
144+ end block
145+ end function ;
146+
125147// Scan the workspace to find all active packages, from which the lids-by-* tables are
126148// populated and deps can be determined.
127149define function scan-workspace
@@ -176,26 +198,11 @@ end function;
176198// Load the workspace.json file
177199define function load-workspace-config
178200 (ws :: <workspace>, file :: <file-locator>) => ()
179- local method find-default-library ()
180- block (return)
181- let fallback = #f ;
182- for (lids keyed-by package in ws.lids-by-release)
183- for (lid in lids)
184- let name = lid.library-name;
185- fallback := fallback | name;
186- if (ends-with?(name, "-test-suite-app" )
187- | ends-with?(name, "-test-suite" )
188- | ends-with?(name, "-tests" ))
189- return(name);
190- end ;
191- end for ;
192- end for ;
193- fallback
194- end block ;
195- end method ;
196201 let json = load-json-file(file);
197- ws.workspace-default-library-name
198- := element (json, $default-library-key, default: #f ) | find-default-library();
202+ let deflib = element (json, $default-library-key, default: #f );
203+ if (deflib)
204+ ws.workspace-default-library-name := deflib;
205+ end ;
199206end function ;
200207
201208// Find the workspace directory. The nearest directory containing
0 commit comments