Build outputs

This commit is contained in:
daz
2024-04-07 10:12:59 -06:00
parent b7ef93c7b7
commit d6f94a4073
8 changed files with 283322 additions and 576 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+283 -289
View File
@@ -139727,28 +139727,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setup = void 0;
const core = __importStar(__nccwpck_require__(42186));
const input_params_1 = __nccwpck_require__(23885);
function setup() {
function setup(config) {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle');
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) {
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree());
}
}
exports.setup = setup;
function verifyTermsOfUseAgreement() {
if (((0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/terms-of-service' &&
(0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/help/legal-terms-of-use') ||
(0, input_params_1.getBuildScanTermsOfUseAgree)() !== 'yes') {
core.warning(`Terms of use must be agreed in order to publish build scans.`);
return false;
}
return true;
}
function maybeExportVariable(variableName, value) {
if (!process.env[variableName]) {
core.exportVariable(variableName, value);
@@ -139805,21 +139795,21 @@ const exec = __importStar(__nccwpck_require__(71514));
const glob = __importStar(__nccwpck_require__(28090));
const path_1 = __importDefault(__nccwpck_require__(71017));
const fs_1 = __importDefault(__nccwpck_require__(57147));
const params = __importStar(__nccwpck_require__(23885));
const cache_utils_1 = __nccwpck_require__(41678);
const cache_extract_entries_1 = __nccwpck_require__(76161);
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
exports.META_FILE_DIR = '.setup-gradle';
class GradleStateCache {
constructor(userHome, gradleUserHome) {
constructor(userHome, gradleUserHome, cacheConfig) {
this.userHome = userHome;
this.gradleUserHome = gradleUserHome;
this.cacheConfig = cacheConfig;
this.cacheName = 'gradle';
this.cacheDescription = 'Gradle User Home';
}
init() {
this.initializeGradleUserHome();
const encryptionKey = params.getCacheEncryptionKey();
const encryptionKey = this.cacheConfig.getCacheEncryptionKey();
if (encryptionKey) {
core.exportVariable('GRADLE_ENCRYPTION_KEY', encryptionKey);
}
@@ -139835,7 +139825,7 @@ class GradleStateCache {
restore(listener) {
return __awaiter(this, void 0, void 0, function* () {
const entryListener = listener.entry(this.cacheDescription);
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName);
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName, this.cacheConfig);
(0, cache_utils_1.cacheDebug)(`Requesting ${this.cacheDescription} with
key:${cacheKey.key}
restoreKeys:[${cacheKey.restoreKeys}]`);
@@ -139857,14 +139847,14 @@ class GradleStateCache {
afterRestore(listener) {
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 new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome, this.cacheConfig).restore(listener);
yield new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome, this.cacheConfig).restore(listener);
yield this.debugReportGradleUserHomeSize('after restoring common artifacts');
});
}
save(listener) {
return __awaiter(this, void 0, void 0, function* () {
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName).key;
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName, this.cacheConfig).key;
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY);
const gradleHomeEntryListener = listener.entry(this.cacheDescription);
if (restoredCacheKey && cacheKey === restoredCacheKey) {
@@ -139897,15 +139887,15 @@ class GradleStateCache {
yield this.debugReportGradleUserHomeSize('before saving common artifacts');
yield this.deleteExcludedPaths();
yield Promise.all([
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).extract(listener),
new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome).extract(listener)
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome, this.cacheConfig).extract(listener),
new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome, this.cacheConfig).extract(listener)
]);
yield this.debugReportGradleUserHomeSize("after extracting common artifacts (only 'caches' and 'notifications' will be stored)");
});
}
deleteExcludedPaths() {
return __awaiter(this, void 0, void 0, function* () {
const rawPaths = params.getCacheExcludes();
const rawPaths = this.cacheConfig.getCacheExcludes();
rawPaths.push('caches/*/cc-keystore');
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
for (const p of resolvedPaths) {
@@ -139921,7 +139911,7 @@ class GradleStateCache {
});
}
getCachePath() {
const rawPaths = params.getCacheIncludes();
const rawPaths = this.cacheConfig.getCacheIncludes();
rawPaths.push(exports.META_FILE_DIR);
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x));
(0, cache_utils_1.cacheDebug)(`Using cache paths: ${resolvedPaths}`);
@@ -140193,7 +140183,6 @@ const fs_1 = __importDefault(__nccwpck_require__(57147));
const core = __importStar(__nccwpck_require__(42186));
const glob = __importStar(__nccwpck_require__(28090));
const semver = __importStar(__nccwpck_require__(11383));
const params = __importStar(__nccwpck_require__(23885));
const cache_base_1 = __nccwpck_require__(47591);
const cache_utils_1 = __nccwpck_require__(41678);
const build_results_1 = __nccwpck_require__(82107);
@@ -140227,9 +140216,10 @@ class ExtractedCacheEntryDefinition {
}
}
class AbstractEntryExtractor {
constructor(gradleUserHome, extractorName) {
constructor(gradleUserHome, extractorName, cacheConfig) {
this.gradleUserHome = gradleUserHome;
this.extractorName = extractorName;
this.cacheConfig = cacheConfig;
}
restore(listener) {
return __awaiter(this, void 0, void 0, function* () {
@@ -140334,7 +140324,7 @@ class AbstractEntryExtractor {
}
awaitForDebugging(p) {
return __awaiter(this, void 0, void 0, function* () {
if (params.isCacheDebuggingEnabled()) {
if ((0, cache_utils_1.isCacheDebuggingEnabled)()) {
yield p;
}
return p;
@@ -140364,8 +140354,8 @@ class AbstractEntryExtractor {
}
}
class GradleHomeEntryExtractor extends AbstractEntryExtractor {
constructor(gradleUserHome) {
super(gradleUserHome, 'gradle-home');
constructor(gradleUserHome, cacheConfig) {
super(gradleUserHome, 'gradle-home', cacheConfig);
}
extract(listener) {
const _super = Object.create(null, {
@@ -140411,8 +140401,8 @@ class GradleHomeEntryExtractor extends AbstractEntryExtractor {
}
exports.GradleHomeEntryExtractor = GradleHomeEntryExtractor;
class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
constructor(gradleUserHome) {
super(gradleUserHome, 'configuration-cache');
constructor(gradleUserHome, cacheConfig) {
super(gradleUserHome, 'configuration-cache', cacheConfig);
}
restore(listener) {
const _super = Object.create(null, {
@@ -140423,7 +140413,7 @@ class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
this.markNotRestored(listener, 'Gradle User Home was not fully restored');
return;
}
if (!params.getCacheEncryptionKey()) {
if (!this.cacheConfig.getCacheEncryptionKey()) {
this.markNotRestored(listener, 'Encryption Key was not provided');
return;
}
@@ -140445,7 +140435,7 @@ class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
extract: { get: () => super.extract }
});
return __awaiter(this, void 0, void 0, function* () {
if (!params.getCacheEncryptionKey()) {
if (!this.cacheConfig.getCacheEncryptionKey()) {
const cacheEntryDefinitions = this.getExtractedCacheEntryDefinitions();
if (cacheEntryDefinitions.length > 0) {
core.info('Not saving configuration-cache state, as no encryption key was provided');
@@ -140745,7 +140735,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheDebuggingEnabled = void 0;
const core = __importStar(__nccwpck_require__(42186));
const cache = __importStar(__nccwpck_require__(27799));
const github = __importStar(__nccwpck_require__(95438));
@@ -140753,7 +140743,7 @@ const exec = __importStar(__nccwpck_require__(71514));
const crypto = __importStar(__nccwpck_require__(6113));
const path = __importStar(__nccwpck_require__(71017));
const fs = __importStar(__nccwpck_require__(57147));
const params = __importStar(__nccwpck_require__(23885));
const input_params_1 = __nccwpck_require__(23885);
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';
@@ -140762,33 +140752,13 @@ const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
const SEGMENT_DOWNLOAD_TIMEOUT_VAR = 'SEGMENT_DOWNLOAD_TIMEOUT_MINS';
const SEGMENT_DOWNLOAD_TIMEOUT_DEFAULT = 10 * 60 * 1000;
function isCacheDisabled() {
if (!cache.isFeatureAvailable()) {
function isCacheDebuggingEnabled() {
if (core.isDebug()) {
return true;
}
return params.isCacheDisabled();
}
exports.isCacheDisabled = isCacheDisabled;
function isCacheReadOnly() {
return !isCacheWriteOnly() && params.isCacheReadOnly();
}
exports.isCacheReadOnly = isCacheReadOnly;
function isCacheWriteOnly() {
return params.isCacheWriteOnly();
}
exports.isCacheWriteOnly = isCacheWriteOnly;
function isCacheOverwriteExisting() {
return params.isCacheOverwriteExisting();
}
exports.isCacheOverwriteExisting = isCacheOverwriteExisting;
function isCacheDebuggingEnabled() {
return params.isCacheDebuggingEnabled();
return process.env['GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'] ? true : false;
}
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
function isCacheCleanupEnabled() {
return params.isCacheCleanupEnabled();
}
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
class CacheKey {
constructor(key, restoreKeys) {
this.key = key;
@@ -140796,13 +140766,13 @@ class CacheKey {
}
}
exports.CacheKey = CacheKey;
function generateCacheKey(cacheName) {
function generateCacheKey(cacheName, config) {
const cacheKeyBase = `${getCacheKeyPrefix()}${CACHE_PROTOCOL_VERSION}${cacheName}`;
const cacheKeyForEnvironment = `${cacheKeyBase}|${getCacheKeyEnvironment()}`;
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`;
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`;
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`;
if (params.isCacheStrictMatch()) {
if (config.isCacheStrictMatch()) {
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
}
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment]);
@@ -140825,7 +140795,7 @@ function getCacheKeyJobInstance() {
return override;
}
const workflowName = github.context.workflow;
const workflowJobContext = params.getJobMatrix();
const workflowJobContext = (0, input_params_1.getJobMatrix)();
return hashStrings([workflowName, workflowJobContext]);
}
function getCacheKeyJobExecution() {
@@ -140994,26 +140964,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.save = exports.restore = void 0;
const core = __importStar(__nccwpck_require__(42186));
const cache_utils_1 = __nccwpck_require__(41678);
const cache_base_1 = __nccwpck_require__(47591);
const cache_cleaner_1 = __nccwpck_require__(57);
const CACHE_RESTORED_VAR = 'GRADLE_BUILD_ACTION_CACHE_RESTORED';
function restore(userHome, gradleUserHome, cacheListener) {
function restore(userHome, gradleUserHome, cacheListener, cacheConfig) {
return __awaiter(this, void 0, void 0, function* () {
if (process.env[CACHE_RESTORED_VAR]) {
core.info('Cache only restored on first action step.');
return;
}
core.exportVariable(CACHE_RESTORED_VAR, true);
const gradleStateCache = new cache_base_1.GradleStateCache(userHome, gradleUserHome);
if ((0, cache_utils_1.isCacheDisabled)()) {
const gradleStateCache = new cache_base_1.GradleStateCache(userHome, gradleUserHome, cacheConfig);
if (cacheConfig.isCacheDisabled()) {
core.info('Cache is disabled: will not restore state from previous builds.');
gradleStateCache.init();
cacheListener.cacheDisabled = true;
return;
}
if (gradleStateCache.cacheOutputExists()) {
if (!(0, cache_utils_1.isCacheOverwriteExisting)()) {
if (!cacheConfig.isCacheOverwriteExisting()) {
core.info('Gradle User Home already exists: will not restore from cache.');
gradleStateCache.init();
cacheListener.cacheDisabled = true;
@@ -141024,7 +140993,7 @@ function restore(userHome, gradleUserHome, cacheListener) {
}
gradleStateCache.init();
core.saveState(CACHE_RESTORED_VAR, true);
if ((0, cache_utils_1.isCacheWriteOnly)()) {
if (cacheConfig.isCacheWriteOnly()) {
core.info('Cache is write-only: will not restore from cache.');
cacheListener.cacheWriteOnly = true;
return;
@@ -141032,7 +141001,7 @@ function restore(userHome, gradleUserHome, cacheListener) {
yield core.group('Restore Gradle state from cache', () => __awaiter(this, void 0, void 0, function* () {
yield gradleStateCache.restore(cacheListener);
}));
if ((0, cache_utils_1.isCacheCleanupEnabled)() && !(0, cache_utils_1.isCacheReadOnly)()) {
if (cacheConfig.isCacheCleanupEnabled()) {
core.info('Preparing cache for cleanup.');
const cacheCleaner = new cache_cleaner_1.CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']);
yield cacheCleaner.prepare();
@@ -141040,9 +141009,9 @@ function restore(userHome, gradleUserHome, cacheListener) {
});
}
exports.restore = restore;
function save(userHome, gradleUserHome, cacheListener, daemonController) {
function save(userHome, gradleUserHome, cacheListener, daemonController, cacheConfig) {
return __awaiter(this, void 0, void 0, function* () {
if ((0, cache_utils_1.isCacheDisabled)()) {
if (cacheConfig.isCacheDisabled()) {
core.info('Cache is disabled: will not save state for later builds.');
return;
}
@@ -141050,13 +141019,13 @@ function save(userHome, gradleUserHome, cacheListener, daemonController) {
core.info('Cache will not be saved: not restored in main action step.');
return;
}
if ((0, cache_utils_1.isCacheReadOnly)()) {
if (cacheConfig.isCacheReadOnly()) {
core.info('Cache is read-only: will not save state for use in subsequent builds.');
cacheListener.cacheReadOnly = true;
return;
}
yield daemonController.stopAllDaemons();
if ((0, cache_utils_1.isCacheCleanupEnabled)()) {
if (cacheConfig.isCacheCleanupEnabled()) {
core.info('Forcing cache cleanup.');
const cacheCleaner = new cache_cleaner_1.CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']);
try {
@@ -141067,7 +141036,7 @@ function save(userHome, gradleUserHome, cacheListener, daemonController) {
}
}
yield core.group('Caching Gradle state', () => __awaiter(this, void 0, void 0, function* () {
return new cache_base_1.GradleStateCache(userHome, gradleUserHome).save(cacheListener);
return new cache_base_1.GradleStateCache(userHome, gradleUserHome, cacheConfig).save(cacheListener);
}));
});
}
@@ -141190,7 +141159,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.constructJobCorrelator = exports.complete = exports.setup = void 0;
exports.complete = exports.setup = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const glob = __importStar(__nccwpck_require__(28090));
@@ -141202,25 +141171,26 @@ const layout = __importStar(__nccwpck_require__(28182));
const errors_1 = __nccwpck_require__(36976);
const input_params_1 = __nccwpck_require__(23885);
const DEPENDENCY_GRAPH_PREFIX = 'dependency-graph_';
function setup(option) {
function setup(config) {
return __awaiter(this, void 0, void 0, function* () {
if (option === input_params_1.DependencyGraphOption.Disabled) {
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.Disabled) {
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'false');
return;
}
if (option === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
yield downloadAndSubmitDependencyGraphs();
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
yield downloadAndSubmitDependencyGraphs(config);
return;
}
core.info('Enabling dependency graph generation');
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true');
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE', (0, input_params_1.getDependencyGraphContinueOnFailure)());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', getJobCorrelator());
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true');
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE', config.continueOnFailure);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', config.getJobCorrelator());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', layout.workspaceDirectory());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports'));
if (option === input_params_1.DependencyGraphOption.Clear) {
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.Clear) {
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
}
@@ -141232,10 +141202,14 @@ function maybeExportVariable(variableName, value) {
core.exportVariable(variableName, value);
}
}
function complete(option) {
function complete(config) {
return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload and submit not supported in the ACT environment.');
return;
}
try {
switch (option) {
switch (config.dependencyGraphOption) {
case input_params_1.DependencyGraphOption.Disabled:
case input_params_1.DependencyGraphOption.Generate:
case input_params_1.DependencyGraphOption.DownloadAndSubmit:
@@ -141245,11 +141219,11 @@ function complete(option) {
yield submitDependencyGraphs(yield findGeneratedDependencyGraphFiles());
return;
case input_params_1.DependencyGraphOption.GenerateAndUpload:
yield uploadDependencyGraphs(yield findGeneratedDependencyGraphFiles());
yield uploadDependencyGraphs(yield findGeneratedDependencyGraphFiles(), config);
}
}
catch (e) {
warnOrFail(option, e);
warnOrFail(config, e);
}
});
}
@@ -141260,7 +141234,7 @@ function findGeneratedDependencyGraphFiles() {
return yield findDependencyGraphFiles(workspaceDirectory);
});
}
function uploadDependencyGraphs(dependencyGraphFiles) {
function uploadDependencyGraphs(dependencyGraphFiles, config) {
return __awaiter(this, void 0, void 0, function* () {
const workspaceDirectory = layout.workspaceDirectory();
const artifactClient = new artifact_1.DefaultArtifactClient();
@@ -141269,18 +141243,22 @@ function uploadDependencyGraphs(dependencyGraphFiles) {
core.info(`Uploading dependency graph file: ${relativePath}`);
const artifactName = `${DEPENDENCY_GRAPH_PREFIX}${path.basename(dependencyGraphFile)}`;
yield artifactClient.uploadArtifact(artifactName, [dependencyGraphFile], workspaceDirectory, {
retentionDays: (0, input_params_1.getArtifactRetentionDays)()
retentionDays: config.artifactRetentionDays
});
}
});
}
function downloadAndSubmitDependencyGraphs() {
function downloadAndSubmitDependencyGraphs(config) {
return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) {
core.info('Dependency graph download and submit not supported in the ACT environment.');
return;
}
try {
yield submitDependencyGraphs(yield downloadDependencyGraphs());
}
catch (e) {
warnOrFail(input_params_1.DependencyGraphOption.DownloadAndSubmit, e);
warnOrFail(config, e);
}
});
}
@@ -141358,11 +141336,11 @@ function findDependencyGraphFiles(dir) {
return graphFiles;
});
}
function warnOrFail(option, error) {
if (!(0, input_params_1.getDependencyGraphContinueOnFailure)()) {
function warnOrFail(config, error) {
if (!config.continueOnFailure) {
throw new errors_1.PostActionJobFailure(error);
}
core.warning(`Failed to ${option} dependency graph. Will continue.\n${String(error)}`);
core.warning(`Failed to ${config.dependencyGraphOption} dependency graph. Will continue.\n${String(error)}`);
}
function getOctokit() {
return github.getOctokit((0, input_params_1.getGithubToken)());
@@ -141387,28 +141365,8 @@ function getShaFromContext() {
return context.sha;
}
}
function getJobCorrelator() {
return constructJobCorrelator(github.context.workflow, github.context.job, (0, input_params_1.getJobMatrix)());
}
function constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
return sanitize(label);
}
exports.constructJobCorrelator = constructJobCorrelator;
function describeMatrix(matrixJson) {
core.debug(`Got matrix json: ${matrixJson}`);
const matrix = JSON.parse(matrixJson);
if (matrix) {
return Object.values(matrix).join('-');
}
return '';
}
function sanitize(value) {
return value
.replace(/[^a-zA-Z0-9_-\s]/g, '')
.replace(/\s+/g, '_')
.toLowerCase();
function isRunningInActEnvironment() {
return process.env.ACT !== undefined;
}
@@ -141601,114 +141559,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.JobSummaryOption = exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphContinueOnFailure = exports.getDependencyGraphOption = exports.getBuildScanTermsOfUseAgree = exports.getBuildScanTermsOfUseUrl = exports.getBuildScanPublishEnabled = exports.getPRCommentOption = exports.getJobSummaryOption = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.parseNumericInput = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getBuildRootDirectory = exports.getGradleVersion = exports.BuildScanConfig = exports.JobSummaryOption = exports.SummaryConfig = exports.CacheConfig = exports.DependencyGraphOption = exports.DependencyGraphConfig = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const cache = __importStar(__nccwpck_require__(27799));
const summary_1 = __nccwpck_require__(81327);
const string_argv_1 = __nccwpck_require__(19663);
function isCacheDisabled() {
return getBooleanInput('cache-disabled');
}
exports.isCacheDisabled = isCacheDisabled;
function isCacheReadOnly() {
return getBooleanInput('cache-read-only');
}
exports.isCacheReadOnly = isCacheReadOnly;
function isCacheWriteOnly() {
return getBooleanInput('cache-write-only');
}
exports.isCacheWriteOnly = isCacheWriteOnly;
function isCacheOverwriteExisting() {
return getBooleanInput('cache-overwrite-existing');
}
exports.isCacheOverwriteExisting = isCacheOverwriteExisting;
function isCacheStrictMatch() {
return getBooleanInput('gradle-home-cache-strict-match');
}
exports.isCacheStrictMatch = isCacheStrictMatch;
function isCacheDebuggingEnabled() {
return process.env['GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'] ? true : false;
}
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
function isCacheCleanupEnabled() {
return getBooleanInput('gradle-home-cache-cleanup');
}
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
function getCacheEncryptionKey() {
return core.getInput('cache-encryption-key');
}
exports.getCacheEncryptionKey = getCacheEncryptionKey;
function getCacheIncludes() {
return core.getMultilineInput('gradle-home-cache-includes');
}
exports.getCacheIncludes = getCacheIncludes;
function getCacheExcludes() {
return core.getMultilineInput('gradle-home-cache-excludes');
}
exports.getCacheExcludes = getCacheExcludes;
function getBuildRootDirectory() {
return core.getInput('build-root-directory');
}
exports.getBuildRootDirectory = getBuildRootDirectory;
function getGradleVersion() {
return core.getInput('gradle-version');
}
exports.getGradleVersion = getGradleVersion;
function getArguments() {
const input = core.getInput('arguments');
return (0, string_argv_1.parseArgsStringToArgv)(input);
}
exports.getArguments = getArguments;
function getJobMatrix() {
return core.getInput('workflow-job-context');
}
exports.getJobMatrix = getJobMatrix;
function getGithubToken() {
return core.getInput('github-token', { required: true });
}
exports.getGithubToken = getGithubToken;
function isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
exports.isJobSummaryEnabled = isJobSummaryEnabled;
function getJobSummaryOption() {
return parseJobSummaryOption('add-job-summary');
}
exports.getJobSummaryOption = getJobSummaryOption;
function getPRCommentOption() {
return parseJobSummaryOption('add-job-summary-as-pr-comment');
}
exports.getPRCommentOption = getPRCommentOption;
function getBuildScanPublishEnabled() {
return getBooleanInput('build-scan-publish');
}
exports.getBuildScanPublishEnabled = getBuildScanPublishEnabled;
function getBuildScanTermsOfUseUrl() {
return getTermsOfUseProp('build-scan-terms-of-use-url', 'build-scan-terms-of-service-url');
}
exports.getBuildScanTermsOfUseUrl = getBuildScanTermsOfUseUrl;
function getBuildScanTermsOfUseAgree() {
return getTermsOfUseProp('build-scan-terms-of-use-agree', 'build-scan-terms-of-service-agree');
}
exports.getBuildScanTermsOfUseAgree = getBuildScanTermsOfUseAgree;
function getTermsOfUseProp(newPropName, oldPropName) {
const newProp = core.getInput(newPropName);
if (newProp !== '') {
return newProp;
class DependencyGraphConfig {
constructor() {
this.dependencyGraphOption = this.getDependencyGraphOption();
this.continueOnFailure = this.getDependencyGraphContinueOnFailure();
this.artifactRetentionDays = this.getArtifactRetentionDays();
}
return core.getInput(oldPropName);
}
function parseJobSummaryOption(paramName) {
const val = core.getInput(paramName);
switch (val.toLowerCase().trim()) {
case 'never':
return JobSummaryOption.Never;
case 'always':
return JobSummaryOption.Always;
case 'on-failure':
return JobSummaryOption.OnFailure;
}
throw TypeError(`The value '${val}' is not valid for ${paramName}. Valid values are: [never, always, on-failure].`);
}
function getDependencyGraphOption() {
getDependencyGraphOption() {
const val = core.getInput('dependency-graph');
switch (val.toLowerCase().trim()) {
case 'disabled':
@@ -141725,17 +141588,184 @@ function getDependencyGraphOption() {
return DependencyGraphOption.Clear;
}
throw TypeError(`The value '${val}' is not valid for 'dependency-graph'. Valid values are: [disabled, generate, generate-and-submit, generate-and-upload, download-and-submit, clear]. The default value is 'disabled'.`);
}
exports.getDependencyGraphOption = getDependencyGraphOption;
function getDependencyGraphContinueOnFailure() {
}
getDependencyGraphContinueOnFailure() {
return getBooleanInput('dependency-graph-continue-on-failure', true);
}
exports.getDependencyGraphContinueOnFailure = getDependencyGraphContinueOnFailure;
function getArtifactRetentionDays() {
}
getArtifactRetentionDays() {
const val = core.getInput('artifact-retention-days');
return parseNumericInput('artifact-retention-days', val, 0);
}
getJobCorrelator() {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix());
}
static constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = this.describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
return this.sanitize(label);
}
static describeMatrix(matrixJson) {
core.debug(`Got matrix json: ${matrixJson}`);
const matrix = JSON.parse(matrixJson);
if (matrix) {
return Object.values(matrix).join('-');
}
return '';
}
static sanitize(value) {
return value
.replace(/[^a-zA-Z0-9_-\s]/g, '')
.replace(/\s+/g, '_')
.toLowerCase();
}
}
exports.getArtifactRetentionDays = getArtifactRetentionDays;
exports.DependencyGraphConfig = DependencyGraphConfig;
var DependencyGraphOption;
(function (DependencyGraphOption) {
DependencyGraphOption["Disabled"] = "disabled";
DependencyGraphOption["Generate"] = "generate";
DependencyGraphOption["GenerateAndSubmit"] = "generate-and-submit";
DependencyGraphOption["GenerateAndUpload"] = "generate-and-upload";
DependencyGraphOption["DownloadAndSubmit"] = "download-and-submit";
DependencyGraphOption["Clear"] = "clear";
})(DependencyGraphOption || (exports.DependencyGraphOption = DependencyGraphOption = {}));
class CacheConfig {
isCacheDisabled() {
if (!cache.isFeatureAvailable()) {
return true;
}
return getBooleanInput('cache-disabled');
}
isCacheReadOnly() {
return !this.isCacheWriteOnly() && getBooleanInput('cache-read-only');
}
isCacheWriteOnly() {
return getBooleanInput('cache-write-only');
}
isCacheOverwriteExisting() {
return getBooleanInput('cache-overwrite-existing');
}
isCacheStrictMatch() {
return getBooleanInput('gradle-home-cache-strict-match');
}
isCacheCleanupEnabled() {
return getBooleanInput('gradle-home-cache-cleanup') && !this.isCacheReadOnly();
}
getCacheEncryptionKey() {
return core.getInput('cache-encryption-key');
}
getCacheIncludes() {
return core.getMultilineInput('gradle-home-cache-includes');
}
getCacheExcludes() {
return core.getMultilineInput('gradle-home-cache-excludes');
}
}
exports.CacheConfig = CacheConfig;
class SummaryConfig {
shouldGenerateJobSummary(hasFailure) {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
if (!this.isJobSummaryEnabled()) {
return false;
}
return this.shouldAddJobSummary(this.getJobSummaryOption(), hasFailure);
}
shouldAddPRComment(hasFailure) {
return this.shouldAddJobSummary(this.getPRCommentOption(), hasFailure);
}
shouldAddJobSummary(option, hasFailure) {
switch (option) {
case JobSummaryOption.Always:
return true;
case JobSummaryOption.Never:
return false;
case JobSummaryOption.OnFailure:
return hasFailure;
}
}
isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
getJobSummaryOption() {
return this.parseJobSummaryOption('add-job-summary');
}
getPRCommentOption() {
return this.parseJobSummaryOption('add-job-summary-as-pr-comment');
}
parseJobSummaryOption(paramName) {
const val = core.getInput(paramName);
switch (val.toLowerCase().trim()) {
case 'never':
return JobSummaryOption.Never;
case 'always':
return JobSummaryOption.Always;
case 'on-failure':
return JobSummaryOption.OnFailure;
}
throw TypeError(`The value '${val}' is not valid for ${paramName}. Valid values are: [never, always, on-failure].`);
}
}
exports.SummaryConfig = SummaryConfig;
var JobSummaryOption;
(function (JobSummaryOption) {
JobSummaryOption["Never"] = "never";
JobSummaryOption["Always"] = "always";
JobSummaryOption["OnFailure"] = "on-failure";
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));
class BuildScanConfig {
getBuildScanPublishEnabled() {
if (!this.verifyTermsOfUseAgreement()) {
return false;
}
return getBooleanInput('build-scan-publish') && this.verifyTermsOfUseAgreement();
}
getBuildScanTermsOfUseUrl() {
return this.getTermsOfUseProp('build-scan-terms-of-use-url', 'build-scan-terms-of-service-url');
}
getBuildScanTermsOfUseAgree() {
return this.getTermsOfUseProp('build-scan-terms-of-use-agree', 'build-scan-terms-of-service-agree');
}
verifyTermsOfUseAgreement() {
if ((this.getBuildScanTermsOfUseUrl() !== 'https://gradle.com/terms-of-service' &&
this.getBuildScanTermsOfUseUrl() !== 'https://gradle.com/help/legal-terms-of-use') ||
this.getBuildScanTermsOfUseAgree() !== 'yes') {
core.warning(`Terms of use at 'https://gradle.com/help/legal-terms-of-use' must be agreed in order to publish build scans.`);
return false;
}
return true;
}
getTermsOfUseProp(newPropName, oldPropName) {
const newProp = core.getInput(newPropName);
if (newProp !== '') {
return newProp;
}
return core.getInput(oldPropName);
}
}
exports.BuildScanConfig = BuildScanConfig;
function getGradleVersion() {
return core.getInput('gradle-version');
}
exports.getGradleVersion = getGradleVersion;
function getBuildRootDirectory() {
return core.getInput('build-root-directory');
}
exports.getBuildRootDirectory = getBuildRootDirectory;
function getArguments() {
const input = core.getInput('arguments');
return (0, string_argv_1.parseArgsStringToArgv)(input);
}
exports.getArguments = getArguments;
function getJobMatrix() {
return core.getInput('workflow-job-context');
}
exports.getJobMatrix = getJobMatrix;
function getGithubToken() {
return core.getInput('github-token', { required: true });
}
exports.getGithubToken = getGithubToken;
function parseNumericInput(paramName, paramValue, paramDefault) {
if (paramValue.length === 0) {
return paramDefault;
@@ -141759,21 +141789,6 @@ function getBooleanInput(paramName, paramDefault = false) {
}
throw TypeError(`The value '${paramValue} is not valid for '${paramName}. Valid values are: [true, false]`);
}
var DependencyGraphOption;
(function (DependencyGraphOption) {
DependencyGraphOption["Disabled"] = "disabled";
DependencyGraphOption["Generate"] = "generate";
DependencyGraphOption["GenerateAndSubmit"] = "generate-and-submit";
DependencyGraphOption["GenerateAndUpload"] = "generate-and-upload";
DependencyGraphOption["DownloadAndSubmit"] = "download-and-submit";
DependencyGraphOption["Clear"] = "clear";
})(DependencyGraphOption || (exports.DependencyGraphOption = DependencyGraphOption = {}));
var JobSummaryOption;
(function (JobSummaryOption) {
JobSummaryOption["Never"] = "never";
JobSummaryOption["Always"] = "always";
JobSummaryOption["OnFailure"] = "on-failure";
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));
/***/ }),
@@ -141819,15 +141834,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const summary_1 = __nccwpck_require__(81327);
const request_error_1 = __nccwpck_require__(10537);
const params = __importStar(__nccwpck_require__(23885));
const cache_reporting_1 = __nccwpck_require__(66674);
function generateJobSummary(buildResults, cacheListener) {
const input_params_1 = __nccwpck_require__(23885);
function generateJobSummary(buildResults, cacheListener, config) {
return __awaiter(this, void 0, void 0, function* () {
const summaryTable = renderSummaryTable(buildResults);
const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
if (shouldGenerateJobSummary(buildResults)) {
const hasFailure = buildResults.some(result => result.buildFailed);
if (config.shouldGenerateJobSummary(hasFailure)) {
core.info('Generating Job Summary');
core.summary.addRaw(summaryTable);
core.summary.addRaw(cachingReport);
@@ -141840,7 +141855,7 @@ function generateJobSummary(buildResults, cacheListener) {
core.info(cachingReport);
core.info('============================');
}
if (shouldAddPRComment(buildResults)) {
if (config.shouldAddPRComment(hasFailure)) {
yield addPRComment(summaryTable);
}
});
@@ -141861,7 +141876,7 @@ function addPRComment(jobSummary) {
</a>
${jobSummary}`;
const github_token = params.getGithubToken();
const github_token = (0, input_params_1.getGithubToken)();
const octokit = github.getOctokit(github_token);
try {
yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: pull_request_number, body: prComment }));
@@ -141929,29 +141944,6 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
return `<a href="${targetUrl}" rel="nofollow" target="_blank">${badgeHtml}</a>`;
}
function shouldGenerateJobSummary(buildResults) {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
if (!params.isJobSummaryEnabled()) {
return false;
}
return shouldAddJobSummary(params.getJobSummaryOption(), buildResults);
}
function shouldAddPRComment(buildResults) {
return shouldAddJobSummary(params.getPRCommentOption(), buildResults);
}
function shouldAddJobSummary(option, buildResults) {
switch (option) {
case params.JobSummaryOption.Always:
return true;
case params.JobSummaryOption.Never:
return false;
case params.JobSummaryOption.OnFailure:
core.info(`Got these build results: ${JSON.stringify(buildResults)}`);
return buildResults.some(result => result.buildFailed);
}
}
function truncateString(str, maxLength) {
if (str.length > maxLength) {
return `<div title='${str}'>${str.slice(0, maxLength - 1)}…</div>`;
@@ -142013,6 +142005,7 @@ const toolCache = __importStar(__nccwpck_require__(27784));
const gradlew = __importStar(__nccwpck_require__(32335));
const params = __importStar(__nccwpck_require__(23885));
const cache_utils_1 = __nccwpck_require__(41678);
const input_params_1 = __nccwpck_require__(23885);
const gradleVersionsBaseUrl = 'https://services.gradle.org/versions';
function provisionGradle() {
return __awaiter(this, void 0, void 0, function* () {
@@ -142130,7 +142123,8 @@ function locateGradleAndDownloadIfRequired(versionInfo) {
function downloadAndCacheGradleDistribution(versionInfo) {
return __awaiter(this, void 0, void 0, function* () {
const downloadPath = path.join(os.homedir(), `gradle-installations/downloads/gradle-${versionInfo.version}-bin.zip`);
if ((0, cache_utils_1.isCacheDisabled)()) {
const cacheConfig = new input_params_1.CacheConfig();
if (cacheConfig.isCacheDisabled()) {
yield downloadGradleDistribution(versionInfo, downloadPath);
return downloadPath;
}
@@ -142147,7 +142141,7 @@ function downloadAndCacheGradleDistribution(versionInfo) {
}
core.info(`Gradle distribution ${versionInfo.version} not found in cache. Will download.`);
yield downloadGradleDistribution(versionInfo, downloadPath);
if (!(0, cache_utils_1.isCacheReadOnly)()) {
if (!cacheConfig.isCacheReadOnly()) {
try {
yield cache.saveCache([downloadPath], cacheKey);
}
@@ -142282,8 +142276,6 @@ const path = __importStar(__nccwpck_require__(71017));
const os = __importStar(__nccwpck_require__(22037));
const caches = __importStar(__nccwpck_require__(23800));
const layout = __importStar(__nccwpck_require__(28182));
const params = __importStar(__nccwpck_require__(23885));
const dependencyGraph = __importStar(__nccwpck_require__(80));
const jobSummary = __importStar(__nccwpck_require__(87345));
const buildScan = __importStar(__nccwpck_require__(85772));
const build_results_1 = __nccwpck_require__(82107);
@@ -142293,31 +142285,31 @@ const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED';
const USER_HOME = 'USER_HOME';
const GRADLE_USER_HOME = 'GRADLE_USER_HOME';
const CACHE_LISTENER = 'CACHE_LISTENER';
function setup() {
function setup(cacheConfig, buildScanConfig) {
return __awaiter(this, void 0, void 0, function* () {
const userHome = yield determineUserHome();
const gradleUserHome = yield determineGradleUserHome();
if (process.env[GRADLE_SETUP_VAR]) {
core.info('Gradle setup only performed on first gradle/actions step in workflow.');
return;
return false;
}
core.exportVariable(GRADLE_SETUP_VAR, true);
core.saveState(GRADLE_SETUP_VAR, true);
core.saveState(USER_HOME, userHome);
core.saveState(GRADLE_USER_HOME, gradleUserHome);
const cacheListener = new cache_reporting_1.CacheListener();
yield caches.restore(userHome, gradleUserHome, cacheListener);
yield caches.restore(userHome, gradleUserHome, cacheListener, cacheConfig);
core.saveState(CACHE_LISTENER, cacheListener.stringify());
yield dependencyGraph.setup(params.getDependencyGraphOption());
buildScan.setup();
buildScan.setup(buildScanConfig);
return true;
});
}
exports.setup = setup;
function complete() {
function complete(cacheConfig, summaryConfig) {
return __awaiter(this, void 0, void 0, function* () {
if (!core.getState(GRADLE_SETUP_VAR)) {
core.info('Gradle setup post-action only performed for first gradle/actions step in workflow.');
return;
return false;
}
core.info('In post-action step');
const buildResults = (0, build_results_1.loadBuildResults)();
@@ -142325,10 +142317,10 @@ function complete() {
const gradleUserHome = core.getState(GRADLE_USER_HOME);
const cacheListener = cache_reporting_1.CacheListener.rehydrate(core.getState(CACHE_LISTENER));
const daemonController = new daemon_controller_1.DaemonController(buildResults);
yield caches.save(userHome, gradleUserHome, cacheListener, daemonController);
yield jobSummary.generateJobSummary(buildResults, cacheListener);
yield dependencyGraph.complete(params.getDependencyGraphOption());
yield caches.save(userHome, gradleUserHome, cacheListener, daemonController, cacheConfig);
yield jobSummary.generateJobSummary(buildResults, cacheListener, summaryConfig);
core.info('Completed post-action step');
return true;
});
}
exports.complete = complete;
@@ -142404,13 +142396,15 @@ const setupGradle = __importStar(__nccwpck_require__(18652));
const execution = __importStar(__nccwpck_require__(23584));
const provisioner = __importStar(__nccwpck_require__(32501));
const layout = __importStar(__nccwpck_require__(28182));
const params = __importStar(__nccwpck_require__(23885));
const dependencyGraph = __importStar(__nccwpck_require__(80));
const input_params_1 = __nccwpck_require__(23885);
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
yield setupGradle.setup();
yield setupGradle.setup(new input_params_1.CacheConfig(), new input_params_1.BuildScanConfig());
yield dependencyGraph.setup(new input_params_1.DependencyGraphConfig());
const executable = yield provisioner.provisionGradle();
const args = params.getArguments();
const args = (0, input_params_1.getArguments)();
if (args.length > 0) {
const buildRootDirectory = layout.buildRootDirectory();
yield execution.executeGradleBuild(executable, buildRootDirectory, args);
File diff suppressed because one or more lines are too long
+279 -285
View File
@@ -137180,28 +137180,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setup = void 0;
const core = __importStar(__nccwpck_require__(42186));
const input_params_1 = __nccwpck_require__(23885);
function setup() {
function setup(config) {
maybeExportVariable('DEVELOCITY_INJECTION_INIT_SCRIPT_NAME', 'gradle-actions.inject-develocity.init.gradle');
maybeExportVariable('DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE', 'gradle-actions');
if ((0, input_params_1.getBuildScanPublishEnabled)() && verifyTermsOfUseAgreement()) {
if (config.getBuildScanPublishEnabled()) {
maybeExportVariable('DEVELOCITY_INJECTION_ENABLED', 'true');
maybeExportVariable('DEVELOCITY_PLUGIN_VERSION', '3.17');
maybeExportVariable('DEVELOCITY_CCUD_PLUGIN_VERSION', '1.13');
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', (0, input_params_1.getBuildScanTermsOfUseUrl)());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', (0, input_params_1.getBuildScanTermsOfUseAgree)());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_URL', config.getBuildScanTermsOfUseUrl());
maybeExportVariable('DEVELOCITY_TERMS_OF_USE_AGREE', config.getBuildScanTermsOfUseAgree());
}
}
exports.setup = setup;
function verifyTermsOfUseAgreement() {
if (((0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/terms-of-service' &&
(0, input_params_1.getBuildScanTermsOfUseUrl)() !== 'https://gradle.com/help/legal-terms-of-use') ||
(0, input_params_1.getBuildScanTermsOfUseAgree)() !== 'yes') {
core.warning(`Terms of use must be agreed in order to publish build scans.`);
return false;
}
return true;
}
function maybeExportVariable(variableName, value) {
if (!process.env[variableName]) {
core.exportVariable(variableName, value);
@@ -137258,21 +137248,21 @@ const exec = __importStar(__nccwpck_require__(71514));
const glob = __importStar(__nccwpck_require__(28090));
const path_1 = __importDefault(__nccwpck_require__(71017));
const fs_1 = __importDefault(__nccwpck_require__(57147));
const params = __importStar(__nccwpck_require__(23885));
const cache_utils_1 = __nccwpck_require__(41678);
const cache_extract_entries_1 = __nccwpck_require__(76161);
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
exports.META_FILE_DIR = '.setup-gradle';
class GradleStateCache {
constructor(userHome, gradleUserHome) {
constructor(userHome, gradleUserHome, cacheConfig) {
this.userHome = userHome;
this.gradleUserHome = gradleUserHome;
this.cacheConfig = cacheConfig;
this.cacheName = 'gradle';
this.cacheDescription = 'Gradle User Home';
}
init() {
this.initializeGradleUserHome();
const encryptionKey = params.getCacheEncryptionKey();
const encryptionKey = this.cacheConfig.getCacheEncryptionKey();
if (encryptionKey) {
core.exportVariable('GRADLE_ENCRYPTION_KEY', encryptionKey);
}
@@ -137288,7 +137278,7 @@ class GradleStateCache {
restore(listener) {
return __awaiter(this, void 0, void 0, function* () {
const entryListener = listener.entry(this.cacheDescription);
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName);
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName, this.cacheConfig);
(0, cache_utils_1.cacheDebug)(`Requesting ${this.cacheDescription} with
key:${cacheKey.key}
restoreKeys:[${cacheKey.restoreKeys}]`);
@@ -137310,14 +137300,14 @@ class GradleStateCache {
afterRestore(listener) {
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 new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome, this.cacheConfig).restore(listener);
yield new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome, this.cacheConfig).restore(listener);
yield this.debugReportGradleUserHomeSize('after restoring common artifacts');
});
}
save(listener) {
return __awaiter(this, void 0, void 0, function* () {
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName).key;
const cacheKey = (0, cache_utils_1.generateCacheKey)(this.cacheName, this.cacheConfig).key;
const restoredCacheKey = core.getState(RESTORED_CACHE_KEY_KEY);
const gradleHomeEntryListener = listener.entry(this.cacheDescription);
if (restoredCacheKey && cacheKey === restoredCacheKey) {
@@ -137350,15 +137340,15 @@ class GradleStateCache {
yield this.debugReportGradleUserHomeSize('before saving common artifacts');
yield this.deleteExcludedPaths();
yield Promise.all([
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome).extract(listener),
new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome).extract(listener)
new cache_extract_entries_1.GradleHomeEntryExtractor(this.gradleUserHome, this.cacheConfig).extract(listener),
new cache_extract_entries_1.ConfigurationCacheEntryExtractor(this.gradleUserHome, this.cacheConfig).extract(listener)
]);
yield this.debugReportGradleUserHomeSize("after extracting common artifacts (only 'caches' and 'notifications' will be stored)");
});
}
deleteExcludedPaths() {
return __awaiter(this, void 0, void 0, function* () {
const rawPaths = params.getCacheExcludes();
const rawPaths = this.cacheConfig.getCacheExcludes();
rawPaths.push('caches/*/cc-keystore');
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
for (const p of resolvedPaths) {
@@ -137374,7 +137364,7 @@ class GradleStateCache {
});
}
getCachePath() {
const rawPaths = params.getCacheIncludes();
const rawPaths = this.cacheConfig.getCacheIncludes();
rawPaths.push(exports.META_FILE_DIR);
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x));
(0, cache_utils_1.cacheDebug)(`Using cache paths: ${resolvedPaths}`);
@@ -137646,7 +137636,6 @@ const fs_1 = __importDefault(__nccwpck_require__(57147));
const core = __importStar(__nccwpck_require__(42186));
const glob = __importStar(__nccwpck_require__(28090));
const semver = __importStar(__nccwpck_require__(11383));
const params = __importStar(__nccwpck_require__(23885));
const cache_base_1 = __nccwpck_require__(47591);
const cache_utils_1 = __nccwpck_require__(41678);
const build_results_1 = __nccwpck_require__(82107);
@@ -137680,9 +137669,10 @@ class ExtractedCacheEntryDefinition {
}
}
class AbstractEntryExtractor {
constructor(gradleUserHome, extractorName) {
constructor(gradleUserHome, extractorName, cacheConfig) {
this.gradleUserHome = gradleUserHome;
this.extractorName = extractorName;
this.cacheConfig = cacheConfig;
}
restore(listener) {
return __awaiter(this, void 0, void 0, function* () {
@@ -137787,7 +137777,7 @@ class AbstractEntryExtractor {
}
awaitForDebugging(p) {
return __awaiter(this, void 0, void 0, function* () {
if (params.isCacheDebuggingEnabled()) {
if ((0, cache_utils_1.isCacheDebuggingEnabled)()) {
yield p;
}
return p;
@@ -137817,8 +137807,8 @@ class AbstractEntryExtractor {
}
}
class GradleHomeEntryExtractor extends AbstractEntryExtractor {
constructor(gradleUserHome) {
super(gradleUserHome, 'gradle-home');
constructor(gradleUserHome, cacheConfig) {
super(gradleUserHome, 'gradle-home', cacheConfig);
}
extract(listener) {
const _super = Object.create(null, {
@@ -137864,8 +137854,8 @@ class GradleHomeEntryExtractor extends AbstractEntryExtractor {
}
exports.GradleHomeEntryExtractor = GradleHomeEntryExtractor;
class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
constructor(gradleUserHome) {
super(gradleUserHome, 'configuration-cache');
constructor(gradleUserHome, cacheConfig) {
super(gradleUserHome, 'configuration-cache', cacheConfig);
}
restore(listener) {
const _super = Object.create(null, {
@@ -137876,7 +137866,7 @@ class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
this.markNotRestored(listener, 'Gradle User Home was not fully restored');
return;
}
if (!params.getCacheEncryptionKey()) {
if (!this.cacheConfig.getCacheEncryptionKey()) {
this.markNotRestored(listener, 'Encryption Key was not provided');
return;
}
@@ -137898,7 +137888,7 @@ class ConfigurationCacheEntryExtractor extends AbstractEntryExtractor {
extract: { get: () => super.extract }
});
return __awaiter(this, void 0, void 0, function* () {
if (!params.getCacheEncryptionKey()) {
if (!this.cacheConfig.getCacheEncryptionKey()) {
const cacheEntryDefinitions = this.getExtractedCacheEntryDefinitions();
if (cacheEntryDefinitions.length > 0) {
core.info('Not saving configuration-cache state, as no encryption key was provided');
@@ -138198,7 +138188,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheDebuggingEnabled = void 0;
const core = __importStar(__nccwpck_require__(42186));
const cache = __importStar(__nccwpck_require__(27799));
const github = __importStar(__nccwpck_require__(95438));
@@ -138206,7 +138196,7 @@ const exec = __importStar(__nccwpck_require__(71514));
const crypto = __importStar(__nccwpck_require__(6113));
const path = __importStar(__nccwpck_require__(71017));
const fs = __importStar(__nccwpck_require__(57147));
const params = __importStar(__nccwpck_require__(23885));
const input_params_1 = __nccwpck_require__(23885);
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';
@@ -138215,33 +138205,13 @@ const CACHE_KEY_JOB_INSTANCE_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_INSTANCE';
const CACHE_KEY_JOB_EXECUTION_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB_EXECUTION';
const SEGMENT_DOWNLOAD_TIMEOUT_VAR = 'SEGMENT_DOWNLOAD_TIMEOUT_MINS';
const SEGMENT_DOWNLOAD_TIMEOUT_DEFAULT = 10 * 60 * 1000;
function isCacheDisabled() {
if (!cache.isFeatureAvailable()) {
function isCacheDebuggingEnabled() {
if (core.isDebug()) {
return true;
}
return params.isCacheDisabled();
}
exports.isCacheDisabled = isCacheDisabled;
function isCacheReadOnly() {
return !isCacheWriteOnly() && params.isCacheReadOnly();
}
exports.isCacheReadOnly = isCacheReadOnly;
function isCacheWriteOnly() {
return params.isCacheWriteOnly();
}
exports.isCacheWriteOnly = isCacheWriteOnly;
function isCacheOverwriteExisting() {
return params.isCacheOverwriteExisting();
}
exports.isCacheOverwriteExisting = isCacheOverwriteExisting;
function isCacheDebuggingEnabled() {
return params.isCacheDebuggingEnabled();
return process.env['GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'] ? true : false;
}
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
function isCacheCleanupEnabled() {
return params.isCacheCleanupEnabled();
}
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
class CacheKey {
constructor(key, restoreKeys) {
this.key = key;
@@ -138249,13 +138219,13 @@ class CacheKey {
}
}
exports.CacheKey = CacheKey;
function generateCacheKey(cacheName) {
function generateCacheKey(cacheName, config) {
const cacheKeyBase = `${getCacheKeyPrefix()}${CACHE_PROTOCOL_VERSION}${cacheName}`;
const cacheKeyForEnvironment = `${cacheKeyBase}|${getCacheKeyEnvironment()}`;
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`;
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`;
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`;
if (params.isCacheStrictMatch()) {
if (config.isCacheStrictMatch()) {
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
}
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment]);
@@ -138278,7 +138248,7 @@ function getCacheKeyJobInstance() {
return override;
}
const workflowName = github.context.workflow;
const workflowJobContext = params.getJobMatrix();
const workflowJobContext = (0, input_params_1.getJobMatrix)();
return hashStrings([workflowName, workflowJobContext]);
}
function getCacheKeyJobExecution() {
@@ -138447,26 +138417,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.save = exports.restore = void 0;
const core = __importStar(__nccwpck_require__(42186));
const cache_utils_1 = __nccwpck_require__(41678);
const cache_base_1 = __nccwpck_require__(47591);
const cache_cleaner_1 = __nccwpck_require__(57);
const CACHE_RESTORED_VAR = 'GRADLE_BUILD_ACTION_CACHE_RESTORED';
function restore(userHome, gradleUserHome, cacheListener) {
function restore(userHome, gradleUserHome, cacheListener, cacheConfig) {
return __awaiter(this, void 0, void 0, function* () {
if (process.env[CACHE_RESTORED_VAR]) {
core.info('Cache only restored on first action step.');
return;
}
core.exportVariable(CACHE_RESTORED_VAR, true);
const gradleStateCache = new cache_base_1.GradleStateCache(userHome, gradleUserHome);
if ((0, cache_utils_1.isCacheDisabled)()) {
const gradleStateCache = new cache_base_1.GradleStateCache(userHome, gradleUserHome, cacheConfig);
if (cacheConfig.isCacheDisabled()) {
core.info('Cache is disabled: will not restore state from previous builds.');
gradleStateCache.init();
cacheListener.cacheDisabled = true;
return;
}
if (gradleStateCache.cacheOutputExists()) {
if (!(0, cache_utils_1.isCacheOverwriteExisting)()) {
if (!cacheConfig.isCacheOverwriteExisting()) {
core.info('Gradle User Home already exists: will not restore from cache.');
gradleStateCache.init();
cacheListener.cacheDisabled = true;
@@ -138477,7 +138446,7 @@ function restore(userHome, gradleUserHome, cacheListener) {
}
gradleStateCache.init();
core.saveState(CACHE_RESTORED_VAR, true);
if ((0, cache_utils_1.isCacheWriteOnly)()) {
if (cacheConfig.isCacheWriteOnly()) {
core.info('Cache is write-only: will not restore from cache.');
cacheListener.cacheWriteOnly = true;
return;
@@ -138485,7 +138454,7 @@ function restore(userHome, gradleUserHome, cacheListener) {
yield core.group('Restore Gradle state from cache', () => __awaiter(this, void 0, void 0, function* () {
yield gradleStateCache.restore(cacheListener);
}));
if ((0, cache_utils_1.isCacheCleanupEnabled)() && !(0, cache_utils_1.isCacheReadOnly)()) {
if (cacheConfig.isCacheCleanupEnabled()) {
core.info('Preparing cache for cleanup.');
const cacheCleaner = new cache_cleaner_1.CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']);
yield cacheCleaner.prepare();
@@ -138493,9 +138462,9 @@ function restore(userHome, gradleUserHome, cacheListener) {
});
}
exports.restore = restore;
function save(userHome, gradleUserHome, cacheListener, daemonController) {
function save(userHome, gradleUserHome, cacheListener, daemonController, cacheConfig) {
return __awaiter(this, void 0, void 0, function* () {
if ((0, cache_utils_1.isCacheDisabled)()) {
if (cacheConfig.isCacheDisabled()) {
core.info('Cache is disabled: will not save state for later builds.');
return;
}
@@ -138503,13 +138472,13 @@ function save(userHome, gradleUserHome, cacheListener, daemonController) {
core.info('Cache will not be saved: not restored in main action step.');
return;
}
if ((0, cache_utils_1.isCacheReadOnly)()) {
if (cacheConfig.isCacheReadOnly()) {
core.info('Cache is read-only: will not save state for use in subsequent builds.');
cacheListener.cacheReadOnly = true;
return;
}
yield daemonController.stopAllDaemons();
if ((0, cache_utils_1.isCacheCleanupEnabled)()) {
if (cacheConfig.isCacheCleanupEnabled()) {
core.info('Forcing cache cleanup.');
const cacheCleaner = new cache_cleaner_1.CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']);
try {
@@ -138520,7 +138489,7 @@ function save(userHome, gradleUserHome, cacheListener, daemonController) {
}
}
yield core.group('Caching Gradle state', () => __awaiter(this, void 0, void 0, function* () {
return new cache_base_1.GradleStateCache(userHome, gradleUserHome).save(cacheListener);
return new cache_base_1.GradleStateCache(userHome, gradleUserHome, cacheConfig).save(cacheListener);
}));
});
}
@@ -138643,7 +138612,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.constructJobCorrelator = exports.complete = exports.setup = void 0;
exports.complete = exports.setup = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const glob = __importStar(__nccwpck_require__(28090));
@@ -138655,25 +138624,26 @@ const layout = __importStar(__nccwpck_require__(28182));
const errors_1 = __nccwpck_require__(36976);
const input_params_1 = __nccwpck_require__(23885);
const DEPENDENCY_GRAPH_PREFIX = 'dependency-graph_';
function setup(option) {
function setup(config) {
return __awaiter(this, void 0, void 0, function* () {
if (option === input_params_1.DependencyGraphOption.Disabled) {
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.Disabled) {
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'false');
return;
}
if (option === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
yield downloadAndSubmitDependencyGraphs();
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.DownloadAndSubmit) {
yield downloadAndSubmitDependencyGraphs(config);
return;
}
core.info('Enabling dependency graph generation');
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true');
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE', (0, input_params_1.getDependencyGraphContinueOnFailure)());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', getJobCorrelator());
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true');
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_CONTINUE_ON_FAILURE', config.continueOnFailure);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', config.getJobCorrelator());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_REF', github.context.ref);
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext());
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', layout.workspaceDirectory());
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports'));
if (option === input_params_1.DependencyGraphOption.Clear) {
if (config.dependencyGraphOption === input_params_1.DependencyGraphOption.Clear) {
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', '');
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '');
}
@@ -138685,10 +138655,14 @@ function maybeExportVariable(variableName, value) {
core.exportVariable(variableName, value);
}
}
function complete(option) {
function complete(config) {
return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) {
core.info('Dependency graph upload and submit not supported in the ACT environment.');
return;
}
try {
switch (option) {
switch (config.dependencyGraphOption) {
case input_params_1.DependencyGraphOption.Disabled:
case input_params_1.DependencyGraphOption.Generate:
case input_params_1.DependencyGraphOption.DownloadAndSubmit:
@@ -138698,11 +138672,11 @@ function complete(option) {
yield submitDependencyGraphs(yield findGeneratedDependencyGraphFiles());
return;
case input_params_1.DependencyGraphOption.GenerateAndUpload:
yield uploadDependencyGraphs(yield findGeneratedDependencyGraphFiles());
yield uploadDependencyGraphs(yield findGeneratedDependencyGraphFiles(), config);
}
}
catch (e) {
warnOrFail(option, e);
warnOrFail(config, e);
}
});
}
@@ -138713,7 +138687,7 @@ function findGeneratedDependencyGraphFiles() {
return yield findDependencyGraphFiles(workspaceDirectory);
});
}
function uploadDependencyGraphs(dependencyGraphFiles) {
function uploadDependencyGraphs(dependencyGraphFiles, config) {
return __awaiter(this, void 0, void 0, function* () {
const workspaceDirectory = layout.workspaceDirectory();
const artifactClient = new artifact_1.DefaultArtifactClient();
@@ -138722,18 +138696,22 @@ function uploadDependencyGraphs(dependencyGraphFiles) {
core.info(`Uploading dependency graph file: ${relativePath}`);
const artifactName = `${DEPENDENCY_GRAPH_PREFIX}${path.basename(dependencyGraphFile)}`;
yield artifactClient.uploadArtifact(artifactName, [dependencyGraphFile], workspaceDirectory, {
retentionDays: (0, input_params_1.getArtifactRetentionDays)()
retentionDays: config.artifactRetentionDays
});
}
});
}
function downloadAndSubmitDependencyGraphs() {
function downloadAndSubmitDependencyGraphs(config) {
return __awaiter(this, void 0, void 0, function* () {
if (isRunningInActEnvironment()) {
core.info('Dependency graph download and submit not supported in the ACT environment.');
return;
}
try {
yield submitDependencyGraphs(yield downloadDependencyGraphs());
}
catch (e) {
warnOrFail(input_params_1.DependencyGraphOption.DownloadAndSubmit, e);
warnOrFail(config, e);
}
});
}
@@ -138811,11 +138789,11 @@ function findDependencyGraphFiles(dir) {
return graphFiles;
});
}
function warnOrFail(option, error) {
if (!(0, input_params_1.getDependencyGraphContinueOnFailure)()) {
function warnOrFail(config, error) {
if (!config.continueOnFailure) {
throw new errors_1.PostActionJobFailure(error);
}
core.warning(`Failed to ${option} dependency graph. Will continue.\n${String(error)}`);
core.warning(`Failed to ${config.dependencyGraphOption} dependency graph. Will continue.\n${String(error)}`);
}
function getOctokit() {
return github.getOctokit((0, input_params_1.getGithubToken)());
@@ -138840,28 +138818,8 @@ function getShaFromContext() {
return context.sha;
}
}
function getJobCorrelator() {
return constructJobCorrelator(github.context.workflow, github.context.job, (0, input_params_1.getJobMatrix)());
}
function constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
return sanitize(label);
}
exports.constructJobCorrelator = constructJobCorrelator;
function describeMatrix(matrixJson) {
core.debug(`Got matrix json: ${matrixJson}`);
const matrix = JSON.parse(matrixJson);
if (matrix) {
return Object.values(matrix).join('-');
}
return '';
}
function sanitize(value) {
return value
.replace(/[^a-zA-Z0-9_-\s]/g, '')
.replace(/\s+/g, '_')
.toLowerCase();
function isRunningInActEnvironment() {
return process.env.ACT !== undefined;
}
@@ -138920,114 +138878,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.JobSummaryOption = exports.DependencyGraphOption = exports.parseNumericInput = exports.getArtifactRetentionDays = exports.getDependencyGraphContinueOnFailure = exports.getDependencyGraphOption = exports.getBuildScanTermsOfUseAgree = exports.getBuildScanTermsOfUseUrl = exports.getBuildScanPublishEnabled = exports.getPRCommentOption = exports.getJobSummaryOption = exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.getCacheEncryptionKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheOverwriteExisting = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
exports.parseNumericInput = exports.getGithubToken = exports.getJobMatrix = exports.getArguments = exports.getBuildRootDirectory = exports.getGradleVersion = exports.BuildScanConfig = exports.JobSummaryOption = exports.SummaryConfig = exports.CacheConfig = exports.DependencyGraphOption = exports.DependencyGraphConfig = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const cache = __importStar(__nccwpck_require__(27799));
const summary_1 = __nccwpck_require__(81327);
const string_argv_1 = __nccwpck_require__(19663);
function isCacheDisabled() {
return getBooleanInput('cache-disabled');
}
exports.isCacheDisabled = isCacheDisabled;
function isCacheReadOnly() {
return getBooleanInput('cache-read-only');
}
exports.isCacheReadOnly = isCacheReadOnly;
function isCacheWriteOnly() {
return getBooleanInput('cache-write-only');
}
exports.isCacheWriteOnly = isCacheWriteOnly;
function isCacheOverwriteExisting() {
return getBooleanInput('cache-overwrite-existing');
}
exports.isCacheOverwriteExisting = isCacheOverwriteExisting;
function isCacheStrictMatch() {
return getBooleanInput('gradle-home-cache-strict-match');
}
exports.isCacheStrictMatch = isCacheStrictMatch;
function isCacheDebuggingEnabled() {
return process.env['GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'] ? true : false;
}
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
function isCacheCleanupEnabled() {
return getBooleanInput('gradle-home-cache-cleanup');
}
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
function getCacheEncryptionKey() {
return core.getInput('cache-encryption-key');
}
exports.getCacheEncryptionKey = getCacheEncryptionKey;
function getCacheIncludes() {
return core.getMultilineInput('gradle-home-cache-includes');
}
exports.getCacheIncludes = getCacheIncludes;
function getCacheExcludes() {
return core.getMultilineInput('gradle-home-cache-excludes');
}
exports.getCacheExcludes = getCacheExcludes;
function getBuildRootDirectory() {
return core.getInput('build-root-directory');
}
exports.getBuildRootDirectory = getBuildRootDirectory;
function getGradleVersion() {
return core.getInput('gradle-version');
}
exports.getGradleVersion = getGradleVersion;
function getArguments() {
const input = core.getInput('arguments');
return (0, string_argv_1.parseArgsStringToArgv)(input);
}
exports.getArguments = getArguments;
function getJobMatrix() {
return core.getInput('workflow-job-context');
}
exports.getJobMatrix = getJobMatrix;
function getGithubToken() {
return core.getInput('github-token', { required: true });
}
exports.getGithubToken = getGithubToken;
function isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
exports.isJobSummaryEnabled = isJobSummaryEnabled;
function getJobSummaryOption() {
return parseJobSummaryOption('add-job-summary');
}
exports.getJobSummaryOption = getJobSummaryOption;
function getPRCommentOption() {
return parseJobSummaryOption('add-job-summary-as-pr-comment');
}
exports.getPRCommentOption = getPRCommentOption;
function getBuildScanPublishEnabled() {
return getBooleanInput('build-scan-publish');
}
exports.getBuildScanPublishEnabled = getBuildScanPublishEnabled;
function getBuildScanTermsOfUseUrl() {
return getTermsOfUseProp('build-scan-terms-of-use-url', 'build-scan-terms-of-service-url');
}
exports.getBuildScanTermsOfUseUrl = getBuildScanTermsOfUseUrl;
function getBuildScanTermsOfUseAgree() {
return getTermsOfUseProp('build-scan-terms-of-use-agree', 'build-scan-terms-of-service-agree');
}
exports.getBuildScanTermsOfUseAgree = getBuildScanTermsOfUseAgree;
function getTermsOfUseProp(newPropName, oldPropName) {
const newProp = core.getInput(newPropName);
if (newProp !== '') {
return newProp;
class DependencyGraphConfig {
constructor() {
this.dependencyGraphOption = this.getDependencyGraphOption();
this.continueOnFailure = this.getDependencyGraphContinueOnFailure();
this.artifactRetentionDays = this.getArtifactRetentionDays();
}
return core.getInput(oldPropName);
}
function parseJobSummaryOption(paramName) {
const val = core.getInput(paramName);
switch (val.toLowerCase().trim()) {
case 'never':
return JobSummaryOption.Never;
case 'always':
return JobSummaryOption.Always;
case 'on-failure':
return JobSummaryOption.OnFailure;
}
throw TypeError(`The value '${val}' is not valid for ${paramName}. Valid values are: [never, always, on-failure].`);
}
function getDependencyGraphOption() {
getDependencyGraphOption() {
const val = core.getInput('dependency-graph');
switch (val.toLowerCase().trim()) {
case 'disabled':
@@ -139044,17 +138907,184 @@ function getDependencyGraphOption() {
return DependencyGraphOption.Clear;
}
throw TypeError(`The value '${val}' is not valid for 'dependency-graph'. Valid values are: [disabled, generate, generate-and-submit, generate-and-upload, download-and-submit, clear]. The default value is 'disabled'.`);
}
exports.getDependencyGraphOption = getDependencyGraphOption;
function getDependencyGraphContinueOnFailure() {
}
getDependencyGraphContinueOnFailure() {
return getBooleanInput('dependency-graph-continue-on-failure', true);
}
exports.getDependencyGraphContinueOnFailure = getDependencyGraphContinueOnFailure;
function getArtifactRetentionDays() {
}
getArtifactRetentionDays() {
const val = core.getInput('artifact-retention-days');
return parseNumericInput('artifact-retention-days', val, 0);
}
getJobCorrelator() {
return DependencyGraphConfig.constructJobCorrelator(github.context.workflow, github.context.job, getJobMatrix());
}
static constructJobCorrelator(workflow, jobId, matrixJson) {
const matrixString = this.describeMatrix(matrixJson);
const label = matrixString ? `${workflow}-${jobId}-${matrixString}` : `${workflow}-${jobId}`;
return this.sanitize(label);
}
static describeMatrix(matrixJson) {
core.debug(`Got matrix json: ${matrixJson}`);
const matrix = JSON.parse(matrixJson);
if (matrix) {
return Object.values(matrix).join('-');
}
return '';
}
static sanitize(value) {
return value
.replace(/[^a-zA-Z0-9_-\s]/g, '')
.replace(/\s+/g, '_')
.toLowerCase();
}
}
exports.getArtifactRetentionDays = getArtifactRetentionDays;
exports.DependencyGraphConfig = DependencyGraphConfig;
var DependencyGraphOption;
(function (DependencyGraphOption) {
DependencyGraphOption["Disabled"] = "disabled";
DependencyGraphOption["Generate"] = "generate";
DependencyGraphOption["GenerateAndSubmit"] = "generate-and-submit";
DependencyGraphOption["GenerateAndUpload"] = "generate-and-upload";
DependencyGraphOption["DownloadAndSubmit"] = "download-and-submit";
DependencyGraphOption["Clear"] = "clear";
})(DependencyGraphOption || (exports.DependencyGraphOption = DependencyGraphOption = {}));
class CacheConfig {
isCacheDisabled() {
if (!cache.isFeatureAvailable()) {
return true;
}
return getBooleanInput('cache-disabled');
}
isCacheReadOnly() {
return !this.isCacheWriteOnly() && getBooleanInput('cache-read-only');
}
isCacheWriteOnly() {
return getBooleanInput('cache-write-only');
}
isCacheOverwriteExisting() {
return getBooleanInput('cache-overwrite-existing');
}
isCacheStrictMatch() {
return getBooleanInput('gradle-home-cache-strict-match');
}
isCacheCleanupEnabled() {
return getBooleanInput('gradle-home-cache-cleanup') && !this.isCacheReadOnly();
}
getCacheEncryptionKey() {
return core.getInput('cache-encryption-key');
}
getCacheIncludes() {
return core.getMultilineInput('gradle-home-cache-includes');
}
getCacheExcludes() {
return core.getMultilineInput('gradle-home-cache-excludes');
}
}
exports.CacheConfig = CacheConfig;
class SummaryConfig {
shouldGenerateJobSummary(hasFailure) {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
if (!this.isJobSummaryEnabled()) {
return false;
}
return this.shouldAddJobSummary(this.getJobSummaryOption(), hasFailure);
}
shouldAddPRComment(hasFailure) {
return this.shouldAddJobSummary(this.getPRCommentOption(), hasFailure);
}
shouldAddJobSummary(option, hasFailure) {
switch (option) {
case JobSummaryOption.Always:
return true;
case JobSummaryOption.Never:
return false;
case JobSummaryOption.OnFailure:
return hasFailure;
}
}
isJobSummaryEnabled() {
return getBooleanInput('generate-job-summary', true);
}
getJobSummaryOption() {
return this.parseJobSummaryOption('add-job-summary');
}
getPRCommentOption() {
return this.parseJobSummaryOption('add-job-summary-as-pr-comment');
}
parseJobSummaryOption(paramName) {
const val = core.getInput(paramName);
switch (val.toLowerCase().trim()) {
case 'never':
return JobSummaryOption.Never;
case 'always':
return JobSummaryOption.Always;
case 'on-failure':
return JobSummaryOption.OnFailure;
}
throw TypeError(`The value '${val}' is not valid for ${paramName}. Valid values are: [never, always, on-failure].`);
}
}
exports.SummaryConfig = SummaryConfig;
var JobSummaryOption;
(function (JobSummaryOption) {
JobSummaryOption["Never"] = "never";
JobSummaryOption["Always"] = "always";
JobSummaryOption["OnFailure"] = "on-failure";
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));
class BuildScanConfig {
getBuildScanPublishEnabled() {
if (!this.verifyTermsOfUseAgreement()) {
return false;
}
return getBooleanInput('build-scan-publish') && this.verifyTermsOfUseAgreement();
}
getBuildScanTermsOfUseUrl() {
return this.getTermsOfUseProp('build-scan-terms-of-use-url', 'build-scan-terms-of-service-url');
}
getBuildScanTermsOfUseAgree() {
return this.getTermsOfUseProp('build-scan-terms-of-use-agree', 'build-scan-terms-of-service-agree');
}
verifyTermsOfUseAgreement() {
if ((this.getBuildScanTermsOfUseUrl() !== 'https://gradle.com/terms-of-service' &&
this.getBuildScanTermsOfUseUrl() !== 'https://gradle.com/help/legal-terms-of-use') ||
this.getBuildScanTermsOfUseAgree() !== 'yes') {
core.warning(`Terms of use at 'https://gradle.com/help/legal-terms-of-use' must be agreed in order to publish build scans.`);
return false;
}
return true;
}
getTermsOfUseProp(newPropName, oldPropName) {
const newProp = core.getInput(newPropName);
if (newProp !== '') {
return newProp;
}
return core.getInput(oldPropName);
}
}
exports.BuildScanConfig = BuildScanConfig;
function getGradleVersion() {
return core.getInput('gradle-version');
}
exports.getGradleVersion = getGradleVersion;
function getBuildRootDirectory() {
return core.getInput('build-root-directory');
}
exports.getBuildRootDirectory = getBuildRootDirectory;
function getArguments() {
const input = core.getInput('arguments');
return (0, string_argv_1.parseArgsStringToArgv)(input);
}
exports.getArguments = getArguments;
function getJobMatrix() {
return core.getInput('workflow-job-context');
}
exports.getJobMatrix = getJobMatrix;
function getGithubToken() {
return core.getInput('github-token', { required: true });
}
exports.getGithubToken = getGithubToken;
function parseNumericInput(paramName, paramValue, paramDefault) {
if (paramValue.length === 0) {
return paramDefault;
@@ -139078,21 +139108,6 @@ function getBooleanInput(paramName, paramDefault = false) {
}
throw TypeError(`The value '${paramValue} is not valid for '${paramName}. Valid values are: [true, false]`);
}
var DependencyGraphOption;
(function (DependencyGraphOption) {
DependencyGraphOption["Disabled"] = "disabled";
DependencyGraphOption["Generate"] = "generate";
DependencyGraphOption["GenerateAndSubmit"] = "generate-and-submit";
DependencyGraphOption["GenerateAndUpload"] = "generate-and-upload";
DependencyGraphOption["DownloadAndSubmit"] = "download-and-submit";
DependencyGraphOption["Clear"] = "clear";
})(DependencyGraphOption || (exports.DependencyGraphOption = DependencyGraphOption = {}));
var JobSummaryOption;
(function (JobSummaryOption) {
JobSummaryOption["Never"] = "never";
JobSummaryOption["Always"] = "always";
JobSummaryOption["OnFailure"] = "on-failure";
})(JobSummaryOption || (exports.JobSummaryOption = JobSummaryOption = {}));
/***/ }),
@@ -139138,15 +139153,15 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.generateJobSummary = void 0;
const core = __importStar(__nccwpck_require__(42186));
const github = __importStar(__nccwpck_require__(95438));
const summary_1 = __nccwpck_require__(81327);
const request_error_1 = __nccwpck_require__(10537);
const params = __importStar(__nccwpck_require__(23885));
const cache_reporting_1 = __nccwpck_require__(66674);
function generateJobSummary(buildResults, cacheListener) {
const input_params_1 = __nccwpck_require__(23885);
function generateJobSummary(buildResults, cacheListener, config) {
return __awaiter(this, void 0, void 0, function* () {
const summaryTable = renderSummaryTable(buildResults);
const cachingReport = (0, cache_reporting_1.generateCachingReport)(cacheListener);
if (shouldGenerateJobSummary(buildResults)) {
const hasFailure = buildResults.some(result => result.buildFailed);
if (config.shouldGenerateJobSummary(hasFailure)) {
core.info('Generating Job Summary');
core.summary.addRaw(summaryTable);
core.summary.addRaw(cachingReport);
@@ -139159,7 +139174,7 @@ function generateJobSummary(buildResults, cacheListener) {
core.info(cachingReport);
core.info('============================');
}
if (shouldAddPRComment(buildResults)) {
if (config.shouldAddPRComment(hasFailure)) {
yield addPRComment(summaryTable);
}
});
@@ -139180,7 +139195,7 @@ function addPRComment(jobSummary) {
</a>
${jobSummary}`;
const github_token = params.getGithubToken();
const github_token = (0, input_params_1.getGithubToken)();
const octokit = github.getOctokit(github_token);
try {
yield octokit.rest.issues.createComment(Object.assign(Object.assign({}, context.repo), { issue_number: pull_request_number, body: prComment }));
@@ -139248,29 +139263,6 @@ function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
return `<a href="${targetUrl}" rel="nofollow" target="_blank">${badgeHtml}</a>`;
}
function shouldGenerateJobSummary(buildResults) {
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
return false;
}
if (!params.isJobSummaryEnabled()) {
return false;
}
return shouldAddJobSummary(params.getJobSummaryOption(), buildResults);
}
function shouldAddPRComment(buildResults) {
return shouldAddJobSummary(params.getPRCommentOption(), buildResults);
}
function shouldAddJobSummary(option, buildResults) {
switch (option) {
case params.JobSummaryOption.Always:
return true;
case params.JobSummaryOption.Never:
return false;
case params.JobSummaryOption.OnFailure:
core.info(`Got these build results: ${JSON.stringify(buildResults)}`);
return buildResults.some(result => result.buildFailed);
}
}
function truncateString(str, maxLength) {
if (str.length > maxLength) {
return `<div title='${str}'>${str.slice(0, maxLength - 1)}…</div>`;
@@ -139377,8 +139369,6 @@ const path = __importStar(__nccwpck_require__(71017));
const os = __importStar(__nccwpck_require__(22037));
const caches = __importStar(__nccwpck_require__(23800));
const layout = __importStar(__nccwpck_require__(28182));
const params = __importStar(__nccwpck_require__(23885));
const dependencyGraph = __importStar(__nccwpck_require__(80));
const jobSummary = __importStar(__nccwpck_require__(87345));
const buildScan = __importStar(__nccwpck_require__(85772));
const build_results_1 = __nccwpck_require__(82107);
@@ -139388,31 +139378,31 @@ const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED';
const USER_HOME = 'USER_HOME';
const GRADLE_USER_HOME = 'GRADLE_USER_HOME';
const CACHE_LISTENER = 'CACHE_LISTENER';
function setup() {
function setup(cacheConfig, buildScanConfig) {
return __awaiter(this, void 0, void 0, function* () {
const userHome = yield determineUserHome();
const gradleUserHome = yield determineGradleUserHome();
if (process.env[GRADLE_SETUP_VAR]) {
core.info('Gradle setup only performed on first gradle/actions step in workflow.');
return;
return false;
}
core.exportVariable(GRADLE_SETUP_VAR, true);
core.saveState(GRADLE_SETUP_VAR, true);
core.saveState(USER_HOME, userHome);
core.saveState(GRADLE_USER_HOME, gradleUserHome);
const cacheListener = new cache_reporting_1.CacheListener();
yield caches.restore(userHome, gradleUserHome, cacheListener);
yield caches.restore(userHome, gradleUserHome, cacheListener, cacheConfig);
core.saveState(CACHE_LISTENER, cacheListener.stringify());
yield dependencyGraph.setup(params.getDependencyGraphOption());
buildScan.setup();
buildScan.setup(buildScanConfig);
return true;
});
}
exports.setup = setup;
function complete() {
function complete(cacheConfig, summaryConfig) {
return __awaiter(this, void 0, void 0, function* () {
if (!core.getState(GRADLE_SETUP_VAR)) {
core.info('Gradle setup post-action only performed for first gradle/actions step in workflow.');
return;
return false;
}
core.info('In post-action step');
const buildResults = (0, build_results_1.loadBuildResults)();
@@ -139420,10 +139410,10 @@ function complete() {
const gradleUserHome = core.getState(GRADLE_USER_HOME);
const cacheListener = cache_reporting_1.CacheListener.rehydrate(core.getState(CACHE_LISTENER));
const daemonController = new daemon_controller_1.DaemonController(buildResults);
yield caches.save(userHome, gradleUserHome, cacheListener, daemonController);
yield jobSummary.generateJobSummary(buildResults, cacheListener);
yield dependencyGraph.complete(params.getDependencyGraphOption());
yield caches.save(userHome, gradleUserHome, cacheListener, daemonController, cacheConfig);
yield jobSummary.generateJobSummary(buildResults, cacheListener, summaryConfig);
core.info('Completed post-action step');
return true;
});
}
exports.complete = complete;
@@ -139496,12 +139486,16 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
const core = __importStar(__nccwpck_require__(42186));
const setupGradle = __importStar(__nccwpck_require__(18652));
const dependencyGraph = __importStar(__nccwpck_require__(80));
const input_params_1 = __nccwpck_require__(23885);
const errors_1 = __nccwpck_require__(36976);
process.on('uncaughtException', e => handleFailure(e));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
yield setupGradle.complete();
if (yield setupGradle.complete(new input_params_1.CacheConfig(), new input_params_1.SummaryConfig())) {
yield dependencyGraph.complete(new input_params_1.DependencyGraphConfig());
}
}
catch (error) {
if (error instanceof errors_1.PostActionJobFailure) {
File diff suppressed because one or more lines are too long