This commit is contained in:
github-actions[bot] 2024-06-25 09:21:42 +00:00
parent 1895b29ac8
commit 9cf3243b0b
59 changed files with 233 additions and 248 deletions

11
lib/trap-caching.js generated
View file

@ -23,7 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getTotalCacheSize = exports.getLanguagesSupportingCaching = exports.cleanupTrapCaches = exports.uploadTrapCaches = exports.downloadTrapCaches = void 0;
exports.downloadTrapCaches = downloadTrapCaches;
exports.uploadTrapCaches = uploadTrapCaches;
exports.cleanupTrapCaches = cleanupTrapCaches;
exports.getLanguagesSupportingCaching = getLanguagesSupportingCaching;
exports.getTotalCacheSize = getTotalCacheSize;
const fs = __importStar(require("fs"));
const path = __importStar(require("path"));
const actionsCache = __importStar(require("@actions/cache"));
@ -100,7 +104,6 @@ async function downloadTrapCaches(codeql, languages, logger) {
}
return result;
}
exports.downloadTrapCaches = downloadTrapCaches;
/**
* Possibly upload TRAP caches to the Actions cache.
* @param codeql The CodeQL instance to use.
@ -132,7 +135,6 @@ async function uploadTrapCaches(codeql, config, logger) {
}
return true;
}
exports.uploadTrapCaches = uploadTrapCaches;
async function cleanupTrapCaches(config, features, logger) {
if (!(await features.getValue(feature_flags_1.Feature.CleanupTrapCaches))) {
return {
@ -183,7 +185,6 @@ async function cleanupTrapCaches(config, features, logger) {
return { trap_cache_cleanup_error: (0, util_1.wrapError)(e).message };
}
}
exports.cleanupTrapCaches = cleanupTrapCaches;
async function getTrapCachesForLanguage(allCaches, language, logger) {
logger.debug(`Listing TRAP caches for ${language}`);
for (const cache of allCaches) {
@ -225,12 +226,10 @@ async function getLanguagesSupportingCaching(codeql, languages, logger) {
}
return result;
}
exports.getLanguagesSupportingCaching = getLanguagesSupportingCaching;
async function getTotalCacheSize(trapCaches, logger) {
const sizes = await Promise.all(Object.values(trapCaches).map((cacheDir) => (0, util_1.tryGetFolderBytes)(cacheDir, logger)));
return sizes.map((a) => a || 0).reduce((a, b) => a + b, 0);
}
exports.getTotalCacheSize = getTotalCacheSize;
async function cacheKey(codeql, language, baseSha) {
return `${await cachePrefix(codeql, language)}${baseSha}`;
}