Skip to content

Commit

Permalink
Merge pull request #365 from dbast/master
Browse files Browse the repository at this point in the history
Update the verification-metadata if in use for dependency verification
  • Loading branch information
cristiangreco committed Dec 28, 2021
2 parents eae49ec + ee7ae38 commit f5b62b2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.createWrapperUpdater = void 0;
const core = __importStar(__nccwpck_require__(2186));
const cmd = __importStar(__nccwpck_require__(816));
const fs_1 = __importDefault(__nccwpck_require__(5747));
function createWrapperUpdater(wrapper, targetRelease, setDistributionChecksum) {
return new WrapperUpdater(wrapper, targetRelease, setDistributionChecksum);
}
Expand All @@ -1330,6 +1334,9 @@ class WrapperUpdater {
: this.targetRelease.allChecksum;
args = args.concat(['--gradle-distribution-sha256-sum', sha256sum]);
}
if (fs_1.default.existsSync('gradle/verification-metadata.xml')) {
args = args.concat(['--write-verification-metadata', 'sha256']);
}
const { exitCode, stderr } = yield cmd.execWithOutput('./gradlew', args, this.wrapper.basePath);
if (exitCode !== 0) {
throw new Error(stderr);
Expand Down
6 changes: 6 additions & 0 deletions src/wrapperUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import * as core from '@actions/core';

import * as cmd from './cmd';
import fs from 'fs';
import type {IWrapperInfo} from './wrapperInfo';
import type {Release} from './releases';

Expand Down Expand Up @@ -66,6 +67,11 @@ class WrapperUpdater implements IWrapperUpdater {
args = args.concat(['--gradle-distribution-sha256-sum', sha256sum]);
}

// Update verification data, if used
if (fs.existsSync('gradle/verification-metadata.xml')) {
args = args.concat(['--write-verification-metadata', 'sha256']);
}

const {exitCode, stderr} = await cmd.execWithOutput(
'./gradlew',
args,
Expand Down

0 comments on commit f5b62b2

Please sign in to comment.