Save/restore exploded Gradle dist rather than zip

To save space, future versions of Gradle are likely to delete the downloaded distribution
after extracting it. See gradle/gradle#3605 and gradle/gradle#19495.
To cater for this we will now save/restore the extracted distribution rather than the
downloaded zip file.
This commit is contained in:
Daz DeBoer committed 2022-04-04 21:43:31 -06:00
1 parent bd717aced6
commit 0e24fa1975
5 files changed
+13 -7

No files matched your search

+1 -1
View File
@@ -1,2 +1,2 @@
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;var n=Object.getOwnPropertyDescriptor(t,a);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return t[a]}}}Object.defineProperty(e,i,n)}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){const n=yield(0,m.restoreCache)([a],t,[],i);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);yield(0,m.saveCache)([a],s,o)}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtracLine truncated require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;var n=Object.getOwnPropertyDescriptor(t,a);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return t[a]}}}Object.defineProperty(e,i,n)}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){const n=yield(0,m.restoreCache)([a],t,[],i);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);yield(0,m.saveCache)([a],s,o)}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtracLine truncated
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/@actions/tool-cache/lib/manifest.js","../node_modules/@opentelemetry/api/build/src/trace/internal/utils.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@azure/core-asynciterator-polyfill/dist/index.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../src/main.ts","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../src/execution.ts","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@octokit/graphql/dist-node/index.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../src/provision.ts","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../src/gradlew.ts","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hookLine truncated {"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/@actions/tool-cache/lib/manifest.js","../node_modules/@opentelemetry/api/build/src/trace/internal/utils.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@azure/core-asynciterator-polyfill/dist/index.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../src/main.ts","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../src/execution.ts","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@octokit/graphql/dist-node/index.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../src/provision.ts","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../src/gradlew.ts","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hookLine truncated
+1 -1
View File
@@ -1,2 +1,2 @@
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;var n=Object.getOwnPropertyDescriptor(t,a);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return t[a]}}}Object.defineProperty(e,i,n)}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){const n=yield(0,m.restoreCache)([a],t,[],i);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);yield(0,m.saveCache)([a],s,o)}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtracLine truncated require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var a={};function __webpack_require__(t){if(a[t]){return a[t].exports}var i=a[t]={i:t,l:false,exports:{}};var n=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);n=false}finally{if(n)delete a[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([function(e,t,a){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,a,i){if(i===undefined)i=a;var n=Object.getOwnPropertyDescriptor(t,a);if(!n||("get"in n?!t.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return t[a]}}}Object.defineProperty(e,i,n)}:function(e,t,a,i){if(i===undefined)i=a;e[i]=t[a]});var n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var a in e)if(a!=="default"&&Object.prototype.hasOwnProperty.call(e,a))i(t,e,a);n(t,e);return t};var s=this&&this.__awaiter||function(e,t,a,i){function adopt(e){return e instanceof a?e:new a(function(t){t(e)})}return new(a||(a=Promise))(function(a,n){function fulfilled(e){try{step(i.next(e))}catch(e){n(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){n(e)}}function step(e){e.done?a(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())})};var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.ConfigurationCacheEntryExtractor=t.GradleHomeEntryExtractor=void 0;const p=r(a(622));const l=r(a(747));const c=o(a(470));const d=o(a(281));const u=a(101);const m=a(452);const f="GRADLE_BUILD_ACTION_SKIP_RESTORE";class ExtractedCacheEntry{constructor(e,t,a){this.artifactType=e;this.pattern=t;this.cacheKey=a}}class ExtractedCacheEntryMetadata{constructor(){this.entries=[]}}class ExtractedCacheEntryDefinition{constructor(e,t,a){this.uniqueFileNames=true;this.artifactType=e;this.pattern=t;this.bundle=a}withNonUniqueFileNames(){this.uniqueFileNames=false;return this}}class AbstractEntryExtractor{constructor(e,t){this.gradleUserHome=e;this.extractorName=t}restore(e){return s(this,void 0,void 0,function*(){const t=this.loadExtractedCacheEntries();const a=[];for(const i of t){const t=i.artifactType;const n=e.entry(i.pattern);const o=process.env[f]||"";if(o.includes(t)){c.info(`Not restoring extracted cache entry for ${t}`);n.markRequested("SKIP_RESTORE")}else{a.push(this.awaitForDebugging(this.restoreExtractedCacheEntry(t,i.cacheKey,i.pattern,n)))}}this.saveMetadataForCacheResults(yield Promise.all(a))})}restoreExtractedCacheEntry(e,t,a,i){return s(this,void 0,void 0,function*(){const n=yield(0,m.restoreCache)([a],t,[],i);if(n){c.info(`Restored ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,t)}else{c.info(`Did not restore ${e} with key ${t} to ${a}`);return new ExtractedCacheEntry(e,a,undefined)}})}extract(e){return s(this,void 0,void 0,function*(){const t=this.getExtractedCacheEntryDefinitions();(0,m.cacheDebug)(`Extracting cache entries for ${this.extractorName}: ${JSON.stringify(t,null,2)}`);const a=this.loadExtractedCacheEntries();const i=[];for(const n of t){const t=n.artifactType;const o=n.pattern;const s=yield d.create(o,{implicitDescendants:false,followSymbolicLinks:false});const r=yield s.glob();if(r.length===0){(0,m.cacheDebug)(`No files found to cache for ${t}`);continue}if(n.bundle){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry(r,t,o,n.uniqueFileNames,a,e.entry(o))))}else{for(const o of r){i.push(this.awaitForDebugging(this.saveExtractedCacheEntry([o],t,o,n.uniqueFileNames,a,e.entry(o))))}}}this.saveMetadataForCacheResults(yield Promise.all(i))})}saveExtractedCacheEntry(e,t,a,i,n,o){var r;return s(this,void 0,void 0,function*(){const s=i?this.createCacheKeyFromFileNames(t,e):yield this.createCacheKeyFromFileContents(t,a);const p=(r=n.find(e=>e.artifactType===t&&e.pattern===a))===null||r===void 0?void 0:r.cacheKey;if(p===s){(0,m.cacheDebug)(`No change to previously restored ${t}. Not saving.`)}else{c.info(`Caching ${t} with path '${a}' and cache key: ${s}`);yield(0,m.saveCache)([a],s,o)}for(const t of e){(0,m.tryDelete)(t)}return new ExtractedCacheEntry(t,a,s)})}createCacheKeyFromFileNames(e,t){const a=(0,m.getCacheKeyPrefix)();const i=t.map(e=>p.default.relative(this.gradleUserHome,e));const n=(0,m.hashFileNames)(i);(0,m.cacheDebug)(`Generating cache key for ${e} from file names: ${i}`);return`${a}${e}-${n}`}createCacheKeyFromFileContents(e,t){return s(this,void 0,void 0,function*(){const a=(0,m.getCacheKeyPrefix)();const i=yield d.hashFiles(t);(0,m.cacheDebug)(`Generating cache key for ${e} from files matching: ${t}`);return`${a}${e}-${i}`})}awaitForDebugging(e){return s(this,void 0,void 0,function*(){if((0,m.isCacheDebuggingEnabled)()){yield e}return e})}loadExtracLine truncated
//# sourceMappingURL=index.js.map //# sourceMappingURL=index.js.map
+1 -1
View File
@@ -1 +1 @@
{"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/@opentelemetry/api/build/src/trace/internal/utils.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@azure/core-asynciterator-polyfill/dist/index.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@octokit/graphql/dist-node/index.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hook/lib/register.js","../node_modules/@azure/storage-blob/dist/index.js","../node_modules/@actions/glob/lib/internal-path.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-search-state.js","../nodLine truncated {"version":3,"sources":["/webpack/bootstrap","../src/cache-extract-entries.ts","../node_modules/@actions/io/lib/io.js","../node_modules/@actions/exec/lib/toolrunner.js","../node_modules/wrappy/wrappy.js","../node_modules/@actions/cache/lib/internal/cacheUtils.js","../external \"tls\"","../(webpack)/ncc/@@notfound.js","../node_modules/xmlbuilder/lib/XMLDTDNotation.js","../node_modules/@opentelemetry/api/build/src/api/propagation.js","../node_modules/@azure/core-http/node_modules/uuid/dist/nil.js","../node_modules/@opentelemetry/api/build/src/trace/internal/utils.js","../node_modules/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/public-api.js","../node_modules/@actions/core/lib/utils.js","../node_modules/uuid/v1.js","../external \"os\"","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/permuteDomain.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v5.js","../node_modules/asynckit/serial.js","../node_modules/minimatch/minimatch.js","../node_modules/@opentelemetry/api/build/src/trace/link.js","../node_modules/@azure/core-asynciterator-polyfill/dist/index.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-pattern-helper.js","../src/cache-base.ts","../node_modules/@actions/core/lib/file-command.js","../node_modules/@azure/core-http/node_modules/uuid/dist/version.js","../node_modules/@azure/abort-controller/dist/index.js","../node_modules/@opentelemetry/api/build/src/baggage/utils.js","../node_modules/@actions/cache/lib/internal/cacheHttpClient.js","../node_modules/@opentelemetry/api/build/src/api/diag.js","../node_modules/@actions/github/lib/internal/utils.js","../external \"child_process\"","../node_modules/@opentelemetry/api/build/src/context/context.js","../node_modules/uuid/lib/rng.js","../node_modules/tunnel/lib/tunnel.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/index.js","../node_modules/node-fetch/node_modules/webidl-conversions/lib/index.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracer.js","../node_modules/delayed-stream/lib/delayed_stream.js","../node_modules/asynckit/lib/iterate.js","../node_modules/@opentelemetry/api/build/src/common/Time.js","../node_modules/@opentelemetry/api/build/src/trace/NoopTracerProvider.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v1.js","../node_modules/@octokit/graphql/dist-node/index.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/xml2js/lib/bom.js","../external \"https\"","../external \"timers\"","../node_modules/@opentelemetry/api/build/src/trace/SpanOptions.js","../node_modules/@actions/http-client/auth.js","../node_modules/@azure/core-auth/dist/index.js","../node_modules/@opentelemetry/api/build/src/diag/consoleLogger.js","../node_modules/@azure/core-http/node_modules/uuid/dist/regex.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v35.js","../node_modules/@azure/core-http/node_modules/uuid/dist/md5.js","../node_modules/@actions/cache/lib/internal/downloadUtils.js","../node_modules/node-fetch/node_modules/whatwg-url/lib/URL-impl.js","../node_modules/xmlbuilder/lib/XMLNode.js","../node_modules/@actions/github/lib/context.js","../node_modules/@azure/core-tracing/dist/index.js","../src/cache-reporting.ts","../node_modules/xmlbuilder/lib/XMLNodeList.js","../node_modules/semver/semver.js","../node_modules/@actions/glob/lib/glob.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-glob-options-helper.js","../node_modules/@opentelemetry/api/build/src/common/Exception.js","../external \"buffer\"","../node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../node_modules/@actions/glob/lib/internal-globber.js","../node_modules/@azure/core-http/node_modules/uuid/dist/v3.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/glob.js","../external \"string_decoder\"","../node_modules/brace-expansion/index.js","../node_modules/xmlbuilder/lib/index.js","../node_modules/@actions/glob/lib/internal-match-kind.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/memstore.js","../node_modules/asynckit/index.js","../src/caches.ts","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/store.js","../node_modules/@opentelemetry/api/build/src/trace/SamplingResult.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../node_modules/is-plain-object/dist/is-plain-object.js","../external \"assert\"","../node_modules/@opentelemetry/api/build/src/diag/ComponentLogger.js","../node_modules/before-after-hook/lib/register.js","../node_modules/@azure/storage-blob/dist/index.js","../node_modules/@actions/glob/lib/internal-path.js","../node_modules/@actions/cache/node_modules/@actions/glob/lib/internal-search-state.js","../nodLine truncated
+9 -3
View File
@@ -304,13 +304,19 @@ export class GradleHomeEntryExtractor extends AbstractEntryExtractor {
patterns: string[], patterns: string[],
bundle: boolean bundle: boolean
): ExtractedCacheEntryDefinition => { ): ExtractedCacheEntryDefinition => {
const resolvedPattern = patterns.map(x => path.resolve(this.gradleUserHome, x)).join('\n') const resolvedPatterns = patterns
return new ExtractedCacheEntryDefinition(artifactType, resolvedPattern, bundle) .map(x => {
const isDir = x.endsWith('/')
const resolved = path.resolve(this.gradleUserHome, x)
return isDir ? `${resolved}/` : resolved // Restore trailing '/' removed by path.resolve()
})
.join('\n')
return new ExtractedCacheEntryDefinition(artifactType, resolvedPatterns, bundle)
} }
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/*/*/*.zip'], false), entryDefinition('wrapper-zips', ['wrapper/dists/*/*/*/'], false), // Directories only
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),