mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-10-20 07:08:56 +08:00
Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
40b6781dcd | ||
|
626d937994 | ||
|
6c3f1eadfe | ||
|
8e02c8272a | ||
|
f63cb02cfc | ||
|
198484d871 | ||
|
fce96e0d6a | ||
|
75a86cfe02 | ||
|
be413309fa | ||
|
1b2daf5833 | ||
|
4388b1f9e5 | ||
|
07023d3e3e | ||
|
c94d573317 | ||
|
680037c65b | ||
|
2bf6bc3646 | ||
|
631021bf98 | ||
|
d1c4012c0d | ||
|
c097126a28 | ||
|
b4a540a61f | ||
|
c9a87440e3 | ||
|
d23c38fad3 | ||
|
a810b86311 | ||
|
7e48093f71 | ||
|
12681a2972 | ||
|
a8aa75965b | ||
|
a580d9bd57 | ||
|
a13870c94e | ||
|
55d241b8a2 | ||
|
9cf99034d2 | ||
|
6778644d75 |
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
7
.github/workflow-samples/groovy-dsl/gradlew
vendored
7
.github/workflow-samples/groovy-dsl/gradlew
vendored
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.12.6"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.10"
|
||||
id "com.gradle.enterprise" version "3.13.4"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
@@ -8,9 +8,9 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
api("org.apache.commons:commons-math3:3.6.1")
|
||||
implementation("com.google.guava:guava:31.1-jre")
|
||||
implementation("com.google.guava:guava:32.0.1-jre")
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.9.3")
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
|
Binary file not shown.
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=ff7bf6a86f09b9b2c40bb8f48b25fc19cf2b2664fd1d220cd7ab833ec758d0d7
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
7
.github/workflow-samples/kotlin-dsl/gradlew
vendored
7
.github/workflow-samples/kotlin-dsl/gradlew
vendored
@@ -85,9 +85,6 @@ done
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
|
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id("com.gradle.enterprise") version "3.12.6"
|
||||
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.10"
|
||||
id("com.gradle.enterprise") version "3.13.4"
|
||||
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.11"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.gradle.build-scan" version "3.12.6"
|
||||
id "com.gradle.build-scan" version "3.13.4"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.12.6"
|
||||
id "com.gradle.enterprise" version "3.13.4"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
2
.github/workflows/ci-init-script-check.yml
vendored
2
.github/workflows/ci-init-script-check.yml
vendored
@@ -20,7 +20,7 @@ jobs:
|
||||
distribution: temurin
|
||||
java-version: 8
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2 # Use a released version to avoid breakages
|
||||
uses: gradle/gradle-build-action@v2.4.2 # Use a released version to avoid breakages
|
||||
- name: Run integration tests
|
||||
working-directory: test/init-scripts
|
||||
run: ./gradlew check
|
||||
|
2
.github/workflows/ci-quick-check.yml
vendored
2
.github/workflows/ci-quick-check.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
- name: Configure Gradle as default for unit test
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: 7.6.1
|
||||
gradle-version: 8.1.1
|
||||
- name: Run tests
|
||||
run: |
|
||||
npm install
|
||||
|
2
.github/workflows/demo-job-summary.yml
vendored
2
.github/workflows/demo-job-summary.yml
vendored
@@ -1,4 +1,4 @@
|
||||
name: Demo Job Summary for Gradle builds
|
||||
name: Demo Job Summary, for Gradle builds
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# Configuration file for asdf version manager
|
||||
nodejs 16.18.1
|
||||
gradle 7.6.1
|
||||
gradle 8.1.1
|
||||
|
72
README.md
72
README.md
@@ -321,37 +321,28 @@ Gradle Home cache cleanup is disabled by default. You can enable this feature f
|
||||
gradle-home-cache-cleanup: true
|
||||
```
|
||||
|
||||
## Saving build outputs
|
||||
## Build reporting
|
||||
|
||||
By default, a GitHub Actions workflow using `gradle-build-action` will record the log output and any Build Scan links for your build,
|
||||
but any output files generated by the build will not be saved.
|
||||
|
||||
To save selected files from your build execution, you can use the core [Upload-Artifact](https://github.com/actions/upload-artifact) action.
|
||||
For example:
|
||||
The `gradle-build-action` collects information about any Gradle executions that occur in a workflow, and reports these via
|
||||
a Job Summary, visible in the GitHub Actions UI. For each Gradle execution, details about the invocation are listed, together with
|
||||
a link to any Build Scan® published.
|
||||
|
||||
Generation of a Job Summary is enabled by default. If this is not desired, it can be disable as follows:
|
||||
```yaml
|
||||
jobs:
|
||||
gradle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project sources
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
- name: Run build with Gradle wrapper
|
||||
run: ./gradlew build --scan
|
||||
- name: Upload build reports
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-reports
|
||||
path: build/reports/
|
||||
generate-job-summary: false
|
||||
```
|
||||
|
||||
## Build scans
|
||||
Note that the action collects information about Gradle invocations via an [Initialization Script](https://docs.gradle.org/current/userguide/init_scripts.html#sec:using_an_init_script)
|
||||
located at `USER_HOME/.gradle/init.d/build-result-capture.init.gradle`.
|
||||
If you are using init scripts for the [Gradle Enterprise Gradle Plugin](https://plugins.gradle.org/plugin/com.gradle.enterprise) like
|
||||
[`scans-init.gradle` or `gradle-enterprise-init.gradle`](https://docs.gradle.com/enterprise/gradle-plugin/#scans_gradle_com),
|
||||
you'll need to ensure these files are applied prior to `build-result-capture.init.gradle`.
|
||||
Since Gradle applies init scripts in alphabetical order, one way to ensure this is via file naming.
|
||||
|
||||
If your build publishes a [build scan](https://gradle.com/build-scans/) the `gradle-build-action` action will:
|
||||
- Add a notice with the link to the GitHub Actions user interface
|
||||
- For each step that executes Gradle, adds the link to the published build scan as a Step output named `build-scan-url`.
|
||||
### Build scan link as Step output
|
||||
|
||||
As well as reporting the [Build Scan](https://gradle.com/build-scans/) link in the Job Summary,
|
||||
the `gradle-build-action` action makes this link available as a Step output named `build-scan-url`.
|
||||
|
||||
You can then use that link in subsequent actions of your workflow. For example:
|
||||
|
||||
@@ -384,12 +375,31 @@ jobs:
|
||||
})
|
||||
```
|
||||
|
||||
Note that the build scan capturing utilizes the [Initialization Script](https://docs.gradle.org/current/userguide/init_scripts.html#sec:using_an_init_script)
|
||||
in the `USER_HOME/.gradle/init.d/` directory, with the file named `build-result-capture.init.gradle`.
|
||||
So, if you are using the init scripts for the [Gradle Enterprise Gradle Plugin](https://plugins.gradle.org/plugin/com.gradle.enterprise) like
|
||||
[`scans-init.gradle` or `gradle-enterprise-init.gradle`](https://docs.gradle.com/enterprise/gradle-plugin/#scans_gradle_com),
|
||||
make sure that its file names have earlier alphabetical order to the `build-result-capture.init.gradle`,
|
||||
since configuring capture requires Gradle Enterprise Gradle Plugin to be applied already.
|
||||
### Saving build outputs
|
||||
|
||||
By default, a GitHub Actions workflow using `gradle-build-action` will record the log output and any Build Scan links for your build,
|
||||
but any output files generated by the build will not be saved.
|
||||
|
||||
To save selected files from your build execution, you can use the core [Upload-Artifact](https://github.com/actions/upload-artifact) action.
|
||||
For example:
|
||||
|
||||
```yaml
|
||||
jobs:
|
||||
gradle:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout project sources
|
||||
uses: actions/checkout@v3
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2
|
||||
- name: Run build with Gradle wrapper
|
||||
run: ./gradlew build --scan
|
||||
- name: Upload build reports
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: build-reports
|
||||
path: build/reports/
|
||||
```
|
||||
|
||||
## Support for GitHub Enterprise Server (GHES)
|
||||
|
||||
|
18
action.yml
18
action.yml
@@ -5,7 +5,15 @@ description: 'Configures Gradle for use in GitHub actions, caching useful state
|
||||
|
||||
inputs:
|
||||
gradle-version:
|
||||
description: Gradle version to use
|
||||
description: Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
|
||||
required: false
|
||||
|
||||
gradle-executable:
|
||||
description: Path to the Gradle executable. If specified, this executable will be added to the PATH and used for invoking Gradle.
|
||||
required: false
|
||||
|
||||
build-root-directory:
|
||||
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
|
||||
required: false
|
||||
|
||||
cache-disabled:
|
||||
@@ -45,14 +53,6 @@ inputs:
|
||||
description: Gradle command line arguments (supports multi-line input)
|
||||
required: false
|
||||
|
||||
build-root-directory:
|
||||
description: Path to the root directory of the build
|
||||
required: false
|
||||
|
||||
gradle-executable:
|
||||
description: Path to the Gradle executable
|
||||
required: false
|
||||
|
||||
generate-job-summary:
|
||||
description: When 'false', no Job Summary will be generated for the Job.
|
||||
required: false
|
||||
|
19
actions/dependency-graph-generate/action.yml
Normal file
19
actions/dependency-graph-generate/action.yml
Normal file
@@ -0,0 +1,19 @@
|
||||
name: "Dependency Graph Generate"
|
||||
description: Calculates the complete dependency graph for the repository, saving it as a JSON artifact.
|
||||
|
||||
inputs:
|
||||
gradle-version:
|
||||
description: Gradle version to use. If specified, this Gradle version will be downloaded, added to the PATH and used for invoking Gradle.
|
||||
required: false
|
||||
|
||||
gradle-executable:
|
||||
description: Path to the Gradle executable. If specified, this executable will be added to the PATH and used for invoking Gradle.
|
||||
required: false
|
||||
|
||||
build-root-directory:
|
||||
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: '../../dist/dependency-graph-generate/index.js'
|
12
actions/dependency-graph-submit/action.yml
Normal file
12
actions/dependency-graph-submit/action.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
name: "Dependency Graph Submit"
|
||||
description: Retrieves a previously created dependency graph JSON and submits via the GitHub Dependency Submission API.
|
||||
|
||||
inputs:
|
||||
github-token:
|
||||
description: The GitHub token used to authenticate when submitting via the Dependency Submission API.
|
||||
default: ${{ github.token }}
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'node16'
|
||||
main: '../../dist/dependency-graph-submit/index.js'
|
72834
dist/dependency-graph-generate/index.js
vendored
Normal file
72834
dist/dependency-graph-generate/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/dependency-graph-generate/index.js.map
vendored
Normal file
1
dist/dependency-graph-generate/index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
24783
dist/dependency-graph-submit/index.js
vendored
Normal file
24783
dist/dependency-graph-submit/index.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
dist/dependency-graph-submit/index.js.map
vendored
Normal file
1
dist/dependency-graph-submit/index.js.map
vendored
Normal file
File diff suppressed because one or more lines are too long
419
dist/main/index.js
vendored
419
dist/main/index.js
vendored
@@ -55409,58 +55409,6 @@ function coerce (version, options) {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9453:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
function parseArgsStringToArgv(value, env, file) {
|
||||
// ([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*) Matches nested quotes until the first space outside of quotes
|
||||
// [^\s'"]+ or Match if not a space ' or "
|
||||
// (['"])([^\5]*?)\5 or Match "quoted text" without quotes
|
||||
// `\3` and `\5` are a backreference to the quote style (' or ") captured
|
||||
var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi;
|
||||
var myString = value;
|
||||
var myArray = [];
|
||||
if (env) {
|
||||
myArray.push(env);
|
||||
}
|
||||
if (file) {
|
||||
myArray.push(file);
|
||||
}
|
||||
var match;
|
||||
do {
|
||||
// Each call to exec returns the next regex match as an array
|
||||
match = myRegexp.exec(myString);
|
||||
if (match !== null) {
|
||||
// Index 1 in the array is the captured group if it exists
|
||||
// Index 0 is the matched text, which we use if no captured group exists
|
||||
myArray.push(firstString(match[1], match[6], match[0]));
|
||||
}
|
||||
} while (match !== null);
|
||||
return myArray;
|
||||
}
|
||||
exports["default"] = parseArgsStringToArgv;
|
||||
exports.parseArgsStringToArgv = parseArgsStringToArgv;
|
||||
// Accepts any number of arguments, and returns the first one that is a string
|
||||
// (even an empty string)
|
||||
function firstString() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
var arg = args[i];
|
||||
if (typeof arg === "string") {
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4256:
|
||||
@@ -63611,12 +63559,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const cache_utils_1 = __nccwpck_require__(1678);
|
||||
const cache_extract_entries_1 = __nccwpck_require__(6161);
|
||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
|
||||
exports.META_FILE_DIR = '.gradle-build-action';
|
||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes';
|
||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes';
|
||||
class GradleStateCache {
|
||||
constructor(gradleUserHome) {
|
||||
this.gradleUserHome = gradleUserHome;
|
||||
@@ -63708,7 +63655,7 @@ class GradleStateCache {
|
||||
});
|
||||
}
|
||||
deleteExcludedPaths() {
|
||||
const rawPaths = core.getMultilineInput(EXCLUDE_PATHS_PARAMETER);
|
||||
const rawPaths = params.getCacheExcludes();
|
||||
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
|
||||
for (const p of resolvedPaths) {
|
||||
(0, cache_utils_1.cacheDebug)(`Deleting excluded path: ${p}`);
|
||||
@@ -63716,7 +63663,7 @@ class GradleStateCache {
|
||||
}
|
||||
}
|
||||
getCachePath() {
|
||||
const rawPaths = core.getMultilineInput(INCLUDE_PATHS_PARAMETER);
|
||||
const rawPaths = params.getCacheIncludes();
|
||||
rawPaths.push(exports.META_FILE_DIR);
|
||||
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x));
|
||||
(0, cache_utils_1.cacheDebug)(`Using cache paths: ${resolvedPaths}`);
|
||||
@@ -63871,16 +63818,11 @@ class CacheCleaner {
|
||||
implicitDescendants: false
|
||||
});
|
||||
try {
|
||||
for (var _d = true, _e = __asyncValues(globber.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
||||
for (var _d = true, _e = __asyncValues(globber.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
||||
_c = _f.value;
|
||||
_d = false;
|
||||
try {
|
||||
const file = _c;
|
||||
fs_1.default.utimesSync(file, timestamp, timestamp);
|
||||
}
|
||||
finally {
|
||||
_d = true;
|
||||
}
|
||||
const file = _c;
|
||||
fs_1.default.utimesSync(file, timestamp, timestamp);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
@@ -63944,6 +63886,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const glob = __importStar(__nccwpck_require__(8090));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const cache_base_1 = __nccwpck_require__(6948);
|
||||
const cache_utils_1 = __nccwpck_require__(1678);
|
||||
const build_results_1 = __nccwpck_require__(2107);
|
||||
@@ -64076,7 +64019,7 @@ class AbstractEntryExtractor {
|
||||
}
|
||||
awaitForDebugging(p) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if ((0, cache_utils_1.isCacheDebuggingEnabled)()) {
|
||||
if (params.isCacheDebuggingEnabled()) {
|
||||
yield p;
|
||||
}
|
||||
return p;
|
||||
@@ -64439,7 +64382,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyForJob = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const github = __importStar(__nccwpck_require__(5438));
|
||||
@@ -64447,14 +64390,8 @@ const exec = __importStar(__nccwpck_require__(1514));
|
||||
const crypto = __importStar(__nccwpck_require__(6113));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const fs = __importStar(__nccwpck_require__(7147));
|
||||
const CACHE_PROTOCOL_VERSION = 'v7-';
|
||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
|
||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled';
|
||||
const CACHE_READONLY_PARAMETER = 'cache-read-only';
|
||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only';
|
||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match';
|
||||
const CACHE_CLEANUP_ENABLED_PARAMETER = 'gradle-home-cache-cleanup';
|
||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED';
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const CACHE_PROTOCOL_VERSION = 'v8-';
|
||||
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
|
||||
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT';
|
||||
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
|
||||
@@ -64466,23 +64403,23 @@ function isCacheDisabled() {
|
||||
if (!cache.isFeatureAvailable()) {
|
||||
return true;
|
||||
}
|
||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
||||
return params.isCacheDisabled();
|
||||
}
|
||||
exports.isCacheDisabled = isCacheDisabled;
|
||||
function isCacheReadOnly() {
|
||||
return !isCacheWriteOnly() && core.getBooleanInput(CACHE_READONLY_PARAMETER);
|
||||
return !isCacheWriteOnly() && params.isCacheReadOnly();
|
||||
}
|
||||
exports.isCacheReadOnly = isCacheReadOnly;
|
||||
function isCacheWriteOnly() {
|
||||
return core.getBooleanInput(CACHE_WRITEONLY_PARAMETER);
|
||||
return params.isCacheWriteOnly();
|
||||
}
|
||||
exports.isCacheWriteOnly = isCacheWriteOnly;
|
||||
function isCacheDebuggingEnabled() {
|
||||
return process.env[CACHE_DEBUG_VAR] ? true : false;
|
||||
return params.isCacheDebuggingEnabled();
|
||||
}
|
||||
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
||||
function isCacheCleanupEnabled() {
|
||||
return core.getBooleanInput(CACHE_CLEANUP_ENABLED_PARAMETER);
|
||||
return params.isCacheCleanupEnabled();
|
||||
}
|
||||
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
|
||||
class CacheKey {
|
||||
@@ -64498,7 +64435,7 @@ function generateCacheKey(cacheName) {
|
||||
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`;
|
||||
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`;
|
||||
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`;
|
||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
||||
if (params.isCacheStrictMatch()) {
|
||||
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
|
||||
}
|
||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment]);
|
||||
@@ -64513,14 +64450,19 @@ function getCacheKeyEnvironment() {
|
||||
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
||||
}
|
||||
function getCacheKeyJob() {
|
||||
return process.env[CACHE_KEY_JOB_VAR] || github.context.job;
|
||||
return process.env[CACHE_KEY_JOB_VAR] || getCacheKeyForJob(github.context.workflow, github.context.job);
|
||||
}
|
||||
function getCacheKeyForJob(workflowName, jobId) {
|
||||
const sanitizedWorkflow = workflowName.replace(/,/g, '').toLowerCase();
|
||||
return `${sanitizedWorkflow}-${jobId}`;
|
||||
}
|
||||
exports.getCacheKeyForJob = getCacheKeyForJob;
|
||||
function getCacheKeyJobInstance() {
|
||||
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
||||
if (override) {
|
||||
return override;
|
||||
}
|
||||
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER);
|
||||
const workflowJobContext = params.getJobContext();
|
||||
return hashStrings([workflowJobContext]);
|
||||
}
|
||||
function getCacheKeyJobExecution() {
|
||||
@@ -64963,6 +64905,115 @@ function validateGradleWrapper(buildRootDirectory) {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3885:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobContext = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const string_argv_1 = __nccwpck_require__(9663);
|
||||
function isCacheDisabled() {
|
||||
return getBooleanInput('cache-disabled');
|
||||
}
|
||||
exports.isCacheDisabled = isCacheDisabled;
|
||||
function isCacheReadOnly() {
|
||||
return getBooleanInput('cache-read-only');
|
||||
}
|
||||
exports.isCacheReadOnly = isCacheReadOnly;
|
||||
function isCacheWriteOnly() {
|
||||
return getBooleanInput('cache-write-only');
|
||||
}
|
||||
exports.isCacheWriteOnly = isCacheWriteOnly;
|
||||
function isCacheStrictMatch() {
|
||||
return getBooleanInput('gradle-home-cache-strict-match');
|
||||
}
|
||||
exports.isCacheStrictMatch = isCacheStrictMatch;
|
||||
function isCacheDebuggingEnabled() {
|
||||
return process.env['GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'] ? true : false;
|
||||
}
|
||||
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
||||
function isCacheCleanupEnabled() {
|
||||
return getBooleanInput('gradle-home-cache-cleanup');
|
||||
}
|
||||
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
|
||||
function getCacheIncludes() {
|
||||
return core.getMultilineInput('gradle-home-cache-includes');
|
||||
}
|
||||
exports.getCacheIncludes = getCacheIncludes;
|
||||
function getCacheExcludes() {
|
||||
return core.getMultilineInput('gradle-home-cache-excludes');
|
||||
}
|
||||
exports.getCacheExcludes = getCacheExcludes;
|
||||
function getBuildRootDirectory() {
|
||||
return core.getInput('build-root-directory');
|
||||
}
|
||||
exports.getBuildRootDirectory = getBuildRootDirectory;
|
||||
function getGradleVersion() {
|
||||
return core.getInput('gradle-version');
|
||||
}
|
||||
exports.getGradleVersion = getGradleVersion;
|
||||
function getGradleExecutable() {
|
||||
return core.getInput('gradle-executable');
|
||||
}
|
||||
exports.getGradleExecutable = getGradleExecutable;
|
||||
function getArguments() {
|
||||
const input = core.getInput('arguments');
|
||||
return (0, string_argv_1.parseArgsStringToArgv)(input);
|
||||
}
|
||||
exports.getArguments = getArguments;
|
||||
function getJobContext() {
|
||||
return core.getInput('workflow-job-context');
|
||||
}
|
||||
exports.getJobContext = getJobContext;
|
||||
function getGithubToken() {
|
||||
return core.getInput('github-token', { required: true });
|
||||
}
|
||||
exports.getGithubToken = getGithubToken;
|
||||
function isJobSummaryEnabled() {
|
||||
return getBooleanInput('generate-job-summary', true);
|
||||
}
|
||||
exports.isJobSummaryEnabled = isJobSummaryEnabled;
|
||||
function getBooleanInput(paramName, paramDefault = false) {
|
||||
const paramValue = core.getInput(paramName);
|
||||
switch (paramValue.toLowerCase().trim()) {
|
||||
case '':
|
||||
return paramDefault;
|
||||
case 'false':
|
||||
return false;
|
||||
case 'true':
|
||||
return true;
|
||||
}
|
||||
throw TypeError(`The value '${paramValue} is not valid for '${paramName}. Valid values are: [true, false]`);
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7345:
|
||||
@@ -65128,23 +65179,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.run = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const string_argv_1 = __nccwpck_require__(9453);
|
||||
const setupGradle = __importStar(__nccwpck_require__(8652));
|
||||
const execution = __importStar(__nccwpck_require__(3584));
|
||||
const provision = __importStar(__nccwpck_require__(2501));
|
||||
const provisioner = __importStar(__nccwpck_require__(2501));
|
||||
const layout = __importStar(__nccwpck_require__(8182));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const workspaceDirectory = process.env[`GITHUB_WORKSPACE`] || '';
|
||||
const buildRootDirectory = resolveBuildRootDirectory(workspaceDirectory);
|
||||
yield setupGradle.setup(buildRootDirectory);
|
||||
const executable = yield provisionGradle(workspaceDirectory);
|
||||
if (executable !== undefined) {
|
||||
core.addPath(path.dirname(executable));
|
||||
}
|
||||
const args = parseCommandLineArguments();
|
||||
yield setupGradle.setup();
|
||||
const executable = yield provisioner.provisionGradle();
|
||||
const args = params.getArguments();
|
||||
if (args.length > 0) {
|
||||
const buildRootDirectory = layout.buildRootDirectory();
|
||||
yield execution.executeGradleBuild(executable, buildRootDirectory, args);
|
||||
}
|
||||
}
|
||||
@@ -65158,28 +65205,6 @@ function run() {
|
||||
}
|
||||
exports.run = run;
|
||||
run();
|
||||
function provisionGradle(workspaceDirectory) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const gradleVersion = core.getInput('gradle-version');
|
||||
if (gradleVersion !== '' && gradleVersion !== 'wrapper') {
|
||||
return path.resolve(yield provision.gradleVersion(gradleVersion));
|
||||
}
|
||||
const gradleExecutable = core.getInput('gradle-executable');
|
||||
if (gradleExecutable !== '') {
|
||||
return path.resolve(workspaceDirectory, gradleExecutable);
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
function resolveBuildRootDirectory(baseDirectory) {
|
||||
const buildRootDirectory = core.getInput('build-root-directory');
|
||||
const resolvedBuildRootDirectory = buildRootDirectory === '' ? path.resolve(baseDirectory) : path.resolve(baseDirectory, buildRootDirectory);
|
||||
return resolvedBuildRootDirectory;
|
||||
}
|
||||
function parseCommandLineArguments() {
|
||||
const input = core.getInput('arguments');
|
||||
return (0, string_argv_1.parseArgsStringToArgv)(input);
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -65222,7 +65247,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.gradleVersion = void 0;
|
||||
exports.provisionGradle = void 0;
|
||||
const fs = __importStar(__nccwpck_require__(7147));
|
||||
const os = __importStar(__nccwpck_require__(2037));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
@@ -65231,9 +65256,32 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const toolCache = __importStar(__nccwpck_require__(7784));
|
||||
const gradlew = __importStar(__nccwpck_require__(2335));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const layout = __importStar(__nccwpck_require__(8182));
|
||||
const cache_utils_1 = __nccwpck_require__(1678);
|
||||
const gradleVersionsBaseUrl = 'https://services.gradle.org/versions';
|
||||
function gradleVersion(version) {
|
||||
function provisionGradle() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const gradleVersion = params.getGradleVersion();
|
||||
if (gradleVersion !== '' && gradleVersion !== 'wrapper') {
|
||||
return addToPath(path.resolve(yield installGradle(gradleVersion)));
|
||||
}
|
||||
const gradleExecutable = params.getGradleExecutable();
|
||||
if (gradleExecutable !== '') {
|
||||
const workspaceDirectory = layout.workspaceDirectory();
|
||||
return addToPath(path.resolve(workspaceDirectory, gradleExecutable));
|
||||
}
|
||||
return undefined;
|
||||
});
|
||||
}
|
||||
exports.provisionGradle = provisionGradle;
|
||||
function addToPath(executable) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
core.addPath(path.dirname(executable));
|
||||
return executable;
|
||||
});
|
||||
}
|
||||
function installGradle(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
switch (version) {
|
||||
case 'current':
|
||||
@@ -65252,18 +65300,17 @@ function gradleVersion(version) {
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.gradleVersion = gradleVersion;
|
||||
function gradleCurrent() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/current`);
|
||||
return provisionGradle(versionInfo);
|
||||
return installGradleVersion(versionInfo);
|
||||
});
|
||||
}
|
||||
function gradleReleaseCandidate() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-candidate`);
|
||||
if (versionInfo && versionInfo.version && versionInfo.downloadUrl) {
|
||||
return provisionGradle(versionInfo);
|
||||
return installGradleVersion(versionInfo);
|
||||
}
|
||||
core.info('No current release-candidate found, will fallback to current');
|
||||
return gradleCurrent();
|
||||
@@ -65272,13 +65319,13 @@ function gradleReleaseCandidate() {
|
||||
function gradleNightly() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/nightly`);
|
||||
return provisionGradle(versionInfo);
|
||||
return installGradleVersion(versionInfo);
|
||||
});
|
||||
}
|
||||
function gradleReleaseNightly() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-nightly`);
|
||||
return provisionGradle(versionInfo);
|
||||
return installGradleVersion(versionInfo);
|
||||
});
|
||||
}
|
||||
function gradle(version) {
|
||||
@@ -65287,7 +65334,7 @@ function gradle(version) {
|
||||
if (!versionInfo) {
|
||||
throw new Error(`Gradle version ${version} does not exists`);
|
||||
}
|
||||
return provisionGradle(versionInfo);
|
||||
return installGradleVersion(versionInfo);
|
||||
});
|
||||
}
|
||||
function gradleVersionDeclaration(url) {
|
||||
@@ -65303,7 +65350,7 @@ function findGradleVersionDeclaration(version) {
|
||||
});
|
||||
});
|
||||
}
|
||||
function provisionGradle(versionInfo) {
|
||||
function installGradleVersion(versionInfo) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
return core.group(`Provision Gradle ${versionInfo.version}`, () => __awaiter(this, void 0, void 0, function* () {
|
||||
return locateGradleAndDownloadIfRequired(versionInfo);
|
||||
@@ -65386,6 +65433,55 @@ function httpGetString(url) {
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8182:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.buildRootDirectory = exports.workspaceDirectory = void 0;
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
function workspaceDirectory() {
|
||||
return process.env[`GITHUB_WORKSPACE`] || '';
|
||||
}
|
||||
exports.workspaceDirectory = workspaceDirectory;
|
||||
function buildRootDirectory() {
|
||||
const baseDirectory = workspaceDirectory();
|
||||
const buildRootDirectoryInput = params.getBuildRootDirectory();
|
||||
const resolvedBuildRootDirectory = buildRootDirectoryInput === ''
|
||||
? path.resolve(baseDirectory)
|
||||
: path.resolve(baseDirectory, buildRootDirectoryInput);
|
||||
return resolvedBuildRootDirectory;
|
||||
}
|
||||
exports.buildRootDirectory = buildRootDirectory;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8652:
|
||||
@@ -65433,6 +65529,8 @@ const summary_1 = __nccwpck_require__(1327);
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const os = __importStar(__nccwpck_require__(2037));
|
||||
const caches = __importStar(__nccwpck_require__(3800));
|
||||
const layout = __importStar(__nccwpck_require__(8182));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const job_summary_1 = __nccwpck_require__(7345);
|
||||
const build_results_1 = __nccwpck_require__(2107);
|
||||
const cache_reporting_1 = __nccwpck_require__(6674);
|
||||
@@ -65440,16 +65538,9 @@ const daemon_controller_1 = __nccwpck_require__(5146);
|
||||
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED';
|
||||
const GRADLE_USER_HOME = 'GRADLE_USER_HOME';
|
||||
const CACHE_LISTENER = 'CACHE_LISTENER';
|
||||
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary';
|
||||
function shouldGenerateJobSummary() {
|
||||
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
|
||||
return false;
|
||||
}
|
||||
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER);
|
||||
}
|
||||
function setup(buildRootDirectory) {
|
||||
function setup() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const gradleUserHome = yield determineGradleUserHome(buildRootDirectory);
|
||||
const gradleUserHome = yield determineGradleUserHome();
|
||||
if (process.env[GRADLE_SETUP_VAR]) {
|
||||
core.info('Gradle setup only performed on first gradle-build-action step in workflow.');
|
||||
return;
|
||||
@@ -65484,10 +65575,11 @@ function complete() {
|
||||
});
|
||||
}
|
||||
exports.complete = complete;
|
||||
function determineGradleUserHome(rootDir) {
|
||||
function determineGradleUserHome() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const customGradleUserHome = process.env['GRADLE_USER_HOME'];
|
||||
if (customGradleUserHome) {
|
||||
const rootDir = layout.workspaceDirectory();
|
||||
return path.resolve(rootDir, customGradleUserHome);
|
||||
}
|
||||
return path.resolve(yield determineUserHome(), '.gradle');
|
||||
@@ -65507,6 +65599,12 @@ function determineUserHome() {
|
||||
return userHome;
|
||||
});
|
||||
}
|
||||
function shouldGenerateJobSummary() {
|
||||
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
|
||||
return false;
|
||||
}
|
||||
return params.isJobSummaryEnabled();
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -65669,6 +65767,59 @@ module.exports = require("util");
|
||||
"use strict";
|
||||
module.exports = require("zlib");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9663:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.parseArgsStringToArgv = void 0;
|
||||
function parseArgsStringToArgv(value, env, file) {
|
||||
// ([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*) Matches nested quotes until the first space outside of quotes
|
||||
// [^\s'"]+ or Match if not a space ' or "
|
||||
// (['"])([^\5]*?)\5 or Match "quoted text" without quotes
|
||||
// `\3` and `\5` are a backreference to the quote style (' or ") captured
|
||||
var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi;
|
||||
var myString = value;
|
||||
var myArray = [];
|
||||
if (env) {
|
||||
myArray.push(env);
|
||||
}
|
||||
if (file) {
|
||||
myArray.push(file);
|
||||
}
|
||||
var match;
|
||||
do {
|
||||
// Each call to exec returns the next regex match as an array
|
||||
match = myRegexp.exec(myString);
|
||||
if (match !== null) {
|
||||
// Index 1 in the array is the captured group if it exists
|
||||
// Index 0 is the matched text, which we use if no captured group exists
|
||||
myArray.push(firstString(match[1], match[6], match[0]));
|
||||
}
|
||||
} while (match !== null);
|
||||
return myArray;
|
||||
}
|
||||
exports["default"] = parseArgsStringToArgv;
|
||||
exports.parseArgsStringToArgv = parseArgsStringToArgv;
|
||||
// Accepts any number of arguments, and returns the first one that is a string
|
||||
// (even an empty string)
|
||||
function firstString() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
var arg = args[i];
|
||||
if (typeof arg === "string") {
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3765:
|
||||
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
287
dist/post/index.js
vendored
287
dist/post/index.js
vendored
@@ -62662,12 +62662,11 @@ const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const cache_utils_1 = __nccwpck_require__(1678);
|
||||
const cache_extract_entries_1 = __nccwpck_require__(6161);
|
||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key';
|
||||
exports.META_FILE_DIR = '.gradle-build-action';
|
||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes';
|
||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes';
|
||||
class GradleStateCache {
|
||||
constructor(gradleUserHome) {
|
||||
this.gradleUserHome = gradleUserHome;
|
||||
@@ -62759,7 +62758,7 @@ class GradleStateCache {
|
||||
});
|
||||
}
|
||||
deleteExcludedPaths() {
|
||||
const rawPaths = core.getMultilineInput(EXCLUDE_PATHS_PARAMETER);
|
||||
const rawPaths = params.getCacheExcludes();
|
||||
const resolvedPaths = rawPaths.map(x => path_1.default.resolve(this.gradleUserHome, x));
|
||||
for (const p of resolvedPaths) {
|
||||
(0, cache_utils_1.cacheDebug)(`Deleting excluded path: ${p}`);
|
||||
@@ -62767,7 +62766,7 @@ class GradleStateCache {
|
||||
}
|
||||
}
|
||||
getCachePath() {
|
||||
const rawPaths = core.getMultilineInput(INCLUDE_PATHS_PARAMETER);
|
||||
const rawPaths = params.getCacheIncludes();
|
||||
rawPaths.push(exports.META_FILE_DIR);
|
||||
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x));
|
||||
(0, cache_utils_1.cacheDebug)(`Using cache paths: ${resolvedPaths}`);
|
||||
@@ -62922,16 +62921,11 @@ class CacheCleaner {
|
||||
implicitDescendants: false
|
||||
});
|
||||
try {
|
||||
for (var _d = true, _e = __asyncValues(globber.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
|
||||
for (var _d = true, _e = __asyncValues(globber.globGenerator()), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
||||
_c = _f.value;
|
||||
_d = false;
|
||||
try {
|
||||
const file = _c;
|
||||
fs_1.default.utimesSync(file, timestamp, timestamp);
|
||||
}
|
||||
finally {
|
||||
_d = true;
|
||||
}
|
||||
const file = _c;
|
||||
fs_1.default.utimesSync(file, timestamp, timestamp);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
@@ -62995,6 +62989,7 @@ const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const glob = __importStar(__nccwpck_require__(8090));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const cache_base_1 = __nccwpck_require__(6948);
|
||||
const cache_utils_1 = __nccwpck_require__(1678);
|
||||
const build_results_1 = __nccwpck_require__(2107);
|
||||
@@ -63127,7 +63122,7 @@ class AbstractEntryExtractor {
|
||||
}
|
||||
awaitForDebugging(p) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if ((0, cache_utils_1.isCacheDebuggingEnabled)()) {
|
||||
if (params.isCacheDebuggingEnabled()) {
|
||||
yield p;
|
||||
}
|
||||
return p;
|
||||
@@ -63490,7 +63485,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||
exports.tryDelete = exports.handleCacheFailure = exports.cacheDebug = exports.saveCache = exports.restoreCache = exports.hashStrings = exports.hashFileNames = exports.getCacheKeyForJob = exports.getCacheKeyPrefix = exports.generateCacheKey = exports.CacheKey = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const cache = __importStar(__nccwpck_require__(7799));
|
||||
const github = __importStar(__nccwpck_require__(5438));
|
||||
@@ -63498,14 +63493,8 @@ const exec = __importStar(__nccwpck_require__(1514));
|
||||
const crypto = __importStar(__nccwpck_require__(6113));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const fs = __importStar(__nccwpck_require__(7147));
|
||||
const CACHE_PROTOCOL_VERSION = 'v7-';
|
||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context';
|
||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled';
|
||||
const CACHE_READONLY_PARAMETER = 'cache-read-only';
|
||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only';
|
||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match';
|
||||
const CACHE_CLEANUP_ENABLED_PARAMETER = 'gradle-home-cache-cleanup';
|
||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED';
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const CACHE_PROTOCOL_VERSION = 'v8-';
|
||||
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX';
|
||||
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT';
|
||||
const CACHE_KEY_JOB_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_JOB';
|
||||
@@ -63517,23 +63506,23 @@ function isCacheDisabled() {
|
||||
if (!cache.isFeatureAvailable()) {
|
||||
return true;
|
||||
}
|
||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER);
|
||||
return params.isCacheDisabled();
|
||||
}
|
||||
exports.isCacheDisabled = isCacheDisabled;
|
||||
function isCacheReadOnly() {
|
||||
return !isCacheWriteOnly() && core.getBooleanInput(CACHE_READONLY_PARAMETER);
|
||||
return !isCacheWriteOnly() && params.isCacheReadOnly();
|
||||
}
|
||||
exports.isCacheReadOnly = isCacheReadOnly;
|
||||
function isCacheWriteOnly() {
|
||||
return core.getBooleanInput(CACHE_WRITEONLY_PARAMETER);
|
||||
return params.isCacheWriteOnly();
|
||||
}
|
||||
exports.isCacheWriteOnly = isCacheWriteOnly;
|
||||
function isCacheDebuggingEnabled() {
|
||||
return process.env[CACHE_DEBUG_VAR] ? true : false;
|
||||
return params.isCacheDebuggingEnabled();
|
||||
}
|
||||
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
||||
function isCacheCleanupEnabled() {
|
||||
return core.getBooleanInput(CACHE_CLEANUP_ENABLED_PARAMETER);
|
||||
return params.isCacheCleanupEnabled();
|
||||
}
|
||||
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
|
||||
class CacheKey {
|
||||
@@ -63549,7 +63538,7 @@ function generateCacheKey(cacheName) {
|
||||
const cacheKeyForJob = `${cacheKeyForEnvironment}|${getCacheKeyJob()}`;
|
||||
const cacheKeyForJobContext = `${cacheKeyForJob}[${getCacheKeyJobInstance()}]`;
|
||||
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`;
|
||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
||||
if (params.isCacheStrictMatch()) {
|
||||
return new CacheKey(cacheKey, [cacheKeyForJobContext]);
|
||||
}
|
||||
return new CacheKey(cacheKey, [cacheKeyForJobContext, cacheKeyForJob, cacheKeyForEnvironment]);
|
||||
@@ -63564,14 +63553,19 @@ function getCacheKeyEnvironment() {
|
||||
return process.env[CACHE_KEY_OS_VAR] || runnerOs;
|
||||
}
|
||||
function getCacheKeyJob() {
|
||||
return process.env[CACHE_KEY_JOB_VAR] || github.context.job;
|
||||
return process.env[CACHE_KEY_JOB_VAR] || getCacheKeyForJob(github.context.workflow, github.context.job);
|
||||
}
|
||||
function getCacheKeyForJob(workflowName, jobId) {
|
||||
const sanitizedWorkflow = workflowName.replace(/,/g, '').toLowerCase();
|
||||
return `${sanitizedWorkflow}-${jobId}`;
|
||||
}
|
||||
exports.getCacheKeyForJob = getCacheKeyForJob;
|
||||
function getCacheKeyJobInstance() {
|
||||
const override = process.env[CACHE_KEY_JOB_INSTANCE_VAR];
|
||||
if (override) {
|
||||
return override;
|
||||
}
|
||||
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER);
|
||||
const workflowJobContext = params.getJobContext();
|
||||
return hashStrings([workflowJobContext]);
|
||||
}
|
||||
function getCacheKeyJobExecution() {
|
||||
@@ -63883,6 +63877,115 @@ class DaemonController {
|
||||
exports.DaemonController = DaemonController;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3885:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.isJobSummaryEnabled = exports.getGithubToken = exports.getJobContext = exports.getArguments = exports.getGradleExecutable = exports.getGradleVersion = exports.getBuildRootDirectory = exports.getCacheExcludes = exports.getCacheIncludes = exports.isCacheCleanupEnabled = exports.isCacheDebuggingEnabled = exports.isCacheStrictMatch = exports.isCacheWriteOnly = exports.isCacheReadOnly = exports.isCacheDisabled = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const string_argv_1 = __nccwpck_require__(9663);
|
||||
function isCacheDisabled() {
|
||||
return getBooleanInput('cache-disabled');
|
||||
}
|
||||
exports.isCacheDisabled = isCacheDisabled;
|
||||
function isCacheReadOnly() {
|
||||
return getBooleanInput('cache-read-only');
|
||||
}
|
||||
exports.isCacheReadOnly = isCacheReadOnly;
|
||||
function isCacheWriteOnly() {
|
||||
return getBooleanInput('cache-write-only');
|
||||
}
|
||||
exports.isCacheWriteOnly = isCacheWriteOnly;
|
||||
function isCacheStrictMatch() {
|
||||
return getBooleanInput('gradle-home-cache-strict-match');
|
||||
}
|
||||
exports.isCacheStrictMatch = isCacheStrictMatch;
|
||||
function isCacheDebuggingEnabled() {
|
||||
return process.env['GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'] ? true : false;
|
||||
}
|
||||
exports.isCacheDebuggingEnabled = isCacheDebuggingEnabled;
|
||||
function isCacheCleanupEnabled() {
|
||||
return getBooleanInput('gradle-home-cache-cleanup');
|
||||
}
|
||||
exports.isCacheCleanupEnabled = isCacheCleanupEnabled;
|
||||
function getCacheIncludes() {
|
||||
return core.getMultilineInput('gradle-home-cache-includes');
|
||||
}
|
||||
exports.getCacheIncludes = getCacheIncludes;
|
||||
function getCacheExcludes() {
|
||||
return core.getMultilineInput('gradle-home-cache-excludes');
|
||||
}
|
||||
exports.getCacheExcludes = getCacheExcludes;
|
||||
function getBuildRootDirectory() {
|
||||
return core.getInput('build-root-directory');
|
||||
}
|
||||
exports.getBuildRootDirectory = getBuildRootDirectory;
|
||||
function getGradleVersion() {
|
||||
return core.getInput('gradle-version');
|
||||
}
|
||||
exports.getGradleVersion = getGradleVersion;
|
||||
function getGradleExecutable() {
|
||||
return core.getInput('gradle-executable');
|
||||
}
|
||||
exports.getGradleExecutable = getGradleExecutable;
|
||||
function getArguments() {
|
||||
const input = core.getInput('arguments');
|
||||
return (0, string_argv_1.parseArgsStringToArgv)(input);
|
||||
}
|
||||
exports.getArguments = getArguments;
|
||||
function getJobContext() {
|
||||
return core.getInput('workflow-job-context');
|
||||
}
|
||||
exports.getJobContext = getJobContext;
|
||||
function getGithubToken() {
|
||||
return core.getInput('github-token', { required: true });
|
||||
}
|
||||
exports.getGithubToken = getGithubToken;
|
||||
function isJobSummaryEnabled() {
|
||||
return getBooleanInput('generate-job-summary', true);
|
||||
}
|
||||
exports.isJobSummaryEnabled = isJobSummaryEnabled;
|
||||
function getBooleanInput(paramName, paramDefault = false) {
|
||||
const paramValue = core.getInput(paramName);
|
||||
switch (paramValue.toLowerCase().trim()) {
|
||||
case '':
|
||||
return paramDefault;
|
||||
case 'false':
|
||||
return false;
|
||||
case 'true':
|
||||
return true;
|
||||
}
|
||||
throw TypeError(`The value '${paramValue} is not valid for '${paramName}. Valid values are: [true, false]`);
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7345:
|
||||
@@ -64070,6 +64173,55 @@ function handleFailure(error) {
|
||||
run();
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8182:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.buildRootDirectory = exports.workspaceDirectory = void 0;
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
function workspaceDirectory() {
|
||||
return process.env[`GITHUB_WORKSPACE`] || '';
|
||||
}
|
||||
exports.workspaceDirectory = workspaceDirectory;
|
||||
function buildRootDirectory() {
|
||||
const baseDirectory = workspaceDirectory();
|
||||
const buildRootDirectoryInput = params.getBuildRootDirectory();
|
||||
const resolvedBuildRootDirectory = buildRootDirectoryInput === ''
|
||||
? path.resolve(baseDirectory)
|
||||
: path.resolve(baseDirectory, buildRootDirectoryInput);
|
||||
return resolvedBuildRootDirectory;
|
||||
}
|
||||
exports.buildRootDirectory = buildRootDirectory;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8652:
|
||||
@@ -64117,6 +64269,8 @@ const summary_1 = __nccwpck_require__(1327);
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const os = __importStar(__nccwpck_require__(2037));
|
||||
const caches = __importStar(__nccwpck_require__(3800));
|
||||
const layout = __importStar(__nccwpck_require__(8182));
|
||||
const params = __importStar(__nccwpck_require__(3885));
|
||||
const job_summary_1 = __nccwpck_require__(7345);
|
||||
const build_results_1 = __nccwpck_require__(2107);
|
||||
const cache_reporting_1 = __nccwpck_require__(6674);
|
||||
@@ -64124,16 +64278,9 @@ const daemon_controller_1 = __nccwpck_require__(5146);
|
||||
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED';
|
||||
const GRADLE_USER_HOME = 'GRADLE_USER_HOME';
|
||||
const CACHE_LISTENER = 'CACHE_LISTENER';
|
||||
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary';
|
||||
function shouldGenerateJobSummary() {
|
||||
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
|
||||
return false;
|
||||
}
|
||||
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER);
|
||||
}
|
||||
function setup(buildRootDirectory) {
|
||||
function setup() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const gradleUserHome = yield determineGradleUserHome(buildRootDirectory);
|
||||
const gradleUserHome = yield determineGradleUserHome();
|
||||
if (process.env[GRADLE_SETUP_VAR]) {
|
||||
core.info('Gradle setup only performed on first gradle-build-action step in workflow.');
|
||||
return;
|
||||
@@ -64168,10 +64315,11 @@ function complete() {
|
||||
});
|
||||
}
|
||||
exports.complete = complete;
|
||||
function determineGradleUserHome(rootDir) {
|
||||
function determineGradleUserHome() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const customGradleUserHome = process.env['GRADLE_USER_HOME'];
|
||||
if (customGradleUserHome) {
|
||||
const rootDir = layout.workspaceDirectory();
|
||||
return path.resolve(rootDir, customGradleUserHome);
|
||||
}
|
||||
return path.resolve(yield determineUserHome(), '.gradle');
|
||||
@@ -64191,6 +64339,12 @@ function determineUserHome() {
|
||||
return userHome;
|
||||
});
|
||||
}
|
||||
function shouldGenerateJobSummary() {
|
||||
if (!process.env[summary_1.SUMMARY_ENV_VAR]) {
|
||||
return false;
|
||||
}
|
||||
return params.isJobSummaryEnabled();
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -64353,6 +64507,59 @@ module.exports = require("util");
|
||||
"use strict";
|
||||
module.exports = require("zlib");
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9663:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
exports.parseArgsStringToArgv = void 0;
|
||||
function parseArgsStringToArgv(value, env, file) {
|
||||
// ([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*) Matches nested quotes until the first space outside of quotes
|
||||
// [^\s'"]+ or Match if not a space ' or "
|
||||
// (['"])([^\5]*?)\5 or Match "quoted text" without quotes
|
||||
// `\3` and `\5` are a backreference to the quote style (' or ") captured
|
||||
var myRegexp = /([^\s'"]([^\s'"]*(['"])([^\3]*?)\3)+[^\s'"]*)|[^\s'"]+|(['"])([^\5]*?)\5/gi;
|
||||
var myString = value;
|
||||
var myArray = [];
|
||||
if (env) {
|
||||
myArray.push(env);
|
||||
}
|
||||
if (file) {
|
||||
myArray.push(file);
|
||||
}
|
||||
var match;
|
||||
do {
|
||||
// Each call to exec returns the next regex match as an array
|
||||
match = myRegexp.exec(myString);
|
||||
if (match !== null) {
|
||||
// Index 1 in the array is the captured group if it exists
|
||||
// Index 0 is the matched text, which we use if no captured group exists
|
||||
myArray.push(firstString(match[1], match[6], match[0]));
|
||||
}
|
||||
} while (match !== null);
|
||||
return myArray;
|
||||
}
|
||||
exports["default"] = parseArgsStringToArgv;
|
||||
exports.parseArgsStringToArgv = parseArgsStringToArgv;
|
||||
// Accepts any number of arguments, and returns the first one that is a string
|
||||
// (even an empty string)
|
||||
function firstString() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
var arg = args[i];
|
||||
if (typeof arg === "string") {
|
||||
return arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3765:
|
||||
|
2
dist/post/index.js.map
vendored
2
dist/post/index.js.map
vendored
File diff suppressed because one or more lines are too long
918
package-lock.json
generated
918
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@@ -8,7 +8,13 @@
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format-check": "prettier --check **/*.ts",
|
||||
"lint": "eslint src/**/*.ts",
|
||||
"compile": "ncc build src/main.ts --out dist/main --source-map --no-source-map-register && ncc build src/post.ts --out dist/post --source-map --no-source-map-register",
|
||||
|
||||
"compile-main": "ncc build src/main.ts --out dist/main --source-map --no-source-map-register",
|
||||
"compile-post": "ncc build src/post.ts --out dist/post --source-map --no-source-map-register",
|
||||
"compile-dependency-graph-generate": "ncc build src/dependency-graph-generate.ts --out dist/dependency-graph-generate --source-map --no-source-map-register",
|
||||
"compile-dependency-graph-submit": "ncc build src/dependency-graph-submit.ts --out dist/dependency-graph-submit --source-map --no-source-map-register",
|
||||
"compile": "npm run compile-main && npm run compile-post && npm run compile-dependency-graph-generate && npm run compile-dependency-graph-submit",
|
||||
|
||||
"test": "jest",
|
||||
"check": "npm run format && npm run lint",
|
||||
"build": "npm run check && npm run compile",
|
||||
@@ -26,6 +32,7 @@
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/artifact": "1.1.1",
|
||||
"@actions/cache": "3.2.1",
|
||||
"@actions/core": "1.10.0",
|
||||
"@actions/exec": "1.1.1",
|
||||
@@ -33,22 +40,23 @@
|
||||
"@actions/glob": "0.4.0",
|
||||
"@actions/http-client": "2.1.0",
|
||||
"@actions/tool-cache": "2.0.1",
|
||||
"string-argv": "0.3.1"
|
||||
"@octokit/rest": "19.0.11",
|
||||
"string-argv": "0.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "16.11.21",
|
||||
"@types/jest": "29.5.0",
|
||||
"@types/unzipper": "0.10.5",
|
||||
"@typescript-eslint/parser": "5.58.0",
|
||||
"@types/jest": "29.5.2",
|
||||
"@types/unzipper": "0.10.6",
|
||||
"@typescript-eslint/parser": "5.60.1",
|
||||
"@vercel/ncc": "0.36.1",
|
||||
"eslint": "8.38.0",
|
||||
"eslint-plugin-github": "4.7.0",
|
||||
"eslint": "8.43.0",
|
||||
"eslint-plugin-github": "4.8.0",
|
||||
"eslint-plugin-jest": "27.2.1",
|
||||
"jest": "29.5.0",
|
||||
"js-yaml": "4.1.0",
|
||||
"patch-package": "6.5.1",
|
||||
"prettier": "2.8.7",
|
||||
"patch-package": "7.0.0",
|
||||
"prettier": "2.8.8",
|
||||
"ts-jest": "29.1.0",
|
||||
"typescript": "5.0.4"
|
||||
"typescript": "5.1.5"
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,7 @@ import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import path from 'path'
|
||||
import fs from 'fs'
|
||||
import * as params from './input-params'
|
||||
import {CacheListener} from './cache-reporting'
|
||||
import {saveCache, restoreCache, cacheDebug, isCacheDebuggingEnabled, tryDelete, generateCacheKey} from './cache-utils'
|
||||
import {GradleHomeEntryExtractor} from './cache-extract-entries'
|
||||
@@ -9,8 +10,6 @@ import {GradleHomeEntryExtractor} from './cache-extract-entries'
|
||||
const RESTORED_CACHE_KEY_KEY = 'restored-cache-key'
|
||||
|
||||
export const META_FILE_DIR = '.gradle-build-action'
|
||||
const INCLUDE_PATHS_PARAMETER = 'gradle-home-cache-includes'
|
||||
const EXCLUDE_PATHS_PARAMETER = 'gradle-home-cache-excludes'
|
||||
|
||||
export class GradleStateCache {
|
||||
private cacheName: string
|
||||
@@ -142,7 +141,7 @@ export class GradleStateCache {
|
||||
* Delete any file paths that are excluded by the `gradle-home-cache-excludes` parameter.
|
||||
*/
|
||||
private deleteExcludedPaths(): void {
|
||||
const rawPaths: string[] = core.getMultilineInput(EXCLUDE_PATHS_PARAMETER)
|
||||
const rawPaths: string[] = params.getCacheExcludes()
|
||||
const resolvedPaths = rawPaths.map(x => path.resolve(this.gradleUserHome, x))
|
||||
|
||||
for (const p of resolvedPaths) {
|
||||
@@ -157,7 +156,7 @@ export class GradleStateCache {
|
||||
* but this can be overridden by the `gradle-home-cache-includes` parameter.
|
||||
*/
|
||||
protected getCachePath(): string[] {
|
||||
const rawPaths: string[] = core.getMultilineInput(INCLUDE_PATHS_PARAMETER)
|
||||
const rawPaths: string[] = params.getCacheIncludes()
|
||||
rawPaths.push(META_FILE_DIR)
|
||||
const resolvedPaths = rawPaths.map(x => this.resolveCachePath(x))
|
||||
cacheDebug(`Using cache paths: ${resolvedPaths}`)
|
||||
|
@@ -3,17 +3,11 @@ import fs from 'fs'
|
||||
import * as core from '@actions/core'
|
||||
import * as glob from '@actions/glob'
|
||||
|
||||
import * as params from './input-params'
|
||||
|
||||
import {META_FILE_DIR} from './cache-base'
|
||||
import {CacheEntryListener, CacheListener} from './cache-reporting'
|
||||
import {
|
||||
cacheDebug,
|
||||
getCacheKeyPrefix,
|
||||
hashFileNames,
|
||||
isCacheDebuggingEnabled,
|
||||
restoreCache,
|
||||
saveCache,
|
||||
tryDelete
|
||||
} from './cache-utils'
|
||||
import {cacheDebug, getCacheKeyPrefix, hashFileNames, restoreCache, saveCache, tryDelete} from './cache-utils'
|
||||
import {loadBuildResults} from './build-results'
|
||||
|
||||
const SKIP_RESTORE_VAR = 'GRADLE_BUILD_ACTION_SKIP_RESTORE'
|
||||
@@ -246,7 +240,7 @@ abstract class AbstractEntryExtractor {
|
||||
|
||||
// Run actions sequentially if debugging is enabled
|
||||
private async awaitForDebugging(p: Promise<ExtractedCacheEntry>): Promise<ExtractedCacheEntry> {
|
||||
if (isCacheDebuggingEnabled()) {
|
||||
if (params.isCacheDebuggingEnabled()) {
|
||||
await p
|
||||
}
|
||||
return p
|
||||
|
@@ -7,17 +7,11 @@ import * as crypto from 'crypto'
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs'
|
||||
|
||||
import * as params from './input-params'
|
||||
|
||||
import {CacheEntryListener} from './cache-reporting'
|
||||
|
||||
const CACHE_PROTOCOL_VERSION = 'v7-'
|
||||
|
||||
const JOB_CONTEXT_PARAMETER = 'workflow-job-context'
|
||||
const CACHE_DISABLED_PARAMETER = 'cache-disabled'
|
||||
const CACHE_READONLY_PARAMETER = 'cache-read-only'
|
||||
const CACHE_WRITEONLY_PARAMETER = 'cache-write-only'
|
||||
const STRICT_CACHE_MATCH_PARAMETER = 'gradle-home-cache-strict-match'
|
||||
const CACHE_CLEANUP_ENABLED_PARAMETER = 'gradle-home-cache-cleanup'
|
||||
const CACHE_DEBUG_VAR = 'GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'
|
||||
const CACHE_PROTOCOL_VERSION = 'v8-'
|
||||
|
||||
const CACHE_KEY_PREFIX_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX'
|
||||
const CACHE_KEY_OS_VAR = 'GRADLE_BUILD_ACTION_CACHE_KEY_ENVIRONMENT'
|
||||
@@ -32,23 +26,23 @@ export function isCacheDisabled(): boolean {
|
||||
if (!cache.isFeatureAvailable()) {
|
||||
return true
|
||||
}
|
||||
return core.getBooleanInput(CACHE_DISABLED_PARAMETER)
|
||||
return params.isCacheDisabled()
|
||||
}
|
||||
|
||||
export function isCacheReadOnly(): boolean {
|
||||
return !isCacheWriteOnly() && core.getBooleanInput(CACHE_READONLY_PARAMETER)
|
||||
return !isCacheWriteOnly() && params.isCacheReadOnly()
|
||||
}
|
||||
|
||||
export function isCacheWriteOnly(): boolean {
|
||||
return core.getBooleanInput(CACHE_WRITEONLY_PARAMETER)
|
||||
return params.isCacheWriteOnly()
|
||||
}
|
||||
|
||||
export function isCacheDebuggingEnabled(): boolean {
|
||||
return process.env[CACHE_DEBUG_VAR] ? true : false
|
||||
return params.isCacheDebuggingEnabled()
|
||||
}
|
||||
|
||||
export function isCacheCleanupEnabled(): boolean {
|
||||
return core.getBooleanInput(CACHE_CLEANUP_ENABLED_PARAMETER)
|
||||
return params.isCacheCleanupEnabled()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,7 +91,7 @@ export function generateCacheKey(cacheName: string): CacheKey {
|
||||
// Exact match on Git SHA
|
||||
const cacheKey = `${cacheKeyForJobContext}-${getCacheKeyJobExecution()}`
|
||||
|
||||
if (core.getBooleanInput(STRICT_CACHE_MATCH_PARAMETER)) {
|
||||
if (params.isCacheStrictMatch()) {
|
||||
return new CacheKey(cacheKey, [cacheKeyForJobContext])
|
||||
}
|
||||
|
||||
@@ -115,8 +109,12 @@ function getCacheKeyEnvironment(): string {
|
||||
}
|
||||
|
||||
function getCacheKeyJob(): string {
|
||||
// Prefix can be used to force change all cache keys (defaults to cache protocol version)
|
||||
return process.env[CACHE_KEY_JOB_VAR] || github.context.job
|
||||
return process.env[CACHE_KEY_JOB_VAR] || getCacheKeyForJob(github.context.workflow, github.context.job)
|
||||
}
|
||||
|
||||
export function getCacheKeyForJob(workflowName: string, jobId: string): string {
|
||||
const sanitizedWorkflow = workflowName.replace(/,/g, '').toLowerCase()
|
||||
return `${sanitizedWorkflow}-${jobId}`
|
||||
}
|
||||
|
||||
function getCacheKeyJobInstance(): string {
|
||||
@@ -127,7 +125,7 @@ function getCacheKeyJobInstance(): string {
|
||||
|
||||
// By default, we hash the full `matrix` data for the run, to uniquely identify this job invocation
|
||||
// The only way we can obtain the `matrix` data is via the `workflow-job-context` parameter in action.yml.
|
||||
const workflowJobContext = core.getInput(JOB_CONTEXT_PARAMETER)
|
||||
const workflowJobContext = params.getJobContext()
|
||||
return hashStrings([workflowJobContext])
|
||||
}
|
||||
|
||||
|
24
src/dependency-graph-generate.ts
Normal file
24
src/dependency-graph-generate.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as core from '@actions/core'
|
||||
|
||||
import * as provisioner from './provision'
|
||||
import * as dependencyGraph from './dependency-graph'
|
||||
|
||||
/**
|
||||
* The main entry point for the action, called by Github Actions for the step.
|
||||
*/
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
// Download and install Gradle if required
|
||||
const executable = await provisioner.provisionGradle()
|
||||
|
||||
// Generate and upload dependency graph artifact
|
||||
await dependencyGraph.generateDependencyGraph(executable)
|
||||
} catch (error) {
|
||||
core.setFailed(String(error))
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.info(error.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
16
src/dependency-graph-submit.ts
Normal file
16
src/dependency-graph-submit.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as dependencyGraph from './dependency-graph'
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
// Retrieve the dependency graph artifact and submit via Dependency Submission API
|
||||
await dependencyGraph.submitDependencyGraph()
|
||||
} catch (error) {
|
||||
core.setFailed(String(error))
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.info(error.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
155
src/dependency-graph.ts
Normal file
155
src/dependency-graph.ts
Normal file
@@ -0,0 +1,155 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as artifact from '@actions/artifact'
|
||||
import * as github from '@actions/github'
|
||||
import * as glob from '@actions/glob'
|
||||
import * as toolCache from '@actions/tool-cache'
|
||||
import {Octokit} from '@octokit/rest'
|
||||
|
||||
import * as path from 'path'
|
||||
import fs from 'fs'
|
||||
|
||||
import * as execution from './execution'
|
||||
import * as layout from './repository-layout'
|
||||
|
||||
const DEPENDENCY_GRAPH_ARTIFACT = 'dependency-graph'
|
||||
const DEPENDENCY_GRAPH_FILE = 'dependency-graph.json'
|
||||
|
||||
export async function generateDependencyGraph(executable: string | undefined): Promise<void> {
|
||||
const workspaceDirectory = layout.workspaceDirectory()
|
||||
const buildRootDirectory = layout.buildRootDirectory()
|
||||
const buildPath = getRelativePathFromWorkspace(buildRootDirectory)
|
||||
|
||||
const initScript = path.resolve(
|
||||
__dirname,
|
||||
'..',
|
||||
'..',
|
||||
'src',
|
||||
'resources',
|
||||
'init-scripts',
|
||||
'github-dependency-graph.init.gradle'
|
||||
)
|
||||
const args = [
|
||||
`-Dorg.gradle.github.env.GRADLE_BUILD_PATH=${buildPath}`,
|
||||
'--init-script',
|
||||
initScript,
|
||||
':GitHubDependencyGraphPlugin_generateDependencyGraph'
|
||||
]
|
||||
|
||||
await execution.executeGradleBuild(executable, buildRootDirectory, args)
|
||||
const dependencyGraphJson = copyDependencyGraphToBuildRoot(buildRootDirectory)
|
||||
|
||||
const artifactClient = artifact.create()
|
||||
artifactClient.uploadArtifact(DEPENDENCY_GRAPH_ARTIFACT, [dependencyGraphJson], workspaceDirectory)
|
||||
}
|
||||
|
||||
function copyDependencyGraphToBuildRoot(buildRootDirectory: string): string {
|
||||
const sourceFile = path.resolve(
|
||||
buildRootDirectory,
|
||||
'build',
|
||||
'reports',
|
||||
'github-dependency-graph-plugin',
|
||||
'github-dependency-snapshot.json'
|
||||
)
|
||||
|
||||
const destFile = path.resolve(buildRootDirectory, DEPENDENCY_GRAPH_FILE)
|
||||
fs.copyFileSync(sourceFile, destFile)
|
||||
return destFile
|
||||
}
|
||||
|
||||
export async function submitDependencyGraph(): Promise<void> {
|
||||
const workspaceDirectory = layout.workspaceDirectory()
|
||||
const octokit: Octokit = getOctokit()
|
||||
|
||||
for (const jsonFile of await retrieveDependencyGraphs(octokit, workspaceDirectory)) {
|
||||
const jsonContent = fs.readFileSync(jsonFile, 'utf8')
|
||||
|
||||
const jsonObject = JSON.parse(jsonContent)
|
||||
jsonObject.owner = github.context.repo.owner
|
||||
jsonObject.repo = github.context.repo.repo
|
||||
const response = await octokit.request('POST /repos/{owner}/{repo}/dependency-graph/snapshots', jsonObject)
|
||||
|
||||
const relativeJsonFile = getRelativePathFromWorkspace(jsonFile)
|
||||
core.info(`Submitted ${relativeJsonFile}: ${JSON.stringify(response)}`)
|
||||
core.notice(`Submitted ${relativeJsonFile}: ${response.data.message}`)
|
||||
}
|
||||
}
|
||||
|
||||
async function findDependencyGraphFiles(dir: string): Promise<string[]> {
|
||||
const globber = await glob.create(`${dir}/**/${DEPENDENCY_GRAPH_FILE}`)
|
||||
const graphFiles = globber.glob()
|
||||
core.info(`Found graph files in ${dir}: ${graphFiles}`)
|
||||
return graphFiles
|
||||
}
|
||||
|
||||
async function retrieveDependencyGraphs(octokit: Octokit, workspaceDirectory: string): Promise<string[]> {
|
||||
if (github.context.payload.workflow_run) {
|
||||
return await retrieveDependencyGraphsForWorkflowRun(
|
||||
github.context.payload.workflow_run.id,
|
||||
octokit,
|
||||
workspaceDirectory
|
||||
)
|
||||
}
|
||||
return retrieveDependencyGraphsForCurrentWorkflow(workspaceDirectory)
|
||||
}
|
||||
|
||||
async function retrieveDependencyGraphsForWorkflowRun(
|
||||
runId: number,
|
||||
octokit: Octokit,
|
||||
workspaceDirectory: string
|
||||
): Promise<string[]> {
|
||||
// Find the workflow run artifacts named "dependency-graph"
|
||||
const artifacts = await octokit.rest.actions.listWorkflowRunArtifacts({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
run_id: runId
|
||||
})
|
||||
|
||||
const matchArtifact = artifacts.data.artifacts.find(candidate => {
|
||||
return candidate.name === DEPENDENCY_GRAPH_ARTIFACT
|
||||
})
|
||||
|
||||
if (matchArtifact === undefined) {
|
||||
throw new Error(`Dependency graph artifact not found. Has it been generated by workflow run '${runId}'?`)
|
||||
}
|
||||
|
||||
// Download the dependency-graph artifact
|
||||
const download = await octokit.rest.actions.downloadArtifact({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
artifact_id: matchArtifact.id,
|
||||
archive_format: 'zip'
|
||||
})
|
||||
|
||||
const downloadBuffer = download.data as ArrayBuffer
|
||||
const downloadZip = path.resolve(workspaceDirectory, 'dependency-graph.zip')
|
||||
fs.writeFileSync(downloadZip, Buffer.from(downloadBuffer))
|
||||
|
||||
// Expance the dependency-graph zip and locate each dependency-graph JSON file
|
||||
const extractDir = path.resolve(workspaceDirectory, 'dependency-graph')
|
||||
const extracted = await toolCache.extractZip(downloadZip, extractDir)
|
||||
core.info(`Extracted dependency graph artifacts to ${extracted}: ${fs.readdirSync(extracted)}`)
|
||||
|
||||
return findDependencyGraphFiles(extracted)
|
||||
}
|
||||
|
||||
async function retrieveDependencyGraphsForCurrentWorkflow(workspaceDirectory: string): Promise<string[]> {
|
||||
const artifactClient = artifact.create()
|
||||
const downloadPath = path.resolve(workspaceDirectory, 'dependency-graph')
|
||||
await artifactClient.downloadArtifact(DEPENDENCY_GRAPH_ARTIFACT, downloadPath)
|
||||
return await findDependencyGraphFiles(downloadPath)
|
||||
}
|
||||
|
||||
function getOctokit(): Octokit {
|
||||
return new Octokit({
|
||||
auth: getGithubToken()
|
||||
})
|
||||
}
|
||||
|
||||
function getGithubToken(): string {
|
||||
return core.getInput('github-token', {required: true})
|
||||
}
|
||||
|
||||
function getRelativePathFromWorkspace(file: string): string {
|
||||
const workspaceDirectory = layout.workspaceDirectory()
|
||||
return path.relative(workspaceDirectory, file)
|
||||
}
|
77
src/input-params.ts
Normal file
77
src/input-params.ts
Normal file
@@ -0,0 +1,77 @@
|
||||
import * as core from '@actions/core'
|
||||
import {parseArgsStringToArgv} from 'string-argv'
|
||||
|
||||
export function isCacheDisabled(): boolean {
|
||||
return getBooleanInput('cache-disabled')
|
||||
}
|
||||
|
||||
export function isCacheReadOnly(): boolean {
|
||||
return getBooleanInput('cache-read-only')
|
||||
}
|
||||
|
||||
export function isCacheWriteOnly(): boolean {
|
||||
return getBooleanInput('cache-write-only')
|
||||
}
|
||||
|
||||
export function isCacheStrictMatch(): boolean {
|
||||
return getBooleanInput('gradle-home-cache-strict-match')
|
||||
}
|
||||
|
||||
export function isCacheDebuggingEnabled(): boolean {
|
||||
return process.env['GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED'] ? true : false
|
||||
}
|
||||
|
||||
export function isCacheCleanupEnabled(): boolean {
|
||||
return getBooleanInput('gradle-home-cache-cleanup')
|
||||
}
|
||||
|
||||
export function getCacheIncludes(): string[] {
|
||||
return core.getMultilineInput('gradle-home-cache-includes')
|
||||
}
|
||||
|
||||
export function getCacheExcludes(): string[] {
|
||||
return core.getMultilineInput('gradle-home-cache-excludes')
|
||||
}
|
||||
|
||||
export function getBuildRootDirectory(): string {
|
||||
return core.getInput('build-root-directory')
|
||||
}
|
||||
|
||||
export function getGradleVersion(): string {
|
||||
return core.getInput('gradle-version')
|
||||
}
|
||||
|
||||
export function getGradleExecutable(): string {
|
||||
return core.getInput('gradle-executable')
|
||||
}
|
||||
|
||||
export function getArguments(): string[] {
|
||||
const input = core.getInput('arguments')
|
||||
return parseArgsStringToArgv(input)
|
||||
}
|
||||
|
||||
// Internal parameters
|
||||
export function getJobContext(): string {
|
||||
return core.getInput('workflow-job-context')
|
||||
}
|
||||
|
||||
export function getGithubToken(): string {
|
||||
return core.getInput('github-token', {required: true})
|
||||
}
|
||||
|
||||
export function isJobSummaryEnabled(): boolean {
|
||||
return getBooleanInput('generate-job-summary', true)
|
||||
}
|
||||
|
||||
function getBooleanInput(paramName: string, paramDefault = false): boolean {
|
||||
const paramValue = core.getInput(paramName)
|
||||
switch (paramValue.toLowerCase().trim()) {
|
||||
case '':
|
||||
return paramDefault
|
||||
case 'false':
|
||||
return false
|
||||
case 'true':
|
||||
return true
|
||||
}
|
||||
throw TypeError(`The value '${paramValue} is not valid for '${paramName}. Valid values are: [true, false]`)
|
||||
}
|
48
src/main.ts
48
src/main.ts
@@ -1,30 +1,26 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as path from 'path'
|
||||
import {parseArgsStringToArgv} from 'string-argv'
|
||||
|
||||
import * as setupGradle from './setup-gradle'
|
||||
import * as execution from './execution'
|
||||
import * as provision from './provision'
|
||||
import * as provisioner from './provision'
|
||||
import * as layout from './repository-layout'
|
||||
import * as params from './input-params'
|
||||
|
||||
/**
|
||||
* The main entry point for the action, called by Github Actions for the step.
|
||||
*/
|
||||
export async function run(): Promise<void> {
|
||||
try {
|
||||
const workspaceDirectory = process.env[`GITHUB_WORKSPACE`] || ''
|
||||
const buildRootDirectory = resolveBuildRootDirectory(workspaceDirectory)
|
||||
// Configure Gradle environment (Gradle User Home)
|
||||
await setupGradle.setup()
|
||||
|
||||
await setupGradle.setup(buildRootDirectory)
|
||||
|
||||
const executable = await provisionGradle(workspaceDirectory)
|
||||
// executable will be undefined if using Gradle wrapper
|
||||
if (executable !== undefined) {
|
||||
core.addPath(path.dirname(executable))
|
||||
}
|
||||
// Download and install Gradle if required
|
||||
const executable = await provisioner.provisionGradle()
|
||||
|
||||
// Only execute if arguments have been provided
|
||||
const args: string[] = parseCommandLineArguments()
|
||||
const args: string[] = params.getArguments()
|
||||
if (args.length > 0) {
|
||||
const buildRootDirectory = layout.buildRootDirectory()
|
||||
await execution.executeGradleBuild(executable, buildRootDirectory, args)
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -36,29 +32,3 @@ export async function run(): Promise<void> {
|
||||
}
|
||||
|
||||
run()
|
||||
|
||||
async function provisionGradle(workspaceDirectory: string): Promise<string | undefined> {
|
||||
const gradleVersion = core.getInput('gradle-version')
|
||||
if (gradleVersion !== '' && gradleVersion !== 'wrapper') {
|
||||
return path.resolve(await provision.gradleVersion(gradleVersion))
|
||||
}
|
||||
|
||||
const gradleExecutable = core.getInput('gradle-executable')
|
||||
if (gradleExecutable !== '') {
|
||||
return path.resolve(workspaceDirectory, gradleExecutable)
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
function resolveBuildRootDirectory(baseDirectory: string): string {
|
||||
const buildRootDirectory = core.getInput('build-root-directory')
|
||||
const resolvedBuildRootDirectory =
|
||||
buildRootDirectory === '' ? path.resolve(baseDirectory) : path.resolve(baseDirectory, buildRootDirectory)
|
||||
return resolvedBuildRootDirectory
|
||||
}
|
||||
|
||||
function parseCommandLineArguments(): string[] {
|
||||
const input = core.getInput('arguments')
|
||||
return parseArgsStringToArgv(input)
|
||||
}
|
||||
|
@@ -7,14 +7,37 @@ import * as cache from '@actions/cache'
|
||||
import * as toolCache from '@actions/tool-cache'
|
||||
|
||||
import * as gradlew from './gradlew'
|
||||
import * as params from './input-params'
|
||||
import * as layout from './repository-layout'
|
||||
import {handleCacheFailure, isCacheDisabled, isCacheReadOnly} from './cache-utils'
|
||||
|
||||
const gradleVersionsBaseUrl = 'https://services.gradle.org/versions'
|
||||
|
||||
/**
|
||||
* @return Gradle executable path
|
||||
* Install any configured version of Gradle, adding the executable to the PATH.
|
||||
* @return Installed Gradle executable or undefined if no version configured.
|
||||
*/
|
||||
export async function gradleVersion(version: string): Promise<string> {
|
||||
export async function provisionGradle(): Promise<string | undefined> {
|
||||
const gradleVersion = params.getGradleVersion()
|
||||
if (gradleVersion !== '' && gradleVersion !== 'wrapper') {
|
||||
return addToPath(path.resolve(await installGradle(gradleVersion)))
|
||||
}
|
||||
|
||||
const gradleExecutable = params.getGradleExecutable()
|
||||
if (gradleExecutable !== '') {
|
||||
const workspaceDirectory = layout.workspaceDirectory()
|
||||
return addToPath(path.resolve(workspaceDirectory, gradleExecutable))
|
||||
}
|
||||
|
||||
return undefined
|
||||
}
|
||||
|
||||
async function addToPath(executable: string): Promise<string> {
|
||||
core.addPath(path.dirname(executable))
|
||||
return executable
|
||||
}
|
||||
|
||||
async function installGradle(version: string): Promise<string> {
|
||||
switch (version) {
|
||||
case 'current':
|
||||
return gradleCurrent()
|
||||
@@ -34,13 +57,13 @@ export async function gradleVersion(version: string): Promise<string> {
|
||||
|
||||
async function gradleCurrent(): Promise<string> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/current`)
|
||||
return provisionGradle(versionInfo)
|
||||
return installGradleVersion(versionInfo)
|
||||
}
|
||||
|
||||
async function gradleReleaseCandidate(): Promise<string> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-candidate`)
|
||||
if (versionInfo && versionInfo.version && versionInfo.downloadUrl) {
|
||||
return provisionGradle(versionInfo)
|
||||
return installGradleVersion(versionInfo)
|
||||
}
|
||||
core.info('No current release-candidate found, will fallback to current')
|
||||
return gradleCurrent()
|
||||
@@ -48,12 +71,12 @@ async function gradleReleaseCandidate(): Promise<string> {
|
||||
|
||||
async function gradleNightly(): Promise<string> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/nightly`)
|
||||
return provisionGradle(versionInfo)
|
||||
return installGradleVersion(versionInfo)
|
||||
}
|
||||
|
||||
async function gradleReleaseNightly(): Promise<string> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-nightly`)
|
||||
return provisionGradle(versionInfo)
|
||||
return installGradleVersion(versionInfo)
|
||||
}
|
||||
|
||||
async function gradle(version: string): Promise<string> {
|
||||
@@ -61,7 +84,7 @@ async function gradle(version: string): Promise<string> {
|
||||
if (!versionInfo) {
|
||||
throw new Error(`Gradle version ${version} does not exists`)
|
||||
}
|
||||
return provisionGradle(versionInfo)
|
||||
return installGradleVersion(versionInfo)
|
||||
}
|
||||
|
||||
async function gradleVersionDeclaration(url: string): Promise<GradleVersionInfo> {
|
||||
@@ -75,7 +98,7 @@ async function findGradleVersionDeclaration(version: string): Promise<GradleVers
|
||||
})
|
||||
}
|
||||
|
||||
async function provisionGradle(versionInfo: GradleVersionInfo): Promise<string> {
|
||||
async function installGradleVersion(versionInfo: GradleVersionInfo): Promise<string> {
|
||||
return core.group(`Provision Gradle ${versionInfo.version}`, async () => {
|
||||
return locateGradleAndDownloadIfRequired(versionInfo)
|
||||
})
|
||||
|
16
src/repository-layout.ts
Normal file
16
src/repository-layout.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import * as params from './input-params'
|
||||
import * as path from 'path'
|
||||
|
||||
export function workspaceDirectory(): string {
|
||||
return process.env[`GITHUB_WORKSPACE`] || ''
|
||||
}
|
||||
|
||||
export function buildRootDirectory(): string {
|
||||
const baseDirectory = workspaceDirectory()
|
||||
const buildRootDirectoryInput = params.getBuildRootDirectory()
|
||||
const resolvedBuildRootDirectory =
|
||||
buildRootDirectoryInput === ''
|
||||
? path.resolve(baseDirectory)
|
||||
: path.resolve(baseDirectory, buildRootDirectoryInput)
|
||||
return resolvedBuildRootDirectory
|
||||
}
|
@@ -16,26 +16,29 @@ if (isTopLevelBuild) {
|
||||
if (atLeastGradle6) {
|
||||
def useBuildService = version >= GradleVersion.version("6.6")
|
||||
settingsEvaluated { settings ->
|
||||
// The `buildScanPublished` hook is the only way to capture the build scan URI.
|
||||
if (settings.pluginManager.hasPlugin("com.gradle.enterprise")) {
|
||||
captureUsingBuildScanPublished(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject, invocationId)
|
||||
}
|
||||
// We also need to add hooks in case the plugin is applied but no build scan is published
|
||||
// The `buildScanPublished` results will NOT be overwritten by these calls
|
||||
// By default, use standard mechanisms to capture build results
|
||||
if (useBuildService) {
|
||||
captureUsingBuildService(settings, invocationId)
|
||||
} else {
|
||||
captureUsingBuildFinished(gradle, invocationId)
|
||||
}
|
||||
|
||||
// The `buildScanPublished` hook allows the capture of the build scan URI.
|
||||
// Results captured this way will overwrite any results from the other mechanism.
|
||||
settings.pluginManager.withPlugin("com.gradle.enterprise") {
|
||||
captureUsingBuildScanPublished(settings.extensions["gradleEnterprise"].buildScan, settings.rootProject, invocationId)
|
||||
}
|
||||
}
|
||||
} else if (atLeastGradle3) {
|
||||
projectsEvaluated { gradle ->
|
||||
if (gradle.rootProject.pluginManager.hasPlugin("com.gradle.build-scan")) {
|
||||
// By default, use 'buildFinished' to capture build results
|
||||
captureUsingBuildFinished(gradle, invocationId)
|
||||
|
||||
// The `buildScanPublished` hook allows the capture of the build scan URI.
|
||||
// Results captured this way will overwrite any results from 'buildFinished'.
|
||||
gradle.rootProject.pluginManager.withPlugin("com.gradle.build-scan") {
|
||||
captureUsingBuildScanPublished(gradle.rootProject.extensions["buildScan"], gradle.rootProject, invocationId)
|
||||
}
|
||||
// Always attempt to capture in buildFinished in case the plugin is applied but no build scan is published
|
||||
// The `buildScanPublished` results will NOT be overwritten by this call
|
||||
captureUsingBuildFinished(gradle, invocationId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,6 +73,7 @@ def captureUsingBuildScanPublished(buildScanExtension, rootProject, invocationId
|
||||
|
||||
def captureUsingBuildFinished(gradle, invocationId) {
|
||||
gradle.buildFinished { result ->
|
||||
println "Got buildFinished: ${result}"
|
||||
def buildResults = new BuildResults(invocationId, gradle, gradle.rootProject)
|
||||
buildResults.setBuildResult(result)
|
||||
buildResults.writeToResultsFile(false)
|
||||
|
@@ -0,0 +1,12 @@
|
||||
import org.gradle.github.GitHubDependencyGraphPlugin
|
||||
initscript {
|
||||
repositories {
|
||||
maven {
|
||||
url = uri("https://plugins.gradle.org/m2/")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("org.gradle:github-dependency-graph-gradle-plugin:+")
|
||||
}
|
||||
}
|
||||
apply plugin: GitHubDependencyGraphPlugin
|
@@ -4,6 +4,8 @@ import {SUMMARY_ENV_VAR} from '@actions/core/lib/summary'
|
||||
import * as path from 'path'
|
||||
import * as os from 'os'
|
||||
import * as caches from './caches'
|
||||
import * as layout from './repository-layout'
|
||||
import * as params from './input-params'
|
||||
|
||||
import {logJobSummary, writeJobSummary} from './job-summary'
|
||||
import {loadBuildResults} from './build-results'
|
||||
@@ -13,19 +15,9 @@ import {DaemonController} from './daemon-controller'
|
||||
const GRADLE_SETUP_VAR = 'GRADLE_BUILD_ACTION_SETUP_COMPLETED'
|
||||
const GRADLE_USER_HOME = 'GRADLE_USER_HOME'
|
||||
const CACHE_LISTENER = 'CACHE_LISTENER'
|
||||
const JOB_SUMMARY_ENABLED_PARAMETER = 'generate-job-summary'
|
||||
|
||||
function shouldGenerateJobSummary(): boolean {
|
||||
// Check if Job Summary is supported on this platform
|
||||
if (!process.env[SUMMARY_ENV_VAR]) {
|
||||
return false
|
||||
}
|
||||
|
||||
return core.getBooleanInput(JOB_SUMMARY_ENABLED_PARAMETER)
|
||||
}
|
||||
|
||||
export async function setup(buildRootDirectory: string): Promise<void> {
|
||||
const gradleUserHome = await determineGradleUserHome(buildRootDirectory)
|
||||
export async function setup(): Promise<void> {
|
||||
const gradleUserHome = await determineGradleUserHome()
|
||||
|
||||
// Bypass setup on all but first action step in workflow.
|
||||
if (process.env[GRADLE_SETUP_VAR]) {
|
||||
@@ -68,9 +60,10 @@ export async function complete(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
async function determineGradleUserHome(rootDir: string): Promise<string> {
|
||||
async function determineGradleUserHome(): Promise<string> {
|
||||
const customGradleUserHome = process.env['GRADLE_USER_HOME']
|
||||
if (customGradleUserHome) {
|
||||
const rootDir = layout.workspaceDirectory()
|
||||
return path.resolve(rootDir, customGradleUserHome)
|
||||
}
|
||||
|
||||
@@ -93,3 +86,12 @@ async function determineUserHome(): Promise<string> {
|
||||
core.debug(`Determined user.home from java -version output: '${userHome}'`)
|
||||
return userHome
|
||||
}
|
||||
|
||||
function shouldGenerateJobSummary(): boolean {
|
||||
// Check if Job Summary is supported on this platform
|
||||
if (!process.env[SUMMARY_ENV_VAR]) {
|
||||
return false
|
||||
}
|
||||
|
||||
return params.isJobSummaryEnabled()
|
||||
}
|
||||
|
@@ -20,8 +20,7 @@ dependencies {
|
||||
testImplementation ('io.ratpack:ratpack-groovy-test:1.9.0') {
|
||||
exclude group: 'org.codehaus.groovy', module: 'groovy-all'
|
||||
}
|
||||
testImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.14.2'
|
||||
|
||||
testImplementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-smile:2.15.2'
|
||||
}
|
||||
|
||||
test {
|
||||
|
BIN
test/init-scripts/gradle/wrapper/gradle-wrapper.jar
vendored
BIN
test/init-scripts/gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
|
||||
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
25
test/init-scripts/gradlew
vendored
25
test/init-scripts/gradlew
vendored
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,13 +80,10 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -143,12 +140,16 @@ fi
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
@@ -205,6 +210,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
15
test/init-scripts/gradlew.bat
vendored
15
test/init-scripts/gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.12.6"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.10"
|
||||
id "com.gradle.enterprise" version "3.13.4"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
@@ -38,6 +38,9 @@ class BaseInitScriptTest extends Specification {
|
||||
static final List<TestGradleVersion> CONFIGURATION_CACHE_VERSIONS =
|
||||
[GRADLE_7_X, GRADLE_8_X]
|
||||
|
||||
static final List<TestGradleVersion> SETTINGS_PLUGIN_VERSIONS =
|
||||
[GRADLE_6_X, GRADLE_7_X, GRADLE_8_X]
|
||||
|
||||
static final String PUBLIC_BUILD_SCAN_ID = 'i2wepy2gr7ovw'
|
||||
static final String DEFAULT_SCAN_UPLOAD_TOKEN = 'scan-upload-token'
|
||||
static final String ROOT_PROJECT_NAME = 'test-init-script'
|
||||
@@ -134,7 +137,7 @@ class BaseInitScriptTest extends Specification {
|
||||
} else {
|
||||
"""
|
||||
plugins {
|
||||
id 'com.gradle.enterprise' version '3.12.6'
|
||||
id 'com.gradle.enterprise' version '3.13.4'
|
||||
}
|
||||
gradleEnterprise {
|
||||
server = '$mockScansServer.address'
|
||||
@@ -160,7 +163,7 @@ class BaseInitScriptTest extends Specification {
|
||||
} else if (gradleVersion < GradleVersion.version('6.0')) {
|
||||
"""
|
||||
plugins {
|
||||
id 'com.gradle.build-scan' version '3.12.6'
|
||||
id 'com.gradle.build-scan' version '3.13.4'
|
||||
}
|
||||
gradleEnterprise {
|
||||
server = '$mockScansServer.address'
|
||||
|
@@ -148,6 +148,34 @@ class TestBuildResultRecorder extends BaseInitScriptTest {
|
||||
testGradleVersion << ALL_VERSIONS
|
||||
}
|
||||
|
||||
def "produces build results file with build scan when GE plugin is applied in settingsEvaluated"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
when:
|
||||
settingsFile.text = """
|
||||
plugins {
|
||||
id 'com.gradle.enterprise' version '3.13.4' apply(false)
|
||||
}
|
||||
gradle.settingsEvaluated {
|
||||
apply plugin: 'com.gradle.enterprise'
|
||||
gradleEnterprise {
|
||||
server = '$mockScansServer.address'
|
||||
buildScan {
|
||||
publishAlways()
|
||||
}
|
||||
}
|
||||
}
|
||||
""" + settingsFile.text
|
||||
|
||||
run(['help'], initScript, testGradleVersion.gradleVersion)
|
||||
|
||||
then:
|
||||
assertResults('help', testGradleVersion, false, true)
|
||||
|
||||
where:
|
||||
testGradleVersion << SETTINGS_PLUGIN_VERSIONS
|
||||
}
|
||||
|
||||
void assertResults(String task, TestGradleVersion testGradleVersion, boolean hasFailure, boolean hasBuildScan, boolean scanUploadFailed = false) {
|
||||
def results = new JsonSlurper().parse(buildResultFile)
|
||||
assert results['rootProjectName'] == ROOT_PROJECT_NAME
|
||||
|
@@ -47,18 +47,18 @@ test('will cleanup unused gradle versions', async () => {
|
||||
// Run with only one of these versions
|
||||
await runGradleBuild(projectRoot, 'build')
|
||||
|
||||
const gradle733 = path.resolve(gradleUserHome, "caches/7.3.3")
|
||||
const wrapper733 = path.resolve(gradleUserHome, "wrapper/dists/gradle-7.3.3-bin")
|
||||
const gradleCurrent = path.resolve(gradleUserHome, "caches/7.6.1")
|
||||
const gradle802 = path.resolve(gradleUserHome, "caches/8.0.2")
|
||||
const wrapper802 = path.resolve(gradleUserHome, "wrapper/dists/gradle-8.0.2-bin")
|
||||
const gradleCurrent = path.resolve(gradleUserHome, "caches/8.1.1")
|
||||
|
||||
expect(fs.existsSync(gradle733)).toBe(true)
|
||||
expect(fs.existsSync(wrapper733)).toBe(true)
|
||||
expect(fs.existsSync(gradle802)).toBe(true)
|
||||
expect(fs.existsSync(wrapper802)).toBe(true)
|
||||
expect(fs.existsSync(gradleCurrent)).toBe(true)
|
||||
|
||||
await cacheCleaner.forceCleanup()
|
||||
|
||||
expect(fs.existsSync(gradle733)).toBe(false)
|
||||
expect(fs.existsSync(wrapper733)).toBe(false)
|
||||
expect(fs.existsSync(gradle802)).toBe(false)
|
||||
expect(fs.existsSync(wrapper802)).toBe(false)
|
||||
expect(fs.existsSync(gradleCurrent)).toBe(true)
|
||||
})
|
||||
|
||||
|
@@ -17,4 +17,10 @@ describe('cacheUtils-utils', () => {
|
||||
expect(posixHash).toBe(windowsHash)
|
||||
})
|
||||
})
|
||||
describe('sanitizes workflow name in cache key', () => {
|
||||
it('with comma', () => {
|
||||
const cacheKey = cacheUtils.getCacheKeyForJob("Workflow, with,commas", "JOB_ID")
|
||||
expect(cacheKey).toBe('workflow withcommas-JOB_ID')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
Binary file not shown.
@@ -1,7 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
# Deliberately not using the latest Gradle version for cache cleanup testing
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
25
test/jest/resources/cache-cleanup/gradlew
vendored
25
test/jest/resources/cache-cleanup/gradlew
vendored
@@ -55,7 +55,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -80,13 +80,10 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -143,12 +140,16 @@ fi
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -193,6 +194,10 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
@@ -205,6 +210,12 @@ set -- \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
15
test/jest/resources/cache-cleanup/gradlew.bat
vendored
15
test/jest/resources/cache-cleanup/gradlew.bat
vendored
@@ -14,7 +14,7 @@
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -25,7 +25,8 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
Reference in New Issue
Block a user