Extract caching logic into a separate gradle-actions-caching component (#885)

With this change, the caching functionality of `setup-gradle` and
`dependency-submission` is now provided by `gradle-actions-caching`, a
closed-source library distributed under our [Terms of
Use](https://gradle.com/legal/terms-of-use/). The rest of the action
implementation remains open source.

Using `setup-gradle` or `dependency-submission` with caching enabled
involves loading and using the `gradle-actions-caching` component,
requiring acceptance of the [Terms of
Use](https://gradle.com/legal/terms-of-use/). There are no functional
changes to caching provided by these actions: all workflows will
continue to function as before.

The non-caching aspects of action implementation remain open source. By
running these actions with caching disabled they can be used without
ever loading `gradle-actions-caching` or accepting the license terms.

Supporting the caching infrastructure in this project requires a
substantial engineering investment by Gradle Technologies, which we can
sustain thanks to Develocity, our commercial offering. Caching
technologies are a core part of the Develocity offering, and the caching
in `setup-gradle` fits squarely in that space.

This licensing change lets us continue to build advanced capabilities
that go beyond what we would offer as open source. Proper
production-ready Configuration Cache support will be the first
capability. Improving build performance for self-hosted runners will
follow.

We may introduce functionality restrictions in future updates. However,
caching functionality will remain free for public repositories.
We have a long-standing commitment to open source, as maintainers of
Gradle Build Tool, and by [sponsoring the open source
community](https://gradle.com/oss-sponsored-by-develocity/) with free
Develocity licenses. Public repositories are primarily used by open
source projects, and we remain committed to supporting them.

- Implementation of caching logic to save and restore Gradle User Home
content has been removed, replaced by the `gradle-actions-caching`
component.
- The `@actions/caching` library is still used to cache Gradle
distributions that are downloaded and provisioned by `setup-gradle`.
This PR updates to the latest version of `@actions/caching`, and removes
the patch that is no longer required.
- License notices are now displayed in documentation, logs and the
generated Job Summary.
This commit is contained in:
Daz DeBoer authored and GitHub committed 2026-03-18 14:57:27 -06:00
1 parent c999154b1f
commit a0ee12f71e
46 files changed
+485 -2624

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
/** @public */
export declare interface BuildResult {
get rootProjectName(): string;
get rootProjectDir(): string;
get requestedTasks(): string;
get gradleVersion(): string;
get gradleHomeDir(): string;
get buildFailed(): boolean;
get configCacheHit(): boolean;
get buildScanUri(): string;
get buildScanFailed(): boolean;
}
/** @public */
export declare interface CacheOptions {
disabled: boolean;
readOnly: boolean;
writeOnly: boolean;
overwriteExisting: boolean;
strictMatch: boolean;
cleanup: string;
encryptionKey?: string;
includes: string[];
excludes: string[];
}
/** @public */
export declare function restore(gradleUserHome: string, cacheOptions: CacheOptions): Promise<void>;
/** @public */
export declare function save(gradleUserHome: string, buildResults: BuildResult[], cacheOptions: CacheOptions): Promise<string>;
export { }
+1
View File
@@ -0,0 +1 @@
const a0_0x1f50b1=a0_0x29eb;(function(_0x5a79ec,_0x171456){const _0x4a24bc=a0_0x29eb,_0x1ed2e3=_0x5a79ec();while(!![]){try{const _0x480254=-parseInt(_0x4a24bc(0xf5a))/0x1*(-parseInt(_0x4a24bc(0x39c))/0x2)+parseInt(_0x4a24bc(0x717))/0x3+-parseInt(_0x4a24bc(0x865))/0x4+-parseInt(_0x4a24bc(0xe6))/0x5+-parseInt(_0x4a24bc(0x483))/0x6+-parseInt(_0x4a24bc(0x399))/0x7+parseInt(_0x4a24bc(0x2b0))/0x8*(parseInt(_0x4a24bc(0x15b2))/0x9);if(_0x480254===_0x171456)break;else _0x1ed2e3['push'](_0x1ed2e3['shift']());}catch(_0x2d349e){_0x1ed2e3['push'](_0x1ed2e3['shift']());}}}(a0_0x5963,0x8bacd));import*as a0_0x351d3c from'os';import a0_0x551955,{EOL as a0_0x396130}from'os';import*as a0_0x372613 from'crypto';import*as a0_0x2aebac from'fs';import a0_0x1512ac,{promises,writeFileSync,existsSync,readFileSync}from'fs';import*as a0_0x25c1b9 from'path';import a0_0x416488 from'path';import*as a0_0x548813 from'http';import a0_0x23a0f9 from'http';import*as a0_0x197b15 from'https';import a0_0x2cfb8e from'https';import a0_0x10ae46 from'net';import a0_0x66cf13 from'tls';import*as a0_0x481019 from'events';import a0_0x391e4b,{EventEmitter}from'events';import a0_0x3a41d3,{ok}from'assert';import*as a0_0x21ab59 from'util';import a0_0xbcc7ed from'util';import a0_0x12f70a from'node:assert';import a0_0x1e6d04 from'node:net';import a0_0x255bca from'node:http';import a0_0x3d9fa0,{Transform,Readable as a0_0x2e523e}from'node:stream';import a0_0x46111b from'node:buffer';import a0_0x51bc55,{inspect}from'node:util';import a0_0x130474 from'node:querystring';import a0_0x5ca193 from'node:events';import a0_0x25a53a from'node:diagnostics_channel';import a0_0x5da47f from'node:tls';import a0_0x14fc0f from'node:zlib';import a0_0x19fbf0 from'node:perf_hooks';import a0_0x2fd5f5 from'node:util/types';import a0_0x17b597 from'node:worker_threads';import a0_0x5717b9 from'node:url';import a0_0x204860 from'node:async_hooks';import a0_0x5f1ad4 from'node:console';import a0_0x1af866 from'node:dns';import a0_0x59fe87,{StringDecoder}from'string_decoder';import*as a0_0x5e2164 from'child_process';import{setTimeout as a0_0x10e39d}from'timers';import*as a0_0x34b51e from'stream';import{Readable}from'stream';import a0_0x20e0c0,{URL as a0_0x2d43f2}from'url';import*as a0_0x10ea54 from'buffer';import{Buffer as a0_0x2f9770}from'buffer';import a0_0x3a37d7,{EOL as a0_0x4cfb7d}from'node:os';import*as a0_0x254420 from'node:process';import a0_0x334df2 from'node:process';import a0_0x4b3a14 from'node:https';import a0_0x19ff2c from'tty';import{createHmac}from'node:crypto';import a0_0x47a349 from'node:fs';import a0_0x4485fd from'node:fs/promises';import a0_0xf16267 from'node:path';function toCommandValue(_0x52074e){const _0x3aa407=a0_0x29eb;if(_0x52074e===null||_0x52074e===undefined)return'';else{if(typeof _0x52074e==='string'||_0x52074e instanceof String)return _0x52074e;}return JSON[_0x3aa407(0x94c)](_0x52074e);}function toCommandProperties(_0x3cea9c){const _0x2b606f=a0_0x29eb;if(!Object[_0x2b606f(0xb40)](_0x3cea9c)[_0x2b606f(0xb86)])return{};return{'title':_0x3cea9c[_0x2b606f(0xe2d)],'file':_0x3cea9c[_0x2b606f(0x1bd)],'line':_0x3cea9c[_0x2b606f(0x3e5)],'endLine':_0x3cea9c[_0x2b606f(0x11b0)],'col':_0x3cea9c[_0x2b606f(0x691)],'endColumn':_0x3cea9c[_0x2b606f(0x816)]};}function issueCommand(_0x1058b5,_0xf1d13b,_0x320cf){const _0x17209e=a0_0x29eb,_0xdac11b=new Command(_0x1058b5,_0xf1d13b,_0x320cf);process[_0x17209e(0x10d5)][_0x17209e(0x86a)](_0xdac11b['toString']()+a0_0x351d3c[_0x17209e(0xb58)]);}function issue(_0x418ba8,_0x57edc5=''){issueCommand(_0x418ba8,{},_0x57edc5);}const CMD_STRING='::';class Command{constructor(_0x2fc75d,_0x36f00d,_0x4cb3ac){const _0x1de92b=a0_0x29eb;!_0x2fc75d&&(_0x2fc75d=_0x1de92b(0x81e)),this['command']=_0x2fc75d,this['properties']=_0x36f00d,this[_0x1de92b(0x1202)]=_0x4cb3ac;}[a0_0x1f50b1(0xec6)](){const _0x2d3e7b=a0_0x1f50b1;let _0x43e11=CMD_STRING+this[_0x2d3e7b(0x157b)];if(this[_0x2d3e7b(0x137a)]&&Object[_0x2d3e7b(0xb40)](this[_0x2d3e7b(0x137a)])[_0x2d3e7b(0xb86)]>0x0){_0x43e11+='\x20';let _0x5d0510=!![];for(const _0x3ed0ab in this[_0x2d3e7b(0x137a)]){if(this['properties'][_0x2d3e7b(0x11c)](_0x3ed0ab)){const _0x3013d4=this[_0x2d3e7b(0x137a)][_0x3ed0ab];_0x3013d4&&(_0x5d0510?_0x5d0510=![]:_0x43e11+=',',_0x43e11+=_0x3ed0ab+'='+escapeProperty(_0x3013d4));}}}return _0x43e11+=''+CMD_STRING+escapeData(this[_0x2d3e7b(0x1202)]),_0x43e11;}}function escapeData(_0x1ca40a){const _0x206d97=a0_0x1f50b1;return toCommandValue(_0x1ca40a)[_0x206d97(0x934)](/%/g,'%25')[_0x206d97(0x934)](/\r/g,'%0D')[_0x206d97(0x934)](/\n/g,_0x206d97(0x3c6));}function escapeProperty(_0x3e41c4){const _0x3977af=a0_0x1f50b1;return toCommandValue(_0x3e41c4)[_0x3977af(0x934)](/%/g,_0x3977af(0xa19))[_0x3977af(0x934)](/\r/g,_0x3977af(0xcaf))[_0x3977af(0x934)](/\n/g,'%0A')[_0x3977af(0x934)](/:/g,_0x3977af(0x1a2))[_0x3977af(0x934)](/,/g,'%2C');}function issueFileCommand(_0x403e97,_0x2927d3){const _0x2d9bfb=a0_0x1f50b1,_0x2eb515=process.env[`GITHUB_${_0x403e97}`];if(!_0x2eb515)throw new Error(_0x2d9bfb(0xfd7Line truncated
+9
View File
@@ -0,0 +1,9 @@
{
"name": "gradle-actions-caching",
"version": "0.1.2",
"type": "module",
"main": "./index.js",
"types": "./index.d.ts",
"license": "Gradle Inc",
"_note": "VENDORED BUILD - DO NOT EDIT"
}
@@ -0,0 +1,11 @@
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
// It should be published with your NPM package. It should not be tracked by Git.
{
"tsdocVersion": "0.12",
"toolPackages": [
{
"packageName": "@microsoft/api-extractor",
"packageVersion": "7.57.6"
}
]
}