Skip to content

Commit

Permalink
[bot] Update dist directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz authored and github-actions[bot] committed Jun 28, 2024
1 parent dad038d commit cdbbabd
Show file tree
Hide file tree
Showing 8 changed files with 5,860 additions and 116 deletions.
64 changes: 36 additions & 28 deletions dist/dependency-submission/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143001,48 +143001,56 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.CacheCleaner = void 0;
const core = __importStar(__nccwpck_require__(42186));
const exec = __importStar(__nccwpck_require__(71514));
const glob = __importStar(__nccwpck_require__(28090));
const fs_1 = __importDefault(__nccwpck_require__(57147));
const path_1 = __importDefault(__nccwpck_require__(71017));
const gradle_1 = __nccwpck_require__(94475);
class CacheCleaner {
constructor(gradleUserHome, tmpDir) {
this.gradleUserHome = gradleUserHome;
this.tmpDir = tmpDir;
}
async prepare() {
fs_1.default.rmSync(path_1.default.resolve(this.gradleUserHome, 'caches/journal-1'), { recursive: true, force: true });
fs_1.default.mkdirSync(path_1.default.resolve(this.gradleUserHome, 'caches/journal-1'), { recursive: true });
fs_1.default.writeFileSync(path_1.default.resolve(this.gradleUserHome, 'caches/journal-1/file-access.properties'), 'inceptionTimestamp=0');
await this.ageAllFiles();
await this.touchAllFiles('gc.properties');
const timestamp = Date.now().toString();
core.saveState('clean-timestamp', timestamp);
return timestamp;
}
async forceCleanup() {
await this.ageAllFiles('gc.properties');
const cleanTimestamp = core.getState('clean-timestamp');
await this.forceCleanupFilesOlderThan(cleanTimestamp);
}
async forceCleanupFilesOlderThan(cleanTimestamp) {
core.info(`Cleaning up caches before ${cleanTimestamp}`);
const cleanupProjectDir = path_1.default.resolve(this.tmpDir, 'dummy-cleanup-project');
fs_1.default.mkdirSync(cleanupProjectDir, { recursive: true });
fs_1.default.writeFileSync(path_1.default.resolve(cleanupProjectDir, 'settings.gradle'), 'rootProject.name = "dummy-cleanup-project"');
fs_1.default.writeFileSync(path_1.default.resolve(cleanupProjectDir, 'init.gradle'), `
beforeSettings { settings ->
def cleanupTime = ${cleanTimestamp}

settings.caches {
cleanup = Cleanup.ALWAYS

releasedWrappers.removeUnusedEntriesOlderThan.set(cleanupTime)
snapshotWrappers.removeUnusedEntriesOlderThan.set(cleanupTime)
downloadedResources.removeUnusedEntriesOlderThan.set(cleanupTime)
createdResources.removeUnusedEntriesOlderThan.set(cleanupTime)
buildCache.removeUnusedEntriesOlderThan.set(cleanupTime)
}
}
`);
fs_1.default.writeFileSync(path_1.default.resolve(cleanupProjectDir, 'build.gradle'), 'task("noop") {}');
const gradleCommand = `gradle -g ${this.gradleUserHome} --no-daemon --build-cache --no-scan --quiet -DGITHUB_DEPENDENCY_GRAPH_ENABLED=false noop`;
await exec.exec(gradleCommand, [], {
cwd: cleanupProjectDir
});
}
async ageAllFiles(fileName = '*') {
core.debug(`Aging all files in Gradle User Home with name ${fileName}`);
await this.setUtimes(`${this.gradleUserHome}/**/${fileName}`, new Date(0));
}
async touchAllFiles(fileName = '*') {
core.debug(`Touching all files in Gradle User Home with name ${fileName}`);
await this.setUtimes(`${this.gradleUserHome}/**/${fileName}`, new Date());
}
async setUtimes(pattern, timestamp) {
const globber = await glob.create(pattern, {
implicitDescendants: false
});
for await (const file of globber.globGenerator()) {
fs_1.default.utimesSync(file, timestamp, timestamp);
}
await (0, gradle_1.provisionAndMaybeExecute)('current', cleanupProjectDir, [
'-g',
this.gradleUserHome,
'-I',
'init.gradle',
'--info',
'--no-daemon',
'--no-scan',
'--build-cache',
'-DGITHUB_DEPENDENCY_GRAPH_ENABLED=false',
'noop'
]);
}
}
exports.CacheCleaner = CacheCleaner;
Expand Down
2 changes: 1 addition & 1 deletion dist/dependency-submission/main/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit cdbbabd

Please sign in to comment.