@@ -20,7 +20,10 @@ import { getErrorMessage, getRequiredEnvParam } from "./util";
2020 */
2121export interface CacheConfig {
2222 /** Gets the paths of directories on the runner that should be included in the cache. */
23- getDependencyPaths : ( ) => string [ ] ;
23+ getDependencyPaths : (
24+ codeql : CodeQL ,
25+ features : FeatureEnablement ,
26+ ) => Promise < string [ ] > ;
2427 /**
2528 * Gets an array of glob patterns for the paths of files whose contents affect which dependencies are used
2629 * by a project. This function also checks whether there are any matching files and returns
@@ -55,7 +58,7 @@ export function getJavaTempDependencyDir(): string {
5558 * @returns The paths of directories on the runner that should be included in a dependency cache
5659 * for a Java analysis.
5760 */
58- export function getJavaDependencyDirs ( ) : string [ ] {
61+ export async function getJavaDependencyDirs ( ) : Promise < string [ ] > {
5962 return [
6063 // Maven
6164 join ( os . homedir ( ) , ".m2" , "repository" ) ,
@@ -66,14 +69,23 @@ export function getJavaDependencyDirs(): string[] {
6669 ] ;
6770}
6871
72+ /**
73+ * Returns a path to a directory intended to be used to store dependencies
74+ * for the C# `build-mode: none` extractor.
75+ * @returns The path to the directory that should be used by the `build-mode: none` extractor.
76+ */
77+ export function getCsharpTempDependencyDir ( ) : string {
78+ return join ( getTemporaryDirectory ( ) , "codeql_csharp" , "repository" ) ;
79+ }
80+
6981/**
7082 * Returns an array of paths of directories on the runner that should be included in a dependency cache
7183 * for a C# analysis.
7284 *
7385 * @returns The paths of directories on the runner that should be included in a dependency cache
7486 * for a C# analysis.
7587 */
76- export function getCsharpDependencyDirs ( ) : string [ ] {
88+ export async function getCsharpDependencyDirs ( ) : Promise < string [ ] > {
7789 return [ join ( os . homedir ( ) , ".nuget" , "packages" ) ] ;
7890}
7991
@@ -173,7 +185,7 @@ const defaultCacheConfigs: { [language: string]: CacheConfig } = {
173185 getHashPatterns : getCsharpHashPatterns ,
174186 } ,
175187 go : {
176- getDependencyPaths : ( ) => [ join ( os . homedir ( ) , "go" , "pkg" , "mod" ) ] ,
188+ getDependencyPaths : async ( ) => [ join ( os . homedir ( ) , "go" , "pkg" , "mod" ) ] ,
177189 getHashPatterns : async ( ) => internal . makePatternCheck ( [ "**/go.sum" ] ) ,
178190 } ,
179191} ;
@@ -291,7 +303,7 @@ export async function downloadDependencyCaches(
291303
292304 const start = performance . now ( ) ;
293305 const hitKey = await actionsCache . restoreCache (
294- cacheConfig . getDependencyPaths ( ) ,
306+ await cacheConfig . getDependencyPaths ( codeql , features ) ,
295307 primaryKey ,
296308 restoreKeys ,
297309 ) ;
@@ -387,7 +399,7 @@ export async function uploadDependencyCaches(
387399 // with the dependency caches. For this, we could use the Cache API to check whether other workflows
388400 // are using the quota and how full it is.
389401 const size = await getTotalCacheSize (
390- cacheConfig . getDependencyPaths ( ) ,
402+ await cacheConfig . getDependencyPaths ( codeql , features ) ,
391403 logger ,
392404 true ,
393405 ) ;
@@ -409,7 +421,10 @@ export async function uploadDependencyCaches(
409421
410422 try {
411423 const start = performance . now ( ) ;
412- await actionsCache . saveCache ( cacheConfig . getDependencyPaths ( ) , key ) ;
424+ await actionsCache . saveCache (
425+ await cacheConfig . getDependencyPaths ( codeql , features ) ,
426+ key ,
427+ ) ;
413428 const upload_duration_ms = Math . round ( performance . now ( ) - start ) ;
414429
415430 status . push ( {
0 commit comments