Merge pull request #59 from eskatos/dd/v1-improved

Minor cleanups, simplifications and improvements
This commit is contained in:
Paul Merlin authored and GitHub committed 2021-07-27 08:45:59 +02:00
commit 0206df026c
11 files changed
+91 -78

No files matched your search

+41 -8
View File
@@ -6,7 +6,7 @@ on:
push:
jobs:
check:
gradle-execution:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
@@ -22,12 +22,6 @@ jobs:
with:
build-root-directory: __tests__/samples/basic
arguments: test
- name: Test custom wrapper location
uses: ./
with:
build-root-directory: __tests__/samples/no-wrapper
wrapper-directory: __tests__/samples/basic
arguments: help
- name: Test use defined Gradle version
uses: ./
with:
@@ -37,7 +31,7 @@ jobs:
- name: Test use Gradle version alias
uses: ./
with:
gradle-version: rc
gradle-version: release-candidate
build-root-directory: __tests__/samples/no-wrapper
arguments: help
- name: Test use defined Gradle executable
@@ -46,6 +40,45 @@ jobs:
gradle-executable: __tests__/samples/basic/gradlew${{ matrix.script-suffix }}
build-root-directory: __tests__/samples/no-wrapper
arguments: help
- name: Test custom wrapper location (deprecated)
uses: ./
with:
build-root-directory: __tests__/samples/no-wrapper
wrapper-directory: __tests__/samples/basic
arguments: help
dependencies-cache:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Test dependencies-cache-enabled
uses: ./
with:
build-root-directory: __tests__/samples/basic
arguments: test --no-daemon
dependencies-cache-enabled: true
configuration-cache:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Test configuration-cache-enabled
uses: ./
with:
build-root-directory: __tests__/samples/basic
arguments: test --configuration-cache --no-daemon
configuration-cache-enabled: true
dependencies-cache-enabled: true
# Configuration cache requires dependencies cache, since it assumes dependencies are already downloaded.
failures: # These build invocations are informational only, and are expected to fail
runs-on: ubuntu-latest
+16 -14
View File
@@ -60,14 +60,6 @@ If you need to pass environment variables, simply use the GitHub Actions workflo
build-root-directory: some/subdirectory
```
## Use a Gradle wrapper from a different directory
```yaml
- uses: eskatos/gradle-command-action@v1
with:
wrapper-directory: path/to/wrapper-directory
```
## Use a specific `gradle` executable
```yaml
@@ -76,6 +68,16 @@ If you need to pass environment variables, simply use the GitHub Actions workflo
gradle-executable: path/to/gradle
```
## Use a Gradle wrapper from a different directory
```yaml
- uses: eskatos/gradle-command-action@v1
with:
gradle-executable: path/to/gradlew
```
NOTE: The `wrapper-directory` input has been deprecated. Use `gradle-executable` instead.
## Setup and use a declared Gradle version
```yaml
@@ -90,11 +92,11 @@ Moreover, you can use the following aliases:
| Alias | Selects |
| --- |---|
| `wrapper` | The Gradle wrapper's version (default, useful for matrix builds) |
| `current` | The current [stable release](https://gradle.org/install/) |
| `rc` | The current [release candidate](https://gradle.org/release-candidate/) if any, otherwise fallback to `current` |
| `nightly` | The latest [nightly](https://gradle.org/nightly/), fails if none. |
| `release-nightly` | The latest [release nightly](https://gradle.org/release-nightly/), fails if none. |
| `wrapper` | The Gradle wrapper's version (default, useful for matrix builds) |
| `current` | The current [stable release](https://gradle.org/install/) |
| `release-candidate` | The current [release candidate](https://gradle.org/release-candidate/) if any, otherwise fallback to `current` |
| `nightly` | The latest [nightly](https://gradle.org/nightly/), fails if none. |
| `release-nightly` | The latest [release nightly](https://gradle.org/release-nightly/), fails if none. |
This can be handy to, for example, automatically test your build with the next Gradle version once a release candidate is out:
@@ -114,7 +116,7 @@ jobs:
java-version: 11
- uses: eskatos/gradle-command-action@v1
with:
gradle-version: rc
gradle-version: release-candidate
arguments: build --dry-run # just test build configuration
```
+7
View File
@@ -8,6 +8,7 @@ inputs:
wrapper-directory:
description: Path to the Gradle Wrapper directory
required: false
deprecationMessage: Use 'gradle-executable' to point to a gradlew[.bat] file in a non-default location
gradle-executable:
description: Path to the Gradle executable
required: false
@@ -23,28 +24,34 @@ inputs:
distributions-cache-enabled:
description: Whether caching downloaded Gradle distributions is enabled or not, default to 'true'
required: false
default: true
wrapper-cache-enabled:
description: Whether caching wrapper installation is enabled or not, default to 'true'
required: false
default: true
deprecationMessage: Replaced by 'distributions-cache-enabled' which enables caching for all downloaded Gradle distributions
dependencies-cache-enabled:
description: Whether caching dependencies is enabled or not, default to 'false'
required: false
default: false
dependencies-cache-key:
description: Globs of files to hash in the build root directory, separated by new lines, use best-effort if unset
required: false
dependencies-cache-exact:
description: Whether to restore only if exact match, default to 'false'
required: false
default: false
configuration-cache-enabled:
description: Whether caching build configuration is enabled or not, default to 'false'
required: false
default: false
configuration-cache-key:
description: Globs of files to hash in the build root directory, separated by new lines, use best-effort if unset
required: false
configuration-cache-exact:
description: Whether to restore only if exact match, default to 'false'
required: false
default: false
outputs:
build-scan-url:
+1 -1
View File
@@ -1 +1 @@
module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var i=n[t]={i:t,l:false,exports:{}};var r=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);r=false}finally{if(r)delete n[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([,function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t[n]});var r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var a=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))i(t,e,n);r(t,e);return t};var o=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,r){function fulfilled(e){try{step(i.next(e))}catch(e){r(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){r(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.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=a(n(129));const u=a(n(622));const l=n(669);const p=a(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return o(this,void 0,void 0,function*(){const{force:i,recursive:r,copySourceDirectory:a}=readCopyOptions(n);const o=(yield p.exists(t))?yield p.stat(t):null;if(o&&o.isFile()&&!i){return}const s=o&&o.isDirectory()&&a?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(!r){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,i)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,i)}})}t.cp=cp;function mv(e,t,n={}){return o(this,void 0,void 0,function*(){if(yield p.exists(t)){let i=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));i=yield p.exists(t)}if(i){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 o(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 o(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 o(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 o(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 i=[];for(const r of n){const n=yield p.tryGetExecutablePath(u.join(r,e),t);if(n){i.push(n)}}return i})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const i=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:i}}function cpDirRecursive(e,t,n,i){return o(this,voLine truncated
module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var i=n[t]={i:t,l:false,exports:{}};var a=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);a=false}finally{if(a)delete n[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(131)}return startup()}([,function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t[n]});var a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var r=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))i(t,e,n);a(t,e);return t};var o=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function fulfilled(e){try{step(i.next(e))}catch(e){a(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){a(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.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=r(n(129));const u=r(n(622));const l=n(669);const p=r(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return o(this,void 0,void 0,function*(){const{force:i,recursive:a,copySourceDirectory:r}=readCopyOptions(n);const o=(yield p.exists(t))?yield p.stat(t):null;if(o&&o.isFile()&&!i){return}const s=o&&o.isDirectory()&&r?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(!a){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,i)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,i)}})}t.cp=cp;function mv(e,t,n={}){return o(this,void 0,void 0,function*(){if(yield p.exists(t)){let i=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));i=yield p.exists(t)}if(i){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 o(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 o(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 o(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 o(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 i=[];for(const a of n){const n=yield p.tryGetExecutablePath(u.join(a,e),t);if(n){i.push(n)}}return i})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const i=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:i}}function cpDirRecursive(e,t,n,i){return o(this,voLine truncated
+1 -1
View File
@@ -1 +1 @@
module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var i=n[t]={i:t,l:false,exports:{}};var a=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);a=false}finally{if(a)delete n[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([,function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t[n]});var a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var r=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))i(t,e,n);a(t,e);return t};var o=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function fulfilled(e){try{step(i.next(e))}catch(e){a(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){a(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.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=r(n(129));const u=r(n(622));const l=n(669);const p=r(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return o(this,void 0,void 0,function*(){const{force:i,recursive:a,copySourceDirectory:r}=readCopyOptions(n);const o=(yield p.exists(t))?yield p.stat(t):null;if(o&&o.isFile()&&!i){return}const s=o&&o.isDirectory()&&r?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(!a){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,i)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,i)}})}t.cp=cp;function mv(e,t,n={}){return o(this,void 0,void 0,function*(){if(yield p.exists(t)){let i=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));i=yield p.exists(t)}if(i){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 o(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 o(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 o(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 o(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 i=[];for(const a of n){const n=yield p.tryGetExecutablePath(u.join(a,e),t);if(n){i.push(n)}}return i})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const i=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:i}}function cpDirRecursive(e,t,n,i){return o(this,voLine truncated
module.exports=function(e,t){"use strict";var n={};function __webpack_require__(t){if(n[t]){return n[t].exports}var i=n[t]={i:t,l:false,exports:{}};var a=true;try{e[t].call(i.exports,i,i.exports,__webpack_require__);a=false}finally{if(a)delete n[t]}i.l=true;return i.exports}__webpack_require__.ab=__dirname+"/";function startup(){return __webpack_require__(878)}return startup()}([,function(e,t,n){"use strict";var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){if(i===undefined)i=n;Object.defineProperty(e,i,{enumerable:true,get:function(){return t[n]}})}:function(e,t,n,i){if(i===undefined)i=n;e[i]=t[n]});var a=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var r=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))i(t,e,n);a(t,e);return t};var o=this&&this.__awaiter||function(e,t,n,i){function adopt(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function fulfilled(e){try{step(i.next(e))}catch(e){a(e)}}function rejected(e){try{step(i["throw"](e))}catch(e){a(e)}}function step(e){e.done?n(e.value):adopt(e.value).then(fulfilled,rejected)}step((i=i.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=r(n(129));const u=r(n(622));const l=n(669);const p=r(n(672));const m=l.promisify(c.exec);const d=l.promisify(c.execFile);function cp(e,t,n={}){return o(this,void 0,void 0,function*(){const{force:i,recursive:a,copySourceDirectory:r}=readCopyOptions(n);const o=(yield p.exists(t))?yield p.stat(t):null;if(o&&o.isFile()&&!i){return}const s=o&&o.isDirectory()&&r?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(!a){throw new Error(`Failed to copy. ${e} is a directory, but tried to copy without recursive flag.`)}else{yield cpDirRecursive(e,s,0,i)}}else{if(u.relative(e,s)===""){throw new Error(`'${s}' and '${e}' are the same file`)}yield copyFile(e,s,i)}})}t.cp=cp;function mv(e,t,n={}){return o(this,void 0,void 0,function*(){if(yield p.exists(t)){let i=true;if(yield p.isDirectory(t)){t=u.join(t,u.basename(e));i=yield p.exists(t)}if(i){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 o(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 o(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 o(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 o(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 i=[];for(const a of n){const n=yield p.tryGetExecutablePath(u.join(a,e),t);if(n){i.push(n)}}return i})}t.findInPath=findInPath;function readCopyOptions(e){const t=e.force==null?true:e.force;const n=Boolean(e.recursive);const i=e.copySourceDirectory==null?true:Boolean(e.copySourceDirectory);return{force:t,recursive:n,copySourceDirectory:i}}function cpDirRecursive(e,t,n,i){return o(this,voLine truncated
+2 -3
View File
@@ -4,7 +4,6 @@ import fs from 'fs'
import * as core from '@actions/core'
import * as cache from '@actions/cache'
import * as github from './github-utils'
import * as crypto from './crypto-utils'
import {inputCacheKeyGlobs, tryDeleteFiles} from './cache-dependencies'
@@ -22,7 +21,7 @@ export async function restoreCachedConfiguration(
if (fs.existsSync(cachePath)) return
core.saveState(CONFIGURATION_CACHE_PATH, cachePath)
const inputCacheExact = github.inputBoolean('configuration-cache-exact')
const inputCacheExact = core.getBooleanInput('configuration-cache-exact')
const cacheKeyGlobs = inputCacheKeyGlobs('configuration-cache-key')
const hash = await crypto.hashFiles(rootDir, cacheKeyGlobs)
@@ -93,5 +92,5 @@ export async function cacheConfiguration(): Promise<void> {
}
function isConfigurationCacheDisabled(): boolean {
return !github.inputBoolean('configuration-cache-enabled', false)
return !core.getBooleanInput('configuration-cache-enabled')
}
+4 -5
View File
@@ -5,7 +5,6 @@ import * as os from 'os'
import * as core from '@actions/core'
import * as cache from '@actions/cache'
import * as github from './github-utils'
import * as crypto from './crypto-utils'
const DEPENDENCIES_CACHE_PATH = 'DEPENDENCIES_CACHE_PATH'
@@ -21,7 +20,7 @@ export async function restoreCachedDependencies(
if (fs.existsSync(cachePath)) return
core.saveState(DEPENDENCIES_CACHE_PATH, cachePath)
const inputCacheExact = github.inputBoolean('dependencies-cache-exact')
const inputCacheExact = core.getBooleanInput('dependencies-cache-exact')
const cacheKeyGlobs = inputCacheKeyGlobs('dependencies-cache-key')
const hash = await crypto.hashFiles(rootDir, cacheKeyGlobs)
@@ -104,12 +103,12 @@ export function tryDeleteFiles(filePaths: string[]): boolean {
}
function isDependenciesCacheDisabled(): boolean {
return !github.inputBoolean('dependencies-cache-enabled', false)
return !core.getBooleanInput('dependencies-cache-enabled')
}
export function inputCacheKeyGlobs(input: string): string[] {
const inputValue = github.inputArrayOrNull(input)
return inputValue
const inputValue = core.getMultilineInput(input)
return inputValue.length > 0
? inputValue
: [
'**/*.gradle',
+3 -9
View File
@@ -5,8 +5,6 @@ import * as os from 'os'
import * as core from '@actions/core'
import * as cache from '@actions/cache'
import * as github from './github-utils'
const WRAPPER_SLUG = 'WRAPPER_SLUG'
export async function restoreCachedWrapperDist(
@@ -108,13 +106,9 @@ export function extractGradleWrapperSlugFromDistUri(
function isWrapperCacheDisabled(): boolean {
// Check if either 'distributions' or 'wrapper' cache has been disabled
const wrapperCacheEnabled = github.inputBoolean(
'wrapper-cache-enabled',
true
)
const distributionsCacheEnabled = github.inputBoolean(
'distributions-cache-enabled',
true
const wrapperCacheEnabled = core.getBooleanInput('wrapper-cache-enabled')
const distributionsCacheEnabled = core.getBooleanInput(
'distributions-cache-enabled'
)
return !wrapperCacheEnabled || !distributionsCacheEnabled
}
-24
View File
@@ -1,24 +0,0 @@
import * as core from '@actions/core'
export function inputOrNull(name: string): string | null {
const inputString = core.getInput(name, {required: false})
if (inputString.length === 0) {
return null
}
return inputString
}
export function inputArrayOrNull(name: string): string[] | null {
const string = inputOrNull(name)
if (!string) return null
return string
.split('\n')
.map(s => s.trim())
.filter(s => s !== '')
}
export function inputBoolean(name: string, defaultValue = false): boolean {
const string = inputOrNull(name)
if (!string) return defaultValue
return string === 'true'
}
+10 -11
View File
@@ -2,7 +2,6 @@ import * as core from '@actions/core'
import * as path from 'path'
import {parseArgsStringToArgv} from 'string-argv'
import * as github from './github-utils'
import * as cacheWrapper from './cache-wrapper'
import * as execution from './execution'
import * as gradlew from './gradlew'
@@ -41,13 +40,13 @@ async function resolveGradleExecutable(
workspaceDirectory: string,
buildRootDirectory: string
): Promise<string> {
const gradleVersion = github.inputOrNull('gradle-version')
if (gradleVersion !== null && gradleVersion !== 'wrapper') {
const gradleVersion = core.getInput('gradle-version')
if (gradleVersion !== '' && gradleVersion !== 'wrapper') {
return path.resolve(await provision.gradleVersion(gradleVersion))
}
const gradleExecutable = github.inputOrNull('gradle-executable')
if (gradleExecutable !== null) {
const gradleExecutable = core.getInput('gradle-executable')
if (gradleExecutable !== '') {
if (gradleExecutable.endsWith(gradlew.wrapperFilename())) {
await cacheWrapper.restoreCachedWrapperDist(
path.resolve(gradleExecutable, '..')
@@ -56,9 +55,9 @@ async function resolveGradleExecutable(
return path.resolve(workspaceDirectory, gradleExecutable)
}
const wrapperDirectory = github.inputOrNull('wrapper-directory')
const wrapperDirectory = core.getInput('wrapper-directory')
const gradlewDirectory =
wrapperDirectory !== null
wrapperDirectory !== ''
? path.resolve(workspaceDirectory, wrapperDirectory)
: buildRootDirectory
@@ -69,15 +68,15 @@ async function resolveGradleExecutable(
}
function resolveBuildRootDirectory(baseDirectory: string): string {
const buildRootDirectory = github.inputOrNull('build-root-directory')
const buildRootDirectory = core.getInput('build-root-directory')
const resolvedBuildRootDirectory =
buildRootDirectory === null
buildRootDirectory === ''
? path.resolve(baseDirectory)
: path.resolve(baseDirectory, buildRootDirectory)
return resolvedBuildRootDirectory
}
function parseCommandLineArguments(): string[] {
const input = github.inputOrNull('arguments')
return input === null ? [] : parseArgsStringToArgv(input)
const input = core.getInput('arguments')
return parseArgsStringToArgv(input)
}
+6 -2
View File
@@ -7,7 +7,6 @@ import * as cache from '@actions/cache'
import * as toolCache from '@actions/tool-cache'
import * as gradlew from './gradlew'
import * as github from './github-utils'
const gradleVersionsBaseUrl = 'https://services.gradle.org/versions'
@@ -19,6 +18,11 @@ export async function gradleVersion(version: string): Promise<string> {
case 'current':
return gradleCurrent()
case 'rc':
core.warning(
`Specifying gradle-version 'rc' has been deprecated. Use 'release-candidate' instead.`
)
return gradleReleaseCandidate()
case 'release-candidate':
return gradleReleaseCandidate()
case 'nightly':
return gradleNightly()
@@ -180,7 +184,7 @@ async function httpGetString(url: string): Promise<string> {
}
function isDistributionsCacheDisabled(): boolean {
return !github.inputBoolean('distributions-cache-enabled', true)
return !core.getBooleanInput('distributions-cache-enabled')
}
interface GradleVersionInfo {