Skip to content

Commit

Permalink
Build outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Dec 21, 2023
1 parent 9687f75 commit 4cc7f82
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 34 deletions.
79 changes: 63 additions & 16 deletions dist/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92315,6 +92315,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GradleStateCache = exports.META_FILE_DIR = void 0;
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const glob = __importStar(__nccwpck_require__(8090));
const path_1 = __importDefault(__nccwpck_require__(1017));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const params = __importStar(__nccwpck_require__(3885));
Expand Down Expand Up @@ -92369,6 +92370,7 @@ class GradleStateCache {
return __awaiter(this, void 0, void 0, function* () {
yield this.debugReportGradleUserHomeSize('as restored from cache');
yield new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).restore(listener);
yield new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome).restore(listener);
yield this.debugReportGradleUserHomeSize('after restoring common artifacts');
});
}
Expand Down Expand Up @@ -92405,20 +92407,30 @@ class GradleStateCache {
beforeSave(listener) {
return __awaiter(this, void 0, void 0, function* () {
yield this.debugReportGradleUserHomeSize('before saving common artifacts');
this.deleteExcludedPaths();
yield this.deleteExcludedPaths();
yield Promise.all([
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).extract(listener)
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).extract(listener),
new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome).extract(listener)
]);
yield this.debugReportGradleUserHomeSize("after extracting common artifacts (only 'caches' and 'notifications' will be stored)");
});
}
deleteExcludedPaths() {
const rawPaths = params.getCacheExcludes();
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
for (const p of resolvedPaths) {
(0, cache_utils_1.cacheDebug)(`Deleting excluded path: ${p}`);
(0, cache_utils_1.tryDelete)(p);
}
return __awaiter(this, void 0, void 0, function* () {
const rawPaths = params.getCacheExcludes();
rawPaths.push('caches/*/cc-keystore');
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
for (const p of resolvedPaths) {
(0, cache_utils_1.cacheDebug)(`Removing excluded path: ${p}`);
const globber = yield glob.create(p, {
implicitDescendants: false
});
for (const toDelete of yield globber.glob()) {
(0, cache_utils_1.cacheDebug)(`Removing excluded file: ${toDelete}`);
yield (0, cache_utils_1.tryDelete)(toDelete);
}
}
});
}
getCachePath() {
const rawPaths = params.getCacheIncludes();
Expand Down Expand Up @@ -92659,6 +92671,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ConfigurationCacheEntryExtractor = exports.GradleHomeEntryExtractor = void 0;
const path_1 = __importDefault(__nccwpck_require__(1017));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const crypto_1 = __importDefault(__nccwpck_require__(6113));
const core = __importStar(__nccwpck_require__(2186));
const glob = __importStar(__nccwpck_require__(8090));
const params = __importStar(__nccwpck_require__(3885));
Expand Down Expand Up @@ -92879,15 +92892,44 @@ class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
restore: { get: () => super.restore }
});
return __awaiter(this, void 0, void 0, function* () {
if (listener.fullyRestored) {
return _super.restore.call(this, listener);
if (!listener.fullyRestored) {
core.info('Not restoring configuration-cache state, as Gradle User Home was not fully restored');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markNotRestored('Gradle User Home not fully restored');
}
return;
}
if (!params.getCacheEncryptionSecret()) {
core.info('Not restoring configuration-cache state, as no encryption secret was provided');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markNotRestored('No encryption key provided');
}
return;
}
core.info('Not restoring configuration-cache state, as Gradle User Home was not fully restored');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markRequested('NOT_RESTORED');
const encryptionKey = this.getAESEncryptionKey();
core.exportVariable('GRADLE_ENCRYPTION_KEY', encryptionKey);
return yield _super.restore.call(this, listener);
});
}
extract(listener) {
const _super = Object.create(null, {
extract: { get: () => super.extract }
});
return __awaiter(this, void 0, void 0, function* () {
if (!params.getCacheEncryptionSecret()) {
core.info('Not saving configuration-cache state, as no encryption secret was provided');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markNotSaved('No encryption key provided');
}
}
yield _super.extract.call(this, listener);
});
}
getAESEncryptionKey() {
const secret = params.getCacheEncryptionSecret();
const key = crypto_1.default.pbkdf2Sync(secret, '', 1000, 16, 'sha256');
return key.toString('base64');
}
getExtractedCacheEntryDefinitions() {
return this.getProjectRoots().map(projectRoot => {
const configCachePath = path_1.default.resolve(projectRoot, '.gradle/configuration-cache');
Expand Down Expand Up @@ -93167,7 +93209,7 @@ const crypto = __importStar(__nccwpck_require__(6113));
const path = __importStar(__nccwpck_require__(1017));
const fs = __importStar(__nccwpck_require__(7147));
const params = __importStar(__nccwpck_require__(3885));
const CACHE_PROTOCOL_VERSION = 'v8-';
const CACHE_PROTOCOL_VERSION = 'v9-';
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT';
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
Expand Down Expand Up @@ -93994,7 +94036,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionSecret = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
const core = __importStar(__nccwpck_require__(2186));
const string_argv_1 = __nccwpck_require__(9663);
function isCacheDisabled() {
Expand Down Expand Up @@ -94025,6 +94067,10 @@ function isCacheCleanupEnabled() {
return getBooleanInput('gradle-home-cache-cleanup');
}
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
function getCacheEncryptionSecret() {
return core.getInput('cache-encryption-secret');
}
exports.getCacheEncryptionSecret = getCacheEncryptionSecret;
function getCacheIncludes() {
return core.getMultilineInput('gradle-home-cache-includes');
}
Expand Down Expand Up @@ -94670,7 +94716,7 @@ function complete() {
core.info('Gradle setup post-action only performed for first gradle-build-action step in workflow.');
return;
}
core.info('In final post-action step, saving state and writing summary');
core.info('In post-action step');
const buildResults = (0, build_results_1.loadBuildResults)();
const gradleUserHome = core.getState(GRADLE_USER_HOME);
const cacheListener = cache_reporting_1.CacheListener.rehydrate(core.getState(CACHE_LISTENER));
Expand All @@ -94683,6 +94729,7 @@ function complete() {
(0, job_summary_1.logJobSummary)(buildResults, cacheListener);
}
yield dependencyGraph.complete(params.getDependencyGraphOption());
core.info('Completed post-action step');
});
}
exports.complete = complete;
Expand Down
2 changes: 1 addition & 1 deletion dist/main/index.js.map

Large diffs are not rendered by default.

79 changes: 63 additions & 16 deletions dist/post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92315,6 +92315,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GradleStateCache = exports.META_FILE_DIR = void 0;
const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514));
const glob = __importStar(__nccwpck_require__(8090));
const path_1 = __importDefault(__nccwpck_require__(1017));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const params = __importStar(__nccwpck_require__(3885));
Expand Down Expand Up @@ -92369,6 +92370,7 @@ class GradleStateCache {
return __awaiter(this, void 0, void 0, function* () {
yield this.debugReportGradleUserHomeSize('as restored from cache');
yield new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).restore(listener);
yield new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome).restore(listener);
yield this.debugReportGradleUserHomeSize('after restoring common artifacts');
});
}
Expand Down Expand Up @@ -92405,20 +92407,30 @@ class GradleStateCache {
beforeSave(listener) {
return __awaiter(this, void 0, void 0, function* () {
yield this.debugReportGradleUserHomeSize('before saving common artifacts');
this.deleteExcludedPaths();
yield this.deleteExcludedPaths();
yield Promise.all([
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).extract(listener)
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).extract(listener),
new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome).extract(listener)
]);
yield this.debugReportGradleUserHomeSize("after extracting common artifacts (only 'caches' and 'notifications' will be stored)");
});
}
deleteExcludedPaths() {
const rawPaths = params.getCacheExcludes();
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
for (const p of resolvedPaths) {
(0, cache_utils_1.cacheDebug)(`Deleting excluded path: ${p}`);
(0, cache_utils_1.tryDelete)(p);
}
return __awaiter(this, void 0, void 0, function* () {
const rawPaths = params.getCacheExcludes();
rawPaths.push('caches/*/cc-keystore');
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
for (const p of resolvedPaths) {
(0, cache_utils_1.cacheDebug)(`Removing excluded path: ${p}`);
const globber = yield glob.create(p, {
implicitDescendants: false
});
for (const toDelete of yield globber.glob()) {
(0, cache_utils_1.cacheDebug)(`Removing excluded file: ${toDelete}`);
yield (0, cache_utils_1.tryDelete)(toDelete);
}
}
});
}
getCachePath() {
const rawPaths = params.getCacheIncludes();
Expand Down Expand Up @@ -92659,6 +92671,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ConfigurationCacheEntryExtractor = exports.GradleHomeEntryExtractor = void 0;
const path_1 = __importDefault(__nccwpck_require__(1017));
const fs_1 = __importDefault(__nccwpck_require__(7147));
const crypto_1 = __importDefault(__nccwpck_require__(6113));
const core = __importStar(__nccwpck_require__(2186));
const glob = __importStar(__nccwpck_require__(8090));
const params = __importStar(__nccwpck_require__(3885));
Expand Down Expand Up @@ -92879,15 +92892,44 @@ class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
restore: { get: () => super.restore }
});
return __awaiter(this, void 0, void 0, function* () {
if (listener.fullyRestored) {
return _super.restore.call(this, listener);
if (!listener.fullyRestored) {
core.info('Not restoring configuration-cache state, as Gradle User Home was not fully restored');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markNotRestored('Gradle User Home not fully restored');
}
return;
}
if (!params.getCacheEncryptionSecret()) {
core.info('Not restoring configuration-cache state, as no encryption secret was provided');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markNotRestored('No encryption key provided');
}
return;
}
core.info('Not restoring configuration-cache state, as Gradle User Home was not fully restored');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markRequested('NOT_RESTORED');
const encryptionKey = this.getAESEncryptionKey();
core.exportVariable('GRADLE_ENCRYPTION_KEY', encryptionKey);
return yield _super.restore.call(this, listener);
});
}
extract(listener) {
const _super = Object.create(null, {
extract: { get: () => super.extract }
});
return __awaiter(this, void 0, void 0, function* () {
if (!params.getCacheEncryptionSecret()) {
core.info('Not saving configuration-cache state, as no encryption secret was provided');
for (const cacheEntry of this.loadExtractedCacheEntries()) {
listener.entry(cacheEntry.pattern).markNotSaved('No encryption key provided');
}
}
yield _super.extract.call(this, listener);
});
}
getAESEncryptionKey() {
const secret = params.getCacheEncryptionSecret();
const key = crypto_1.default.pbkdf2Sync(secret, '', 1000, 16, 'sha256');
return key.toString('base64');
}
getExtractedCacheEntryDefinitions() {
return this.getProjectRoots().map(projectRoot => {
const configCachePath = path_1.default.resolve(projectRoot, '.gradle/configuration-cache');
Expand Down Expand Up @@ -93167,7 +93209,7 @@ const crypto = __importStar(__nccwpck_require__(6113));
const path = __importStar(__nccwpck_require__(1017));
const fs = __importStar(__nccwpck_require__(7147));
const params = __importStar(__nccwpck_require__(3885));
const CACHE_PROTOCOL_VERSION = 'v8-';
const CACHE_PROTOCOL_VERSION = 'v9-';
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT';
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
Expand Down Expand Up @@ -93862,7 +93904,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphOption = exports.isDependencyGraphEnabled = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionSecret = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
const core = __importStar(__nccwpck_require__(2186));
const string_argv_1 = __nccwpck_require__(9663);
function isCacheDisabled() {
Expand Down Expand Up @@ -93893,6 +93935,10 @@ function isCacheCleanupEnabled() {
return getBooleanInput('gradle-home-cache-cleanup');
}
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
function getCacheEncryptionSecret() {
return core.getInput('cache-encryption-secret');
}
exports.getCacheEncryptionSecret = getCacheEncryptionSecret;
function getCacheIncludes() {
return core.getMultilineInput('gradle-home-cache-includes');
}
Expand Down Expand Up @@ -94302,7 +94348,7 @@ function complete() {
core.info('Gradle setup post-action only performed for first gradle-build-action step in workflow.');
return;
}
core.info('In final post-action step, saving state and writing summary');
core.info('In post-action step');
const buildResults = (0, build_results_1.loadBuildResults)();
const gradleUserHome = core.getState(GRADLE_USER_HOME);
const cacheListener = cache_reporting_1.CacheListener.rehydrate(core.getState(CACHE_LISTENER));
Expand All @@ -94315,6 +94361,7 @@ function complete() {
(0, job_summary_1.logJobSummary)(buildResults, cacheListener);
}
yield dependencyGraph.complete(params.getDependencyGraphOption());
core.info('Completed post-action step');
});
}
exports.complete = complete;
Expand Down
2 changes: 1 addition & 1 deletion dist/post/index.js.map

Large diffs are not rendered by default.

0 comments on commit 4cc7f82

Please sign in to comment.