gradle-build-action/dist/main/index.js

2 lines
1.4 MiB
JavaScript
Raw Permalink Normal View History

2022-01-26 20:39:46 +00:00
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;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[a]}})}: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 sav
2021-09-15 00:11:31 +00:00
//# sourceMappingURL=index.js.map