@@ -15,6 +15,7 @@ extension SSGC
1515 let  id : ID 
1616
1717 let  scratch : PackageBuildDirectory 
18+  let  cache : FilePath . Directory ? 
1819
1920 /// Additional flags to pass to the Swift compiler.
2021 var  flags : Flags 
@@ -26,12 +27,14 @@ extension SSGC
2627 private 
2728 init ( id: ID , 
2829 scratch: PackageBuildDirectory , 
30+  cache: FilePath . Directory ? , 
2931 flags: Flags , 
3032 root: FilePath . Directory , 
3133 type: ProjectType ) 
3234 { 
3335 self . id =  id
3436 self . scratch =  scratch
37+  self . cache =  cache
3538 self . flags =  flags
3639 self . root =  root
3740 self . type =  type
@@ -81,8 +84,8 @@ extension SSGC.PackageBuild
8184 /// The type of project to build.
8285 /// - flags:
8386 /// Additional flags to pass to the Swift compiler.
84-  public   static 
85-  func  local( project location: FilePath . Directory , 
87+  public 
88+  static   func  local( project location: FilePath . Directory , 
8689 using scratchName: FilePath . Component  =  " .build.ssgc " , 
8790 as type: SSGC . ProjectType  =  . package , 
8891 flags: Flags  =  . init( ) )  ->  Self 
@@ -103,6 +106,7 @@ extension SSGC.PackageBuild
103106
104107 return  . init( id:  . unversioned( . init( last. string) ) , 
105108 scratch:  scratch, 
109+  cache:  nil , 
106110 flags:  flags, 
107111 root:  location, 
108112 type:  type) 
@@ -124,8 +128,8 @@ extension SSGC.PackageBuild
124128 /// The type of project to build.
125129 /// - workspace:
126130 /// The directory in which this function will create folders.
127-  public   static 
128-  func  remote( project projectName: Symbol . Package , 
131+  public 
132+  static   func  remote( project projectName: Symbol . Package , 
129133 from repository: String , 
130134 at refName: String , 
131135 as type: SSGC . ProjectType  =  . package , 
@@ -153,6 +157,7 @@ extension SSGC.PackageBuild
153157
154158 return  . init( id:  . versioned( pin,  ref:  refName,  date:  checkout. date) , 
155159 scratch:  scratch, 
160+  cache:  workspace. cache, 
156161 flags:  flags, 
157162 root:  checkout. location, 
158163 type:  type) 
@@ -162,22 +167,16 @@ extension SSGC.PackageBuild
162167extension  SSGC . PackageBuild : SSGC . DocumentationBuild 
163168{ 
164169 func  compile( updating status: SSGC . StatusStream ? , 
165-  cache: FilePath . Directory , 
166170 with toolchain: SSGC . Toolchain , 
167171 clean: Bool  =  true )  throws  ->  ( SymbolGraphMetadata ,  any  SSGC . DocumentationSources ) 
168172 { 
169173 switch  self . type
170174 { 
171175 case  . package : 
172-  try self . compileSwiftPM ( updating:  status, 
173-  cache:  cache, 
174-  with:  toolchain, 
175-  clean:  clean) 
176+  try self . compileSwiftPM ( updating:  status,  with:  toolchain,  clean:  clean) 
176177
177178 case  . book: 
178-  try self . compileBook ( updating:  status, 
179-  cache:  cache, 
180-  with:  toolchain) 
179+  try self . compileBook ( updating:  status,  with:  toolchain) 
181180 } 
182181 } 
183182} 
@@ -186,7 +185,6 @@ extension SSGC.PackageBuild
186185{ 
187186 @_spi ( testable)   public 
188187 func  compileBook( updating status: SSGC . StatusStream ? =  nil , 
189-  cache _: FilePath . Directory , 
190188 with toolchain: SSGC . Toolchain )  throws  ->  ( SymbolGraphMetadata ,  SSGC . BookSources ) 
191189 { 
192190 switch  self . id
@@ -232,7 +230,6 @@ extension SSGC.PackageBuild
232230
233231 @_spi ( testable)   public 
234232 func  compileSwiftPM( updating status: SSGC . StatusStream ? =  nil , 
235-  cache _: FilePath . Directory , 
236233 with toolchain: SSGC . Toolchain , 
237234 clean: Bool  =  true )  throws  ->  ( SymbolGraphMetadata ,  SSGC . PackageSources ) 
238235 { 
@@ -324,7 +321,7 @@ extension SSGC.PackageBuild
324321
325322 // Dump the standard library’s symbols, unless they’re already cached.
326323 let  symbolsCached : FilePath . Directory  =  try . dump ( stdlib:  stdlib, 
327-  cache:  artifacts) 
324+  cache:  self . cache  ??   artifacts) 
328325
329326 let  symbols : FilePath . Directory  =  artifacts /  " symbols " 
330327 try . create ( clean:  false ) 
0 commit comments