mirror of
https://github.com/gradle/actions.git
synced 2026-10-16 19:57:12 +08:00
Merge pull request #123 from gradle/toward-setup-gradle
Avoid using command-line modification to enhance build execution. Instead, files are written to Gradle User Home to achieve the same functionality.
This commit is contained in:
10 files changed
+72
-73
No files matched your search
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var r=n[t]={i:t,l:false,exports:{}};var i=true;try{e[t].call(r.exports,r,r.exports,__webpack_require__);i=false}finally{if(i)delete n[t]}r.l=true;return r.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([,function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){if(r===undefined)r=n;Object.defineProperty(e,r,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,r){if(r===undefined)r=n;e[r]=t[n]});var i=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 n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))r(t,e,n);i(t,e);return t};var a=this&&this.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r["throw"](e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});t.findInPath=t.which=t.mkdirP=t.rmRF=t.mv=t.cp=void 0;const s=n(357);const c=o(n(129));const u=o(n(622));const l=n(669);const p=o(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return a(this,void 0,void 0,function*(){const{force:r,recursive:i,copySourceDirectory:o}=readCopyOptions(n);const a=(yield p.exists(t))?yield p.stat(t):null;if(a&&a.isFile()&&!r){return}const s=a&&a.isDirectory()&&o?u.join(t,u.basename(e)):t;if(!(yield p.exists(e))){throw new Error(`no such file or directory: ${e}`)}const c=yield p.stat(e);if(c.isDirectory()){if(!i){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,r)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,r)}})}t.cp=cp;function mv(e,t,n={}){return a(this,void 0,void 0,function*(){if(yield p.exists(t)){let r=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));r=yield p.exists(t)}if(r){if(n.force==null||n.force){yield rmRF(t)}else{throw new Error("Destination already exists")}}}yield mkdirP(u.dirname(t));yield p.rename(e,t)})}t.mv=mv;function rmRF(e){return a(this,void 0,void 0,function*(){if(p.IS_WINDOWS){if(/[*"<>|]/.test(e)){throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows')}try{const t=p.getCmdPath();if(yield p.isDirectory(e,true)){yield m(`${t} /s /c "rd /s /q "%inputPath%""`,{env:{inputPath:e}})}else{yield m(`${t} /s /c "del /f /a "%inputPath%""`,{env:{inputPath:e}})}}catch(e){if(e.code!=="ENOENT")throw e}try{yield p.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let t=false;try{t=yield p.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(t){yield d(`rm`,[`-rf`,`${e}`])}else{yield p.unlink(e)}}})}t.rmRF=rmRF;function mkdirP(e){return a(this,void 0,void 0,function*(){s.ok(e,"a path argument must be provided");yield p.mkdir(e,{recursive:true})})}t.mkdirP=mkdirP;function which(e,t){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(t){const t=yield which(e,false);if(!t){if(p.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}return t}const n=yield findInPath(e);if(n&&n.length>0){return n[0]}return""})}t.which=which;function findInPath(e){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}const t=[];if(p.IS_WINDOWS&&process.env["PATHEXT"]){for(const e of process.env["PATHEXT"].split(u.delimiter)){if(e){t.push(e)}}}if(p.isRooted(e)){const n=yield p.tryGetExecutablePath(e,t);if(n){return[n]}return[]}if(e.includes(u.sep)){return[]}const n=[];if(process.env.PATH){for(const e of process.env.PATH.split(u.delimiter)){if(e){n.push(e)}}}const r=[];for(const i of n){const n=yield p.tryGetExecutablePath(u.join(i,e),t);if(n){r.push(n)}}return r})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const r=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:r}}function cpDirLine truncated
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var r=n[t]={i:t,l:false,exports:{}};var i=true;try{e[t].call(r.exports,r,r.exports,__webpack_require__);i=false}finally{if(i)delete n[t]}r.l=true;return r.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([,function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){if(r===undefined)r=n;Object.defineProperty(e,r,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,r){if(r===undefined)r=n;e[r]=t[n]});var i=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 n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))r(t,e,n);i(t,e);return t};var a=this&&this.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r["throw"](e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});t.findInPath=t.which=t.mkdirP=t.rmRF=t.mv=t.cp=void 0;const s=n(357);const c=o(n(129));const u=o(n(622));const l=n(669);const p=o(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return a(this,void 0,void 0,function*(){const{force:r,recursive:i,copySourceDirectory:o}=readCopyOptions(n);const a=(yield p.exists(t))?yield p.stat(t):null;if(a&&a.isFile()&&!r){return}const s=a&&a.isDirectory()&&o?u.join(t,u.basename(e)):t;if(!(yield p.exists(e))){throw new Error(`no such file or directory: ${e}`)}const c=yield p.stat(e);if(c.isDirectory()){if(!i){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,r)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,r)}})}t.cp=cp;function mv(e,t,n={}){return a(this,void 0,void 0,function*(){if(yield p.exists(t)){let r=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));r=yield p.exists(t)}if(r){if(n.force==null||n.force){yield rmRF(t)}else{throw new Error("Destination already exists")}}}yield mkdirP(u.dirname(t));yield p.rename(e,t)})}t.mv=mv;function rmRF(e){return a(this,void 0,void 0,function*(){if(p.IS_WINDOWS){if(/[*"<>|]/.test(e)){throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows')}try{const t=p.getCmdPath();if(yield p.isDirectory(e,true)){yield m(`${t} /s /c "rd /s /q "%inputPath%""`,{env:{inputPath:e}})}else{yield m(`${t} /s /c "del /f /a "%inputPath%""`,{env:{inputPath:e}})}}catch(e){if(e.code!=="ENOENT")throw e}try{yield p.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let t=false;try{t=yield p.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(t){yield d(`rm`,[`-rf`,`${e}`])}else{yield p.unlink(e)}}})}t.rmRF=rmRF;function mkdirP(e){return a(this,void 0,void 0,function*(){s.ok(e,"a path argument must be provided");yield p.mkdir(e,{recursive:true})})}t.mkdirP=mkdirP;function which(e,t){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(t){const t=yield which(e,false);if(!t){if(p.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}return t}const n=yield findInPath(e);if(n&&n.length>0){return n[0]}return""})}t.which=which;function findInPath(e){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}const t=[];if(p.IS_WINDOWS&&process.env["PATHEXT"]){for(const e of process.env["PATHEXT"].split(u.delimiter)){if(e){t.push(e)}}}if(p.isRooted(e)){const n=yield p.tryGetExecutablePath(e,t);if(n){return[n]}return[]}if(e.includes(u.sep)){return[]}const n=[];if(process.env.PATH){for(const e of process.env.PATH.split(u.delimiter)){if(e){n.push(e)}}}const r=[];for(const i of n){const n=yield p.tryGetExecutablePath(u.join(i,e),t);if(n){r.push(n)}}return r})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const r=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:r}}function cpDirLine truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["/webpack/bootstrap","../node_modules/@actions/io/lib/io.js","../node_modules/@octokit/endpoint/node_modules/is-plain-object/dist/is-plain-object.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/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.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/@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/@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","../src/cache-utils.ts","../node_modules/@azure/core-tracing/node_modules/tslib/tslib.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/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","../src/build-scan-capture.ts","../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/@actions/github/lib/context.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.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/xmlbuilder/lib/XMLNode.js","../node_modules/@azure/logger/node_modules/tslib/tslib.js","../node_modules/@azure/core-tracing/dist/index.js","../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","../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/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../external \"assert\"","../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","../node_modules/@octokit/endpoint/dist-node/index.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/cookLine truncated
|
||||
{"version":3,"sources":["/webpack/bootstrap","../node_modules/@actions/io/lib/io.js","../node_modules/@octokit/endpoint/node_modules/is-plain-object/dist/is-plain-object.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/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.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/@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/@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","../src/cache-utils.ts","../node_modules/@azure/core-tracing/node_modules/tslib/tslib.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/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/@actions/github/lib/context.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.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/xmlbuilder/lib/XMLNode.js","../node_modules/@azure/logger/node_modules/tslib/tslib.js","../node_modules/@azure/core-tracing/dist/index.js","../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","../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/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../external \"assert\"","../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","../node_modules/@octokit/endpoint/dist-node/index.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/cookie.js","../node_modules/@openteLine truncated
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var r=n[t]={i:t,l:false,exports:{}};var i=true;try{e[t].call(r.exports,r,r.exports,__webpack_require__);i=false}finally{if(i)delete n[t]}r.l=true;return r.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([,function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){if(r===undefined)r=n;Object.defineProperty(e,r,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,r){if(r===undefined)r=n;e[r]=t[n]});var i=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 n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))r(t,e,n);i(t,e);return t};var a=this&&this.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r["throw"](e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});t.findInPath=t.which=t.mkdirP=t.rmRF=t.mv=t.cp=void 0;const s=n(357);const c=o(n(129));const u=o(n(622));const l=n(669);const p=o(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return a(this,void 0,void 0,function*(){const{force:r,recursive:i,copySourceDirectory:o}=readCopyOptions(n);const a=(yield p.exists(t))?yield p.stat(t):null;if(a&&a.isFile()&&!r){return}const s=a&&a.isDirectory()&&o?u.join(t,u.basename(e)):t;if(!(yield p.exists(e))){throw new Error(`no such file or directory: ${e}`)}const c=yield p.stat(e);if(c.isDirectory()){if(!i){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,r)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,r)}})}t.cp=cp;function mv(e,t,n={}){return a(this,void 0,void 0,function*(){if(yield p.exists(t)){let r=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));r=yield p.exists(t)}if(r){if(n.force==null||n.force){yield rmRF(t)}else{throw new Error("Destination already exists")}}}yield mkdirP(u.dirname(t));yield p.rename(e,t)})}t.mv=mv;function rmRF(e){return a(this,void 0,void 0,function*(){if(p.IS_WINDOWS){if(/[*"<>|]/.test(e)){throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows')}try{const t=p.getCmdPath();if(yield p.isDirectory(e,true)){yield m(`${t} /s /c "rd /s /q "%inputPath%""`,{env:{inputPath:e}})}else{yield m(`${t} /s /c "del /f /a "%inputPath%""`,{env:{inputPath:e}})}}catch(e){if(e.code!=="ENOENT")throw e}try{yield p.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let t=false;try{t=yield p.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(t){yield d(`rm`,[`-rf`,`${e}`])}else{yield p.unlink(e)}}})}t.rmRF=rmRF;function mkdirP(e){return a(this,void 0,void 0,function*(){s.ok(e,"a path argument must be provided");yield p.mkdir(e,{recursive:true})})}t.mkdirP=mkdirP;function which(e,t){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(t){const t=yield which(e,false);if(!t){if(p.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}return t}const n=yield findInPath(e);if(n&&n.length>0){return n[0]}return""})}t.which=which;function findInPath(e){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}const t=[];if(p.IS_WINDOWS&&process.env["PATHEXT"]){for(const e of process.env["PATHEXT"].split(u.delimiter)){if(e){t.push(e)}}}if(p.isRooted(e)){const n=yield p.tryGetExecutablePath(e,t);if(n){return[n]}return[]}if(e.includes(u.sep)){return[]}const n=[];if(process.env.PATH){for(const e of process.env.PATH.split(u.delimiter)){if(e){n.push(e)}}}const r=[];for(const i of n){const n=yield p.tryGetExecutablePath(u.join(i,e),t);if(n){r.push(n)}}return r})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const r=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:r}}function cpDirLine truncated
|
||||
require('./sourcemap-register.js');module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var r=n[t]={i:t,l:false,exports:{}};var i=true;try{e[t].call(r.exports,r,r.exports,__webpack_require__);i=false}finally{if(i)delete n[t]}r.l=true;return r.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([,function(e,t,n){"use strict";var r=this&&this.__createBinding||(Object.create?function(e,t,n,r){if(r===undefined)r=n;Object.defineProperty(e,r,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,r){if(r===undefined)r=n;e[r]=t[n]});var i=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 n in e)if(n!=="default"&&Object.hasOwnProperty.call(e,n))r(t,e,n);i(t,e);return t};var a=this&&this.__awaiter||function(e,t,n,r){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,i){function fulfilled(e){try{step(r.next(e))}catch(e){i(e)}}function rejected(e){try{step(r["throw"](e))}catch(e){i(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((r=r.apply(e,t||[])).next())})};Object.defineProperty(t,"__esModule",{value:true});t.findInPath=t.which=t.mkdirP=t.rmRF=t.mv=t.cp=void 0;const s=n(357);const c=o(n(129));const u=o(n(622));const l=n(669);const p=o(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return a(this,void 0,void 0,function*(){const{force:r,recursive:i,copySourceDirectory:o}=readCopyOptions(n);const a=(yield p.exists(t))?yield p.stat(t):null;if(a&&a.isFile()&&!r){return}const s=a&&a.isDirectory()&&o?u.join(t,u.basename(e)):t;if(!(yield p.exists(e))){throw new Error(`no such file or directory: ${e}`)}const c=yield p.stat(e);if(c.isDirectory()){if(!i){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,r)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,r)}})}t.cp=cp;function mv(e,t,n={}){return a(this,void 0,void 0,function*(){if(yield p.exists(t)){let r=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));r=yield p.exists(t)}if(r){if(n.force==null||n.force){yield rmRF(t)}else{throw new Error("Destination already exists")}}}yield mkdirP(u.dirname(t));yield p.rename(e,t)})}t.mv=mv;function rmRF(e){return a(this,void 0,void 0,function*(){if(p.IS_WINDOWS){if(/[*"<>|]/.test(e)){throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows')}try{const t=p.getCmdPath();if(yield p.isDirectory(e,true)){yield m(`${t} /s /c "rd /s /q "%inputPath%""`,{env:{inputPath:e}})}else{yield m(`${t} /s /c "del /f /a "%inputPath%""`,{env:{inputPath:e}})}}catch(e){if(e.code!=="ENOENT")throw e}try{yield p.unlink(e)}catch(e){if(e.code!=="ENOENT")throw e}}else{let t=false;try{t=yield p.isDirectory(e)}catch(e){if(e.code!=="ENOENT")throw e;return}if(t){yield d(`rm`,[`-rf`,`${e}`])}else{yield p.unlink(e)}}})}t.rmRF=rmRF;function mkdirP(e){return a(this,void 0,void 0,function*(){s.ok(e,"a path argument must be provided");yield p.mkdir(e,{recursive:true})})}t.mkdirP=mkdirP;function which(e,t){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}if(t){const t=yield which(e,false);if(!t){if(p.IS_WINDOWS){throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file.`)}else{throw new Error(`Unable to locate executable file: ${e}. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.`)}}return t}const n=yield findInPath(e);if(n&&n.length>0){return n[0]}return""})}t.which=which;function findInPath(e){return a(this,void 0,void 0,function*(){if(!e){throw new Error("parameter 'tool' is required")}const t=[];if(p.IS_WINDOWS&&process.env["PATHEXT"]){for(const e of process.env["PATHEXT"].split(u.delimiter)){if(e){t.push(e)}}}if(p.isRooted(e)){const n=yield p.tryGetExecutablePath(e,t);if(n){return[n]}return[]}if(e.includes(u.sep)){return[]}const n=[];if(process.env.PATH){for(const e of process.env.PATH.split(u.delimiter)){if(e){n.push(e)}}}const r=[];for(const i of n){const n=yield p.tryGetExecutablePath(u.join(i,e),t);if(n){r.push(n)}}return r})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const r=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:r}}function cpDirLine truncated
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["/webpack/bootstrap","../node_modules/@actions/io/lib/io.js","../node_modules/@octokit/endpoint/node_modules/is-plain-object/dist/is-plain-object.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/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.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/@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/@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","../src/cache-utils.ts","../node_modules/@azure/core-tracing/node_modules/tslib/tslib.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/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/@actions/github/lib/context.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.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/xmlbuilder/lib/XMLNode.js","../node_modules/@azure/logger/node_modules/tslib/tslib.js","../node_modules/@azure/core-tracing/dist/index.js","../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","../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/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../external \"assert\"","../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","../node_modules/@octokit/endpoint/dist-node/index.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/cookie.js","../node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js","../node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js","../external \"stream\"","../external \"crypto\"","../node_modules/xmlbuilder/lib/XMLWriterBase.js"Line truncated
|
||||
{"version":3,"sources":["/webpack/bootstrap","../node_modules/@actions/io/lib/io.js","../node_modules/@octokit/endpoint/node_modules/is-plain-object/dist/is-plain-object.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/once/once.js","../node_modules/xmlbuilder/lib/DocumentPosition.js","../node_modules/@opentelemetry/api/build/src/trace/trace_state.js","../node_modules/@azure/core-asynciterator-polyfill/dist-esm/index.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/@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/@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","../src/cache-utils.ts","../node_modules/@azure/core-tracing/node_modules/tslib/tslib.js","../node_modules/@opentelemetry/api/build/src/platform/node/globalThis.js","../node_modules/universalify/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/@actions/github/lib/context.js","../node_modules/@azure/core-http/node_modules/uuid/dist/parse.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/xmlbuilder/lib/XMLNode.js","../node_modules/@azure/logger/node_modules/tslib/tslib.js","../node_modules/@azure/core-tracing/dist/index.js","../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","../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/xmlbuilder/lib/XMLStringWriter.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/pathMatch.js","../node_modules/xml2js/lib/processors.js","../external \"assert\"","../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","../node_modules/@octokit/endpoint/dist-node/index.js","../node_modules/@azure/core-http/node_modules/tough-cookie/lib/cookie.js","../node_modules/@opentelemetry/api/build/src/trace/ProxyTracerProvider.js","../node_modules/@opentelemetry/api/build/src/trace/ProxyTracer.js","../external \"stream\"","../external \"crypto\"","../node_modules/xmlbuilder/lib/XMLWriterBase.js"Line truncated
|
||||
@@ -1,50 +0,0 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import * as core from '@actions/core'
|
||||
|
||||
export function writeInitScript(): string {
|
||||
const tmpDir = process.env['RUNNER_TEMP'] || ''
|
||||
const initScript = path.resolve(tmpDir, 'build-scan-capture.init.gradle')
|
||||
core.info(`Writing init script: ${initScript}`)
|
||||
if (fs.existsSync(initScript)) {
|
||||
return initScript
|
||||
}
|
||||
fs.writeFileSync(
|
||||
initScript,
|
||||
`
|
||||
import org.gradle.util.GradleVersion
|
||||
|
||||
// Don't run against the included builds (if the main build has any).
|
||||
def isTopLevelBuild = gradle.getParent() == null
|
||||
if (isTopLevelBuild) {
|
||||
def version = GradleVersion.current().baseVersion
|
||||
def atLeastGradle4 = version >= GradleVersion.version("4.0")
|
||||
def atLeastGradle6 = version >= GradleVersion.version("6.0")
|
||||
|
||||
if (atLeastGradle6) {
|
||||
settingsEvaluated { settings ->
|
||||
if (settings.pluginManager.hasPlugin("com.gradle.enterprise")) {
|
||||
registerCallbacks(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject.name)
|
||||
}
|
||||
}
|
||||
} else if (atLeastGradle4) {
|
||||
projectsEvaluated { gradle ->
|
||||
if (gradle.rootProject.pluginManager.hasPlugin("com.gradle.build-scan")) {
|
||||
registerCallbacks(gradle.rootProject.extensions["buildScan"], gradle.rootProject.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||
buildScanExtension.with {
|
||||
def scanFile = new File("gradle-build-scan.txt")
|
||||
buildScanPublished { buildScan ->
|
||||
scanFile.text = buildScan.buildScanUri
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
)
|
||||
return initScript
|
||||
}
|
||||
+1
-1
@@ -146,7 +146,7 @@ export abstract class AbstractCache {
|
||||
const cacheResult = await this.restoreCache(this.getCachePath(), cacheKey.key, cacheKey.restoreKeys)
|
||||
|
||||
if (!cacheResult) {
|
||||
core.info(`${this.cacheDescription} cache not found. Will start with empty.`)
|
||||
core.info(`${this.cacheDescription} cache not found. Will initialize empty.`)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,11 @@ export class GradleUserHomeCache extends AbstractCache {
|
||||
this.gradleUserHome = this.determineGradleUserHome(rootDir)
|
||||
}
|
||||
|
||||
init(): void {
|
||||
this.debug(`Initializing Gradle User Home with properties and init script: ${this.gradleUserHome}`)
|
||||
initializeGradleUserHome(this.gradleUserHome)
|
||||
}
|
||||
|
||||
async afterRestore(listener: CacheListener): Promise<void> {
|
||||
await this.reportGradleUserHomeSize('as restored from cache')
|
||||
await this.restoreArtifactBundles(listener)
|
||||
@@ -254,3 +259,59 @@ export class GradleUserHomeCache extends AbstractCache {
|
||||
core.info('-----------------------')
|
||||
}
|
||||
}
|
||||
|
||||
function initializeGradleUserHome(gradleUserHome: string): void {
|
||||
fs.mkdirSync(gradleUserHome, {recursive: true})
|
||||
|
||||
const propertiesFile = path.resolve(gradleUserHome, 'gradle.properties')
|
||||
fs.writeFileSync(propertiesFile, 'org.gradle.daemon=false')
|
||||
|
||||
const initScript = path.resolve(gradleUserHome, 'init.gradle')
|
||||
fs.writeFileSync(
|
||||
initScript,
|
||||
`
|
||||
import org.gradle.util.GradleVersion
|
||||
|
||||
// Don't run against the included builds (if the main build has any).
|
||||
def isTopLevelBuild = gradle.getParent() == null
|
||||
if (isTopLevelBuild) {
|
||||
def version = GradleVersion.current().baseVersion
|
||||
def atLeastGradle4 = version >= GradleVersion.version("4.0")
|
||||
def atLeastGradle6 = version >= GradleVersion.version("6.0")
|
||||
|
||||
if (atLeastGradle6) {
|
||||
settingsEvaluated { settings ->
|
||||
if (settings.pluginManager.hasPlugin("com.gradle.enterprise")) {
|
||||
registerCallbacks(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject.name)
|
||||
}
|
||||
}
|
||||
} else if (atLeastGradle4) {
|
||||
projectsEvaluated { gradle ->
|
||||
if (gradle.rootProject.pluginManager.hasPlugin("com.gradle.build-scan")) {
|
||||
registerCallbacks(gradle.rootProject.extensions["buildScan"], gradle.rootProject.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def registerCallbacks(buildScanExtension, rootProjectName) {
|
||||
buildScanExtension.with {
|
||||
def buildOutcome = ""
|
||||
def scanFile = new File("gradle-build-scan.txt")
|
||||
|
||||
buildFinished { result ->
|
||||
buildOutcome = result.failure == null ? " succeeded" : " failed"
|
||||
}
|
||||
|
||||
buildScanPublished { buildScan ->
|
||||
scanFile.text = buildScan.buildScanUri
|
||||
|
||||
// Send commands directly to GitHub Actions via STDOUT.
|
||||
println("::notice title=Build '\${rootProjectName}'\${buildOutcome}::\${buildScan.buildScanUri}")
|
||||
println("::set-output name=build-scan-url::\${buildScan.buildScanUri}")
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
)
|
||||
}
|
||||
+6
-2
@@ -8,6 +8,11 @@ const BUILD_ROOT_DIR = 'BUILD_ROOT_DIR'
|
||||
const CACHE_LISTENER = 'CACHE_LISTENER'
|
||||
|
||||
export async function restore(buildRootDirectory: string): Promise<void> {
|
||||
const gradleUserHomeCache = new GradleUserHomeCache(buildRootDirectory)
|
||||
const projectDotGradleCache = new ProjectDotGradleCache(buildRootDirectory)
|
||||
|
||||
gradleUserHomeCache.init()
|
||||
|
||||
if (isCacheDisabled()) {
|
||||
core.info('Cache is disabled: will not restore state from previous builds.')
|
||||
return
|
||||
@@ -17,9 +22,8 @@ export async function restore(buildRootDirectory: string): Promise<void> {
|
||||
core.saveState(BUILD_ROOT_DIR, buildRootDirectory)
|
||||
|
||||
const cacheListener = new CacheListener()
|
||||
await new GradleUserHomeCache(buildRootDirectory).restore(cacheListener)
|
||||
await gradleUserHomeCache.restore(cacheListener)
|
||||
|
||||
const projectDotGradleCache = new ProjectDotGradleCache(buildRootDirectory)
|
||||
if (cacheListener.fullyRestored) {
|
||||
// Only restore the configuration-cache if the Gradle Home is fully restored
|
||||
await projectDotGradleCache.restore(cacheListener)
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
import * as exec from '@actions/exec'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import {writeInitScript} from './build-scan-capture'
|
||||
|
||||
export async function execute(executable: string, root: string, args: string[]): Promise<BuildResult> {
|
||||
let buildScanUrl: string | undefined
|
||||
|
||||
// TODO: instead of running with no-daemon, run `--stop` in post action.
|
||||
args.push('--no-daemon')
|
||||
|
||||
const initScript = writeInitScript()
|
||||
args.push('--init-script')
|
||||
args.push(initScript)
|
||||
|
||||
const buildScanFile = path.resolve(root, 'gradle-build-scan.txt')
|
||||
if (fs.existsSync(buildScanFile)) {
|
||||
fs.unlinkSync(buildScanFile)
|
||||
|
||||
@@ -23,20 +23,12 @@ export async function run(): Promise<void> {
|
||||
args
|
||||
)
|
||||
|
||||
if (result.buildScanUrl) {
|
||||
core.setOutput('build-scan-url', result.buildScanUrl)
|
||||
}
|
||||
|
||||
if (result.status !== 0) {
|
||||
if (result.buildScanUrl) {
|
||||
core.setFailed(`Gradle build failed: ${result.buildScanUrl}`)
|
||||
} else {
|
||||
core.setFailed(`Gradle build failed: process exited with status ${result.status}`)
|
||||
}
|
||||
} else {
|
||||
if (result.buildScanUrl) {
|
||||
core.notice(`Gradle build succeeded: ${result.buildScanUrl}`)
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(String(error))
|
||||
|
||||
Reference in new issue
Block a user