@@ -12,6 +12,7 @@ import {logger, spawn} from './utils';
1212export abstract class PatchGenerator < S extends { id : string , range : string } > {
1313 protected readonly tmp : PortablePath ;
1414 protected readonly patches : PortablePath ;
15+ protected noCache = process . env . GEN_PATCHES_NO_CACHE !== undefined ;
1516
1617 public constructor (
1718 public readonly name : string ,
@@ -223,6 +224,18 @@ export abstract class PatchGenerator<S extends {id: string, range: string}> {
223224 }
224225
225226 process . off ( `exit` , clearBuildCache ) ;
227+
228+ if ( this . noCache ) {
229+ await logger . section ( `Clean cache` , async ( ) => {
230+ const versions = await this . getValidateVersions ( slice ) ;
231+ await Promise . all ( [
232+ xfs . removePromise ( ppath . join ( this . tmp , `builds` , slice . id as Filename ) ) ,
233+ ...versions . map ( version => xfs . removePromise ( ppath . join ( this . tmp , `validate` , version as Filename ) ) ) ,
234+ ...versions . map ( version => xfs . removePromise ( ppath . join ( this . tmp , `tarballs` , `${ version } .tgz` ) ) ) ,
235+ ] ) ;
236+ } ) ;
237+ }
238+
226239 return content ;
227240 } ) ;
228241 }
@@ -284,6 +297,11 @@ export abstract class PatchGenerator<S extends {id: string, range: string}> {
284297 } ) ;
285298
286299 await logger . section ( `Prune caches` , async ( ) => {
300+ if ( this . noCache ) {
301+ await xfs . removePromise ( this . tmp ) ;
302+ return ;
303+ }
304+
287305 const buildNames = new Set ( this . slices . map ( slice => slice . id as Filename ) ) ;
288306 const patchNames = new Set ( this . slices . map ( slice => `patch-${ slice . id } .diff` as Filename ) ) ;
289307
0 commit comments