mirror of
https://github.com/gradle/gradle-build-action.git
synced 2024-11-22 09:02:50 +00:00
Merge branch 'releases/v2.1'
* releases/v2.1: Build outputs Remove downloaded wrapper zips before caching Fix typo in worklow step
This commit is contained in:
commit
be62f7d934
6 changed files with 72 additions and 12 deletions
|
@ -24,7 +24,7 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout sources
|
- name: Checkout sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Exucute Gradle build
|
- name: Execute Gradle build
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||||
|
|
27
dist/main/index.js
vendored
27
dist/main/index.js
vendored
|
@ -144,9 +144,6 @@ function saveCache(paths, key, options) {
|
||||||
const cachePaths = yield utils.resolvePaths(paths);
|
const cachePaths = yield utils.resolvePaths(paths);
|
||||||
core.debug('Cache Paths:');
|
core.debug('Cache Paths:');
|
||||||
core.debug(`${JSON.stringify(cachePaths)}`);
|
core.debug(`${JSON.stringify(cachePaths)}`);
|
||||||
if (cachePaths.length === 0) {
|
|
||||||
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
|
|
||||||
}
|
|
||||||
const archiveFolder = yield utils.createTempDirectory();
|
const archiveFolder = yield utils.createTempDirectory();
|
||||||
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
||||||
core.debug(`Archive Path: ${archivePath}`);
|
core.debug(`Archive Path: ${archivePath}`);
|
||||||
|
@ -65286,6 +65283,28 @@ class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
||||||
constructor(gradleUserHome) {
|
constructor(gradleUserHome) {
|
||||||
super(gradleUserHome, 'gradle-home');
|
super(gradleUserHome, 'gradle-home');
|
||||||
}
|
}
|
||||||
|
extract(listener) {
|
||||||
|
const _super = Object.create(null, {
|
||||||
|
extract: { get: () => super.extract }
|
||||||
|
});
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
yield this.deleteWrapperZips();
|
||||||
|
return _super.extract.call(this, listener);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
deleteWrapperZips() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const wrapperZips = path_1.default.resolve(this.gradleUserHome, 'wrapper/dists/*/*/*.zip');
|
||||||
|
const globber = yield glob.create(wrapperZips, {
|
||||||
|
implicitDescendants: false,
|
||||||
|
followSymbolicLinks: false
|
||||||
|
});
|
||||||
|
for (const p of yield globber.glob()) {
|
||||||
|
(0, cache_utils_1.cacheDebug)(`Deleting wrapper zip: ${p}`);
|
||||||
|
(0, cache_utils_1.tryDelete)(p);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
getExtractedCacheEntryDefinitions() {
|
getExtractedCacheEntryDefinitions() {
|
||||||
const entryDefinition = (artifactType, patterns, bundle) => {
|
const entryDefinition = (artifactType, patterns, bundle) => {
|
||||||
const resolvedPatterns = patterns
|
const resolvedPatterns = patterns
|
||||||
|
@ -65299,7 +65318,7 @@ class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
||||||
};
|
};
|
||||||
return [
|
return [
|
||||||
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
||||||
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/*/'], false),
|
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/'], false),
|
||||||
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
||||||
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
||||||
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
||||||
|
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
27
dist/post/index.js
vendored
27
dist/post/index.js
vendored
|
@ -144,9 +144,6 @@ function saveCache(paths, key, options) {
|
||||||
const cachePaths = yield utils.resolvePaths(paths);
|
const cachePaths = yield utils.resolvePaths(paths);
|
||||||
core.debug('Cache Paths:');
|
core.debug('Cache Paths:');
|
||||||
core.debug(`${JSON.stringify(cachePaths)}`);
|
core.debug(`${JSON.stringify(cachePaths)}`);
|
||||||
if (cachePaths.length === 0) {
|
|
||||||
throw new Error(`Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.`);
|
|
||||||
}
|
|
||||||
const archiveFolder = yield utils.createTempDirectory();
|
const archiveFolder = yield utils.createTempDirectory();
|
||||||
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
const archivePath = path.join(archiveFolder, utils.getCacheFileName(compressionMethod));
|
||||||
core.debug(`Archive Path: ${archivePath}`);
|
core.debug(`Archive Path: ${archivePath}`);
|
||||||
|
@ -64337,6 +64334,28 @@ class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
||||||
constructor(gradleUserHome) {
|
constructor(gradleUserHome) {
|
||||||
super(gradleUserHome, 'gradle-home');
|
super(gradleUserHome, 'gradle-home');
|
||||||
}
|
}
|
||||||
|
extract(listener) {
|
||||||
|
const _super = Object.create(null, {
|
||||||
|
extract: { get: () => super.extract }
|
||||||
|
});
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
yield this.deleteWrapperZips();
|
||||||
|
return _super.extract.call(this, listener);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
deleteWrapperZips() {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const wrapperZips = path_1.default.resolve(this.gradleUserHome, 'wrapper/dists/*/*/*.zip');
|
||||||
|
const globber = yield glob.create(wrapperZips, {
|
||||||
|
implicitDescendants: false,
|
||||||
|
followSymbolicLinks: false
|
||||||
|
});
|
||||||
|
for (const p of yield globber.glob()) {
|
||||||
|
(0, cache_utils_1.cacheDebug)(`Deleting wrapper zip: ${p}`);
|
||||||
|
(0, cache_utils_1.tryDelete)(p);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
getExtractedCacheEntryDefinitions() {
|
getExtractedCacheEntryDefinitions() {
|
||||||
const entryDefinition = (artifactType, patterns, bundle) => {
|
const entryDefinition = (artifactType, patterns, bundle) => {
|
||||||
const resolvedPatterns = patterns
|
const resolvedPatterns = patterns
|
||||||
|
@ -64350,7 +64369,7 @@ class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
||||||
};
|
};
|
||||||
return [
|
return [
|
||||||
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
||||||
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/*/'], false),
|
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/'], false),
|
||||||
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
||||||
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
||||||
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
||||||
|
|
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -294,6 +294,28 @@ export class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
||||||
super(gradleUserHome, 'gradle-home')
|
super(gradleUserHome, 'gradle-home')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async extract(listener: CacheListener): Promise<void> {
|
||||||
|
await this.deleteWrapperZips()
|
||||||
|
return super.extract(listener)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete any downloaded wrapper zip files that are not needed after extraction.
|
||||||
|
* These files are cleaned up by Gradle >= 7.5, but for older versions we remove them manually.
|
||||||
|
*/
|
||||||
|
private async deleteWrapperZips(): Promise<void> {
|
||||||
|
const wrapperZips = path.resolve(this.gradleUserHome, 'wrapper/dists/*/*/*.zip')
|
||||||
|
const globber = await glob.create(wrapperZips, {
|
||||||
|
implicitDescendants: false,
|
||||||
|
followSymbolicLinks: false
|
||||||
|
})
|
||||||
|
|
||||||
|
for (const p of await globber.glob()) {
|
||||||
|
cacheDebug(`Deleting wrapper zip: ${p}`)
|
||||||
|
tryDelete(p)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the extracted cache entry definitions, which determine which artifacts will be cached
|
* Return the extracted cache entry definitions, which determine which artifacts will be cached
|
||||||
* separately from the rest of the Gradle User Home cache entry.
|
* separately from the rest of the Gradle User Home cache entry.
|
||||||
|
@ -316,7 +338,7 @@ export class GradleHomeEntryExtractor extends AbstractEntryExtractor {
|
||||||
|
|
||||||
return [
|
return [
|
||||||
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
entryDefinition('generated-gradle-jars', ['caches/*/generated-gradle-jars/*.jar'], false),
|
||||||
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/*/'], false), // Directories only
|
entryDefinition('wrapper-zips', ['wrapper/dists/*/*/'], false), // Entire wrapper directory cached together
|
||||||
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
entryDefinition('java-toolchains', ['jdks/*.zip', 'jdks/*.tar.gz'], false),
|
||||||
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
entryDefinition('dependencies', ['caches/modules-*/files-*/*/*/*/*'], true),
|
||||||
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
entryDefinition('instrumented-jars', ['caches/jars-*/*'], true),
|
||||||
|
|
Loading…
Reference in a new issue