diff --git a/packages/nx/src/native/cache/cache.rs b/packages/nx/src/native/cache/cache.rs index 1201d4c00b..f2816e3682 100644 --- a/packages/nx/src/native/cache/cache.rs +++ b/packages/nx/src/native/cache/cache.rs @@ -175,7 +175,7 @@ impl NxCache { &self, hash: String, result: CachedResult, - outputs: Vec, + outputs: Option>, ) -> anyhow::Result<()> { trace!( "applying remote cache results: {:?} ({})", @@ -184,9 +184,12 @@ impl NxCache { ); let terminal_output = result.terminal_output.clone(); let mut size = terminal_output.len() as i64; - if outputs.len() > 0 && result.code == 0 { - size += try_and_retry(|| self.copy_files_from_cache(result.clone(), outputs.clone()))?; - }; + if let Some(outputs) = outputs { + if outputs.len() > 0 && result.code == 0 { + size += + try_and_retry(|| self.copy_files_from_cache(result.clone(), outputs.clone()))?; + }; + } write(self.get_task_outputs_path(hash.clone()), terminal_output)?; let code: i16 = result.code; diff --git a/packages/nx/src/native/index.d.ts b/packages/nx/src/native/index.d.ts index bbe62915d8..bea7ffa7aa 100644 --- a/packages/nx/src/native/index.d.ts +++ b/packages/nx/src/native/index.d.ts @@ -40,7 +40,7 @@ export declare class NxCache { constructor(workspaceRoot: string, cachePath: string, dbConnection: ExternalObject, linkTaskDetails?: boolean | undefined | null, maxCacheSize?: number | undefined | null) get(hash: string): CachedResult | null put(hash: string, terminalOutput: string, outputs: Array, code: number): void - applyRemoteCacheResults(hash: string, result: CachedResult, outputs: Array): void + applyRemoteCacheResults(hash: string, result: CachedResult, outputs?: Array | undefined | null): void getTaskOutputsPath(hash: string): string getCacheSize(): number copyFilesFromCache(cachedResult: CachedResult, outputs: Array): number