@@ -58,47 +58,24 @@ export async function findCurrentReplyIndexPath(replyPath: string) {
5858 return path . join ( replyPath , currentIndexFileName ) ;
5959}
6060
61- const ReplyFileReference = z . object ( {
62- kind : z . string ( ) ,
63- version : z . object ( {
64- major : z . number ( ) ,
65- minor : z . number ( ) ,
66- } ) ,
67- jsonFile : z . string ( ) ,
68- } ) ;
69-
7061/**
7162 * @see https://cmake.org/cmake/help/latest/manual/cmake-file-api.7.html#v1-reply-index-file
7263 */
7364const IndexReply = z . object ( {
74- cmake : z . object ( {
75- version : z . object ( {
76- major : z . number ( ) ,
77- minor : z . number ( ) ,
78- patch : z . number ( ) ,
79- suffix : z . string ( ) ,
80- string : z . string ( ) ,
81- isDirty : z . boolean ( ) ,
82- } ) ,
83- paths : z . object ( {
84- cmake : z . string ( ) ,
85- ctest : z . string ( ) ,
86- cpack : z . string ( ) ,
87- root : z . string ( ) ,
88- } ) ,
89- generator : z . object ( {
90- multiConfig : z . boolean ( ) ,
91- name : z . string ( ) ,
92- platform : z . string ( ) . optional ( ) ,
93- } ) ,
94- } ) ,
95- objects : z . array ( ReplyFileReference ) ,
9665 reply : z . object ( {
9766 "codemodel-v2" : z
98- . union ( [ ReplyFileReference , z . object ( { error : z . string ( ) } ) ] )
67+ . union ( [
68+ z . object ( {
69+ kind : z . string ( ) ,
70+ version : z . object ( {
71+ major : z . number ( ) ,
72+ minor : z . number ( ) ,
73+ } ) ,
74+ jsonFile : z . string ( ) ,
75+ } ) ,
76+ z . object ( { error : z . string ( ) } ) ,
77+ ] )
9978 . optional ( ) ,
100- // TODO: Add other known <kind>-v<major> properties
101- // TODO: Add the <unknown> and client-<client> properties
10279 } ) ,
10380} ) ;
10481
@@ -124,36 +101,10 @@ const CodeModelV2 = z.object({
124101 configurations : z . array (
125102 z . object ( {
126103 name : z . string ( ) ,
127- directories : z . array (
128- z . object ( {
129- source : z . string ( ) ,
130- build : z . string ( ) ,
131- parentIndex : z . number ( ) . optional ( ) ,
132- childIndexes : z . array ( z . number ( ) ) . optional ( ) ,
133- projectIndex : z . number ( ) ,
134- targetIndexes : z . array ( z . number ( ) ) ,
135- minimumCMakeVersion : z . object ( {
136- string : z . string ( ) ,
137- } ) ,
138- hasInstallRule : z . boolean ( ) . optional ( ) ,
139- jsonFile : z . string ( ) . optional ( ) ,
140- } ) ,
141- ) ,
142- projects : z . array (
143- z . object ( {
144- name : z . string ( ) ,
145- parentIndex : z . number ( ) . optional ( ) ,
146- childIndexes : z . array ( z . number ( ) ) . optional ( ) ,
147- directoryIndexes : z . array ( z . number ( ) ) ,
148- targetIndex : z . array ( z . number ( ) ) . optional ( ) ,
149- } ) ,
150- ) ,
151104 targets : z . array (
152105 z . object ( {
153106 name : z . string ( ) ,
154107 id : z . string ( ) ,
155- directoryIndex : z . number ( ) ,
156- projectIndex : z . number ( ) ,
157108 jsonFile : z . string ( ) ,
158109 } ) ,
159110 ) ,
@@ -209,126 +160,12 @@ export async function readCurrentTargets(
209160 return relevantConfig . targets ;
210161}
211162
212- const BacktraceGraphNode = z . object ( {
213- file : z . number ( ) ,
214- line : z . number ( ) . int ( ) . positive ( ) . optional ( ) ,
215- command : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
216- parent : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
217- } ) ;
218- const BacktraceGraph = z . object ( {
219- nodes : z . array ( BacktraceGraphNode ) ,
220- commands : z . array ( z . string ( ) ) ,
221- files : z . array ( z . string ( ) ) ,
222- } ) ;
223-
224163const Artifact = z . object ( {
225164 path : z . string ( ) ,
226165} ) ;
227166
228- const LinkCommandFragment = z . object ( {
229- fragment : z . string ( ) ,
230- role : z . enum ( [ "flags" , "libraries" , "libraryPath" , "frameworkPath" ] ) ,
231- } ) ;
232-
233- const LinkInfo = z . object ( {
234- language : z . string ( ) ,
235- commandFragments : z . array ( LinkCommandFragment ) . optional ( ) ,
236- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
237- lto : z . boolean ( ) . optional ( ) ,
238- sysroot : z
239- . object ( {
240- path : z . string ( ) ,
241- } )
242- . optional ( ) ,
243- } ) ;
244-
245- const ArchiveInfo = z . object ( {
246- commandFragments : z
247- . array (
248- z . object ( {
249- fragment : z . string ( ) ,
250- role : z . literal ( "flags" ) ,
251- } ) ,
252- )
253- . optional ( ) ,
254- lto : z . boolean ( ) . optional ( ) ,
255- } ) ;
256-
257- const IncludeDir = z . object ( {
258- path : z . string ( ) ,
259- isSystem : z . boolean ( ) . optional ( ) ,
260- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
261- } ) ;
262-
263- const FrameworkDir = z . object ( {
264- path : z . string ( ) ,
265- isSystem : z . boolean ( ) . optional ( ) ,
266- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
267- } ) ;
268-
269- const CompileFragment = z . object ( {
270- fragment : z . string ( ) ,
271- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
272- } ) ;
273-
274- const CompileGroup = z . object ( {
275- sourceIndexes : z . array ( z . number ( ) . int ( ) . nonnegative ( ) ) ,
276- } ) ;
277-
278- const SourceEntry = z . object ( {
279- path : z . string ( ) ,
280- compileGroupIndex : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
281- sourceGroupIndex : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
282- isGenerated : z . boolean ( ) . optional ( ) ,
283- fileSetIndex : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
284- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
285- } ) ;
286-
287- const SourceLanguageStandard = z . object ( {
288- standard : z . string ( ) ,
289- backtraces : z . array ( z . number ( ) . int ( ) . nonnegative ( ) ) . optional ( ) ,
290- } ) ;
291-
292- const FileSetTargetRef = z . object ( {
293- id : z . string ( ) ,
294- index : z . number ( ) . int ( ) . nonnegative ( ) ,
295- } ) ;
296-
297- const FileSet = z . object ( {
298- name : z . string ( ) ,
299- type : z . string ( ) ,
300- visibility : z . enum ( [ "PUBLIC" , "PRIVATE" , "INTERFACE" ] ) ,
301- baseDirectories : z . array ( z . string ( ) ) ,
302- // optional depending on version
303- fileSetTarget : FileSetTargetRef . optional ( ) ,
304- } ) ;
305-
306- const Dependency = z . object ( {
307- id : z . string ( ) ,
308- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
309- } ) ;
310-
311- const Launcher = z . object ( {
312- command : z . string ( ) ,
313- arguments : z . array ( z . string ( ) ) . optional ( ) ,
314- type : z . enum ( [ "emulator" , "test" ] ) ,
315- } ) ;
316-
317- const InstallDestination = z . object ( {
318- path : z . string ( ) ,
319- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
320- } ) ;
321-
322- const Install = z . object ( {
323- prefix : z . object ( {
324- path : z . string ( ) ,
325- } ) ,
326- destinations : z . array ( InstallDestination ) ,
327- } ) ;
328-
329167const Target = z . object ( {
330168 name : z . string ( ) ,
331- id : z . string ( ) ,
332169 type : z . enum ( [
333170 "EXECUTABLE" ,
334171 "STATIC_LIBRARY" ,
@@ -338,42 +175,7 @@ const Target = z.object({
338175 "INTERFACE_LIBRARY" ,
339176 "UTILITY" ,
340177 ] ) ,
341- backtrace : z . number ( ) . int ( ) . nonnegative ( ) . optional ( ) ,
342- folder : z
343- . object ( {
344- name : z . string ( ) ,
345- } )
346- . optional ( ) ,
347- paths : z . object ( {
348- source : z . string ( ) ,
349- build : z . string ( ) ,
350- } ) ,
351- nameOnDisk : z . string ( ) . optional ( ) ,
352178 artifacts : z . array ( Artifact ) . optional ( ) ,
353- isGeneratorProvided : z . boolean ( ) . optional ( ) ,
354- install : Install . optional ( ) ,
355- launchers : z . array ( Launcher ) . optional ( ) ,
356- link : LinkInfo . optional ( ) ,
357- archive : ArchiveInfo . optional ( ) ,
358- debugger : z . record ( z . string ( ) , z . any ( ) ) . optional ( ) , // Because spec says debugger entries as object
359- workingDirectory : z . string ( ) . optional ( ) ,
360- dependencies : z . array ( Dependency ) . optional ( ) ,
361- fileSets : z . array ( FileSet ) . optional ( ) ,
362- sources : z . array ( SourceEntry ) . optional ( ) ,
363- sourceGroups : z
364- . array (
365- z . object ( {
366- name : z . string ( ) ,
367- sourceIndexes : z . array ( z . number ( ) . int ( ) . nonnegative ( ) ) ,
368- } ) ,
369- )
370- . optional ( ) ,
371- compileGroups : z . array ( CompileGroup ) . optional ( ) ,
372- languageStandard : SourceLanguageStandard . optional ( ) ,
373- compileCommandFragments : z . array ( CompileFragment ) . optional ( ) ,
374- includes : z . array ( IncludeDir ) . optional ( ) ,
375- frameworks : z . array ( FrameworkDir ) . optional ( ) ,
376- backtraceGraph : BacktraceGraph ,
377179} ) ;
378180
379181export async function readTarget ( targetPath : string ) {
0 commit comments