mirror of
https://github.com/gradle/gradle-build-action.git
synced 2025-10-21 00:08:55 +08:00
Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a4cf152f48 | ||
|
a8aac055e2 | ||
|
7241fa5d56 | ||
|
9e58f8b1de | ||
|
632e888003 | ||
|
ced6859e9c | ||
|
0904709a46 | ||
|
1b94073332 | ||
|
4821f54162 | ||
|
2dbad1ea2d | ||
|
915a66c096 | ||
|
8e5c8782a3 | ||
|
9f977db2d8 | ||
|
fa27d06744 | ||
|
a0fdbb009a | ||
|
f59a6d4310 | ||
|
b69de5f2a9 | ||
|
3c11eee5f9 | ||
|
4301451b53 | ||
|
295170c2ce | ||
|
ce999babab | ||
|
ce35ffa374 | ||
|
ad97b0f09e | ||
|
29c79cfd95 |
7
.github/dependabot.yml
vendored
7
.github/dependabot.yml
vendored
@@ -22,12 +22,7 @@ updates:
|
||||
ignore:
|
||||
- dependency-name: "@types/node"
|
||||
groups:
|
||||
runtime-dependencies:
|
||||
patterns:
|
||||
- "@actions/*"
|
||||
- "@octokit/rest"
|
||||
- "string-argv"
|
||||
dev-dependencies:
|
||||
npm-dependencies:
|
||||
patterns:
|
||||
- "*"
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.13.4"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11"
|
||||
id "com.gradle.enterprise" version "3.14"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11.1"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id("com.gradle.enterprise") version "3.13.4"
|
||||
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.11"
|
||||
id("com.gradle.enterprise") version "3.14"
|
||||
id("com.gradle.common-custom-user-data-gradle-plugin") version "1.11.1"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.gradle.build-scan" version "3.13.4"
|
||||
id "com.gradle.build-scan" version "3.14"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.13.4"
|
||||
id "com.gradle.enterprise" version "3.14"
|
||||
}
|
||||
|
||||
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.5.1 # Use a released version to avoid breakages
|
||||
uses: gradle/gradle-build-action@v2.6.1 # 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: 8.2
|
||||
gradle-version: 8.2.1
|
||||
- name: Run tests
|
||||
run: |
|
||||
npm install
|
||||
|
4
.github/workflows/demo-job-summary.yml
vendored
4
.github/workflows/demo-job-summary.yml
vendored
@@ -23,10 +23,10 @@ jobs:
|
||||
- name: Build kotlin-dsl project
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew assemble
|
||||
- name: Build kotlin-dsl project without build scan
|
||||
- name: Build kotlin-dsl project without Build Scan®
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew assemble check --no-scan
|
||||
- name: Build kotlin-dsl project with build scan publish failure
|
||||
- name: Build kotlin-dsl project with Build Scan® publish failure
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew check -Dgradle.enterprise.url=https://not.valid.server
|
||||
- name: Build groovy-dsl project
|
||||
|
@@ -1,4 +1,4 @@
|
||||
name: Demo adding build scan comment to PR
|
||||
name: Demo adding Build Scan® comment to PR
|
||||
on:
|
||||
pull_request:
|
||||
types: [assigned, review_requested]
|
||||
@@ -14,7 +14,7 @@ jobs:
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/kotlin-dsl
|
||||
run: ./gradlew build --scan
|
||||
- name: "Add build scan URL as PR comment"
|
||||
- name: "Add Build Scan URL as PR comment"
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
|
@@ -88,12 +88,12 @@ jobs:
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||
- name: Check build scan url is captured
|
||||
- name: Check Build Scan url is captured
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No build scan detected')
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
# Test that build scans are captured when caching is disabled because Gradle User Home already exists
|
||||
cache-disabled-pre-existing-gradle-home:
|
||||
@@ -111,12 +111,12 @@ jobs:
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||
- name: Check build scan url is captured
|
||||
- name: Check Build Scan url is captured
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No build scan detected')
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
# Test seed the cache with cache-write-only and verify with cache-read-only
|
||||
seed-build-write-only:
|
||||
|
@@ -66,3 +66,31 @@ jobs:
|
||||
uses: ./
|
||||
with:
|
||||
dependency-graph: download-and-submit
|
||||
|
||||
multiple-builds:
|
||||
runs-on: "ubuntu-latest"
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v3
|
||||
- name: Download distribution if required
|
||||
uses: ./.github/actions/download-dist
|
||||
- name: Setup Gradle for dependency-graph generate
|
||||
uses: ./
|
||||
with:
|
||||
dependency-graph: generate
|
||||
- id: gradle-assemble
|
||||
run: ./gradlew assemble
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
- id: gradle-build
|
||||
run: ./gradlew build
|
||||
working-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Check generated dependency graphs
|
||||
run: |
|
||||
echo "gradle-assemble report file: ${{ steps.gradle-assemble.outputs.dependency-graph-file }}"
|
||||
echo "gradle-build report file: ${{ steps.gradle-build.outputs.dependency-graph-file }}"
|
||||
ls -l dependency-graph-reports
|
||||
if ([ ! -e ${{ steps.gradle-assemble.outputs.dependency-graph-file }} ] || [ ! -e ${{ steps.gradle-build.outputs.dependency-graph-file }} ])
|
||||
then
|
||||
echo "Did not find expected dependency graph files"
|
||||
exit 1
|
||||
fi
|
||||
|
4
.github/workflows/integ-test-execution.yml
vendored
4
.github/workflows/integ-test-execution.yml
vendored
@@ -84,11 +84,11 @@ jobs:
|
||||
gradle-version: ${{matrix.gradle}}
|
||||
build-root-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
arguments: help -DgradleVersionCheck=${{matrix.gradle}}
|
||||
- name: Check build scan url
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No build scan detected')
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
|
||||
|
@@ -88,11 +88,11 @@ jobs:
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
run: gradle help "-DgradleVersionCheck=${{matrix.gradle}}"
|
||||
- name: Check build scan url
|
||||
- name: Check Build Scan url
|
||||
if: ${{ !steps.gradle.outputs.build-scan-url }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('No build scan detected')
|
||||
core.setFailed('No Build Scan detected')
|
||||
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
# Configuration file for asdf version manager
|
||||
nodejs 16.18.1
|
||||
gradle 8.2
|
||||
gradle 8.2.1
|
||||
|
55
README.md
55
README.md
@@ -41,7 +41,7 @@ However, the `gradle-build-action` offers a number of advantages over this appro
|
||||
- Easily [run the build with different versions of Gradle](#use-a-specific-gradle-version) using the `gradle-version` parameter. Gradle distributions are automatically downloaded and cached.
|
||||
- More sophisticated and more efficient caching of Gradle User Home between invocations, compared to `setup-java` and most custom configurations using `actions/cache`. [More details below](#caching).
|
||||
- Detailed reporting of cache usage and cache configuration options allow you to [optimize the use of the GitHub actions cache](#optimizing-cache-effectiveness).
|
||||
- [Automatic capture of build scan links](#build-scans) from the build, making these easier to locate for workflow run.
|
||||
- [Automatic capture of Build Scan® links](#build-scans) from the build, making these easier to locate for workflow run.
|
||||
|
||||
The `gradle-build-action` is designed to provide these benefits with minimal configuration.
|
||||
These features work both when Gradle is executed via the `gradle-build-action` and for any Gradle execution in subsequent steps.
|
||||
@@ -339,7 +339,7 @@ If you are using init scripts for the [Gradle Enterprise Gradle Plugin](https://
|
||||
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.
|
||||
|
||||
### Build scan link as Step output
|
||||
### 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`.
|
||||
@@ -361,7 +361,7 @@ jobs:
|
||||
- name: Run build with Gradle wrapper
|
||||
id: gradle
|
||||
run: ./gradlew build --scan
|
||||
- name: "Add build scan URL as PR comment"
|
||||
- name: "Add Build Scan URL as PR comment"
|
||||
uses: actions/github-script@v5
|
||||
if: github.event_name == 'pull_request' && failure()
|
||||
with:
|
||||
@@ -404,13 +404,12 @@ jobs:
|
||||
## Support for GitHub Enterprise Server (GHES)
|
||||
|
||||
You can use the `gradle-build-action` on GitHub Enterprise Server, and benefit from the improved integration with Gradle. Depending on the version of GHES you are running, certain features may be limited:
|
||||
- Build scan links are captured and displayed in the GitHub Actions UI
|
||||
- Build Scan links are captured and displayed in the GitHub Actions UI
|
||||
- Easily run your build with different versions of Gradle
|
||||
- Save/restore of Gradle User Home (requires GHES v3.5+ : GitHub Actions cache was introduced in GHES 3.5)
|
||||
- Support for GitHub Actions Job Summary (requires GHES 3.6+ : GitHub Actions Job Summary support was introduced in GHES 3.6). In earlier versions of GHES the build-results summary and caching report will be written to the workflow log, as part of the post-action step.
|
||||
|
||||
# GitHub Dependency Graph support
|
||||
**EXPERIMENTAL**
|
||||
|
||||
The `gradle-build-action` has experimental support for submitting a [GitHub Dependency Graph](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph) snapshot via the [GitHub Dependency Submission API](https://docs.github.com/en/rest/dependency-graph/dependency-submission?apiVersion=2022-11-28).
|
||||
|
||||
@@ -449,39 +448,59 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@dependency-graph
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Run a build, generating the dependency graph snapshot which will be submitted
|
||||
run: ./gradlew build
|
||||
```
|
||||
|
||||
### Running multiple builds in a single Job
|
||||
### Filtering which Gradle Configurations contribute to the dependency graph
|
||||
|
||||
GitHub tracks dependency snapshots based on the `job.correlator` value that is embedded in the snapshot. When a newer snapshot for an existing correlator is submitted, the previous snapshot is replaced. Snapshots with different `job.correlator` values are additive to the overall dependency graph for the repository.
|
||||
If you do not want to include every dependency configuration in every project in your build, you can limit the
|
||||
dependency extraction to a subset of these.
|
||||
|
||||
The `gradle-build-action` will generate a `job.correlator` value based on the workflow name, job id and matrix values. However, if your job steps contains multiple Gradle invocations, then a unique correlator value must be assigned to each. You assign a correlator by setting the `GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR` environment variable.
|
||||
To restrict which Gradle subprojects contribute to the report, specify which projects to include via a regular expression.
|
||||
You can provide this value via the `DEPENDENCY_GRAPH_INCLUDE_PROJECTS` environment variable or system property.
|
||||
|
||||
To restrict which Gradle configurations contribute to the report, you can filter configurations by name using a regular expression.
|
||||
You can provide this value via the `DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS` environment variable or system property.
|
||||
|
||||
Example of a simple workflow that limits the dependency graph to `RuntimeClasspath` configuration:
|
||||
```yaml
|
||||
name: dependency-graph
|
||||
name: Submit dependency graph
|
||||
on:
|
||||
push:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Gradle to generate and submit dependency graphs
|
||||
uses: gradle/gradle-build-action@dependency-graph
|
||||
uses: gradle/gradle-build-action@v2
|
||||
with:
|
||||
dependency-graph: generate-and-submit
|
||||
- name: Run first build using the default job correlator 'dependency-graph-build'
|
||||
run: ./gradlew build
|
||||
- name: Run second build providing a unique job correlator
|
||||
run: ./gradlew test
|
||||
env:
|
||||
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: dependency-graph-test
|
||||
|
||||
- name: Run a build, generating the dependency graph from 'RuntimeClasspath' configurations
|
||||
run: ./gradlew build -DDEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS=RuntimeClasspath
|
||||
```
|
||||
|
||||
### Gradle version compatibility
|
||||
|
||||
The plugin should be compatible with all versions of Gradle >= 5.0, and has been tested against
|
||||
Gradle versions "5.6.4", "6.9.4", "7.0.2", "7.6.2", "8.0.2" and the current Gradle release.
|
||||
|
||||
The plugin is compatible with running Gradle with the configuration-cache enabled. However, this support is
|
||||
limited to Gradle "8.1.0" and later:
|
||||
- With Gradle "8.0", the build should run successfully, but an empty dependency graph will be generated.
|
||||
- With Gradle <= "7.6.4", the plugin will cause the build to fail with configuration-cache enabled.
|
||||
|
||||
To use this plugin with versions of Gradle older than "8.1.0", you'll need to invoke Gradle with the
|
||||
configuration-cache disabled.
|
||||
|
||||
### Dependency snapshots generated for pull requests
|
||||
|
||||
This `contents: write` permission is not available for any workflow that is triggered by a pull request submitted from a forked repository, since it would permit a malicious pull request to make repository changes.
|
||||
|
@@ -87,7 +87,9 @@ inputs:
|
||||
|
||||
outputs:
|
||||
build-scan-url:
|
||||
description: Link to the build scan if any
|
||||
description: Link to the Build Scan® generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||
dependency-graph-file:
|
||||
description: Path to the GitHub Dependency Graph snapshot file generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||
|
||||
runs:
|
||||
using: 'node16'
|
||||
|
72938
dist/dependency-graph-generate/index.js
vendored
72938
dist/dependency-graph-generate/index.js
vendored
File diff suppressed because one or more lines are too long
1
dist/dependency-graph-generate/index.js.map
vendored
1
dist/dependency-graph-generate/index.js.map
vendored
File diff suppressed because one or more lines are too long
24783
dist/dependency-graph-submit/index.js
vendored
24783
dist/dependency-graph-submit/index.js
vendored
File diff suppressed because one or more lines are too long
1
dist/dependency-graph-submit/index.js.map
vendored
1
dist/dependency-graph-submit/index.js.map
vendored
File diff suppressed because one or more lines are too long
150
dist/main/index.js
vendored
150
dist/main/index.js
vendored
@@ -61088,8 +61088,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
||||
// Max safe segment length for coercion.
|
||||
var MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
|
||||
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
|
||||
|
||||
// The actual regexps go on exports.re
|
||||
var re = exports.re = []
|
||||
var safeRe = exports.safeRe = []
|
||||
var src = exports.src = []
|
||||
var t = exports.tokens = {}
|
||||
var R = 0
|
||||
@@ -61098,6 +61101,31 @@ function tok (n) {
|
||||
t[n] = R++
|
||||
}
|
||||
|
||||
var LETTERDASHNUMBER = '[a-zA-Z0-9-]'
|
||||
|
||||
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
||||
// used internally via the safeRe object since all inputs in this library get
|
||||
// normalized first to trim and collapse all extra whitespace. The original
|
||||
// regexes are exported for userland consumption and lower level usage. A
|
||||
// future breaking change could export the safer regex only with a note that
|
||||
// all input should have extra whitespace removed.
|
||||
var safeRegexReplacements = [
|
||||
['\\s', 1],
|
||||
['\\d', MAX_LENGTH],
|
||||
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
||||
]
|
||||
|
||||
function makeSafeRe (value) {
|
||||
for (var i = 0; i < safeRegexReplacements.length; i++) {
|
||||
var token = safeRegexReplacements[i][0]
|
||||
var max = safeRegexReplacements[i][1]
|
||||
value = value
|
||||
.split(token + '*').join(token + '{0,' + max + '}')
|
||||
.split(token + '+').join(token + '{1,' + max + '}')
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
@@ -61107,14 +61135,14 @@ function tok (n) {
|
||||
tok('NUMERICIDENTIFIER')
|
||||
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
tok('NUMERICIDENTIFIERLOOSE')
|
||||
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
src[t.NUMERICIDENTIFIERLOOSE] = '\\d+'
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
tok('NONNUMERICIDENTIFIER')
|
||||
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*'
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
@@ -61156,7 +61184,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
tok('BUILDIDENTIFIER')
|
||||
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+'
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
@@ -61236,6 +61264,7 @@ src[t.COERCE] = '(^|[^\\d])' +
|
||||
'(?:$|[^\\d])'
|
||||
tok('COERCERTL')
|
||||
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
|
||||
safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g')
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
@@ -61245,6 +61274,7 @@ src[t.LONETILDE] = '(?:~>?)'
|
||||
tok('TILDETRIM')
|
||||
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
|
||||
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
|
||||
safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g')
|
||||
var tildeTrimReplace = '$1~'
|
||||
|
||||
tok('TILDE')
|
||||
@@ -61260,6 +61290,7 @@ src[t.LONECARET] = '(?:\\^)'
|
||||
tok('CARETTRIM')
|
||||
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
|
||||
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
|
||||
safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g')
|
||||
var caretTrimReplace = '$1^'
|
||||
|
||||
tok('CARET')
|
||||
@@ -61281,6 +61312,7 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
||||
|
||||
// this one has to use the /g flag
|
||||
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
|
||||
safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g')
|
||||
var comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
@@ -61309,6 +61341,14 @@ for (var i = 0; i < R; i++) {
|
||||
debug(i, src[i])
|
||||
if (!re[i]) {
|
||||
re[i] = new RegExp(src[i])
|
||||
|
||||
// Replace all greedy whitespace to prevent regex dos issues. These regex are
|
||||
// used internally via the safeRe object since all inputs in this library get
|
||||
// normalized first to trim and collapse all extra whitespace. The original
|
||||
// regexes are exported for userland consumption and lower level usage. A
|
||||
// future breaking change could export the safer regex only with a note that
|
||||
// all input should have extra whitespace removed.
|
||||
safeRe[i] = new RegExp(makeSafeRe(src[i]))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61333,7 +61373,7 @@ function parse (version, options) {
|
||||
return null
|
||||
}
|
||||
|
||||
var r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
@@ -61388,7 +61428,7 @@ function SemVer (version, options) {
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
|
||||
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError('Invalid Version: ' + version)
|
||||
@@ -61833,6 +61873,7 @@ function Comparator (comp, options) {
|
||||
return new Comparator(comp, options)
|
||||
}
|
||||
|
||||
comp = comp.trim().split(/\s+/).join(' ')
|
||||
debug('comparator', comp, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
@@ -61849,7 +61890,7 @@ function Comparator (comp, options) {
|
||||
|
||||
var ANY = {}
|
||||
Comparator.prototype.parse = function (comp) {
|
||||
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
|
||||
var m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
@@ -61973,9 +62014,16 @@ function Range (range, options) {
|
||||
this.loose = !!options.loose
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
// First, split based on boolean or ||
|
||||
// First reduce all whitespace as much as possible so we do not have to rely
|
||||
// on potentially slow regexes like \s*. This is then stored and used for
|
||||
// future error messages as well.
|
||||
this.raw = range
|
||||
this.set = range.split(/\s*\|\|\s*/).map(function (range) {
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.join(' ')
|
||||
|
||||
// First, split based on boolean or ||
|
||||
this.set = this.raw.split('||').map(function (range) {
|
||||
return this.parseRange(range.trim())
|
||||
}, this).filter(function (c) {
|
||||
// throw out any that are not relevant for whatever reason
|
||||
@@ -61983,7 +62031,7 @@ function Range (range, options) {
|
||||
})
|
||||
|
||||
if (!this.set.length) {
|
||||
throw new TypeError('Invalid SemVer Range: ' + range)
|
||||
throw new TypeError('Invalid SemVer Range: ' + this.raw)
|
||||
}
|
||||
|
||||
this.format()
|
||||
@@ -62002,20 +62050,19 @@ Range.prototype.toString = function () {
|
||||
|
||||
Range.prototype.parseRange = function (range) {
|
||||
var loose = this.options.loose
|
||||
range = range.trim()
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace)
|
||||
debug('hyphen replace', range)
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
||||
range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, safeRe[t.COMPARATORTRIM])
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace)
|
||||
|
||||
// normalize spaces
|
||||
range = range.split(/\s+/).join(' ')
|
||||
@@ -62023,7 +62070,7 @@ Range.prototype.parseRange = function (range) {
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
|
||||
var set = range.split(' ').map(function (comp) {
|
||||
return parseComparator(comp, this.options)
|
||||
}, this).join(' ').split(/\s+/)
|
||||
@@ -62123,7 +62170,7 @@ function replaceTildes (comp, options) {
|
||||
}
|
||||
|
||||
function replaceTilde (comp, options) {
|
||||
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@@ -62164,7 +62211,7 @@ function replaceCarets (comp, options) {
|
||||
|
||||
function replaceCaret (comp, options) {
|
||||
debug('caret', comp, options)
|
||||
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@@ -62223,7 +62270,7 @@ function replaceXRanges (comp, options) {
|
||||
|
||||
function replaceXRange (comp, options) {
|
||||
comp = comp.trim()
|
||||
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE]
|
||||
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
var xM = isX(M)
|
||||
@@ -62298,7 +62345,7 @@ function replaceXRange (comp, options) {
|
||||
function replaceStars (comp, options) {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[t.STAR], '')
|
||||
return comp.trim().replace(safeRe[t.STAR], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
@@ -62624,7 +62671,7 @@ function coerce (version, options) {
|
||||
|
||||
var match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(re[t.COERCE])
|
||||
match = version.match(safeRe[t.COERCE])
|
||||
} else {
|
||||
// Find the right-most coercible string that does not share
|
||||
// a terminus with a more left-ward coercible string.
|
||||
@@ -62635,17 +62682,17 @@ function coerce (version, options) {
|
||||
// Stop when we get a match that ends at the string end, since no
|
||||
// coercible string can be more right-ward without the same terminus.
|
||||
var next
|
||||
while ((next = re[t.COERCERTL].exec(version)) &&
|
||||
while ((next = safeRe[t.COERCERTL].exec(version)) &&
|
||||
(!match || match.index + match[0].length !== version.length)
|
||||
) {
|
||||
if (!match ||
|
||||
next.index + next[0].length !== match.index + match[0].length) {
|
||||
match = next
|
||||
}
|
||||
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
re[t.COERCERTL].lastIndex = -1
|
||||
safeRe[t.COERCERTL].lastIndex = -1
|
||||
}
|
||||
|
||||
if (match === null) {
|
||||
@@ -73053,9 +73100,9 @@ function setup(option) {
|
||||
core.info('Enabling dependency graph generation');
|
||||
const jobCorrelator = getJobCorrelator();
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true');
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', jobCorrelator);
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId);
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports'));
|
||||
core.exportVariable('GITHUB_JOB_CORRELATOR', jobCorrelator);
|
||||
core.exportVariable('GITHUB_JOB_ID', github.context.runId);
|
||||
core.exportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports'));
|
||||
}
|
||||
exports.setup = setup;
|
||||
function complete(option) {
|
||||
@@ -73235,19 +73282,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.executeGradleBuild = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const gradlew = __importStar(__nccwpck_require__(2335));
|
||||
function executeGradleBuild(executable, root, args) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const toExecute = executable !== null && executable !== void 0 ? executable : gradlew.locateGradleWrapperScript(root);
|
||||
verifyIsExecutableScript(toExecute);
|
||||
const toExecute = executable !== null && executable !== void 0 ? executable : gradlew.gradleWrapperScript(root);
|
||||
const status = yield exec.exec(toExecute, args, {
|
||||
cwd: root,
|
||||
ignoreReturnCode: true
|
||||
@@ -73258,14 +73300,6 @@ function executeGradleBuild(executable, root, args) {
|
||||
});
|
||||
}
|
||||
exports.executeGradleBuild = executeGradleBuild;
|
||||
function verifyIsExecutableScript(toExecute) {
|
||||
try {
|
||||
fs_1.default.accessSync(toExecute, fs_1.default.constants.X_OK);
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`Gradle script '${toExecute}' is not executable.`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***/ }),
|
||||
@@ -73302,27 +73336,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.locateGradleWrapperScript = exports.installScriptFilename = exports.wrapperScriptFilename = void 0;
|
||||
exports.gradleWrapperScript = exports.installScriptFilename = exports.wrapperScriptFilename = void 0;
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const fs_1 = __importDefault(__nccwpck_require__(7147));
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
function wrapperScriptFilename() {
|
||||
return IS_WINDOWS ? 'gradlew.bat' : 'gradlew';
|
||||
return IS_WINDOWS ? './gradlew.bat' : './gradlew';
|
||||
}
|
||||
exports.wrapperScriptFilename = wrapperScriptFilename;
|
||||
function installScriptFilename() {
|
||||
return IS_WINDOWS ? 'gradle.bat' : 'gradle';
|
||||
}
|
||||
exports.installScriptFilename = installScriptFilename;
|
||||
function locateGradleWrapperScript(buildRootDirectory) {
|
||||
function gradleWrapperScript(buildRootDirectory) {
|
||||
validateGradleWrapper(buildRootDirectory);
|
||||
return path.resolve(buildRootDirectory, wrapperScriptFilename());
|
||||
return wrapperScriptFilename();
|
||||
}
|
||||
exports.locateGradleWrapperScript = locateGradleWrapperScript;
|
||||
exports.gradleWrapperScript = gradleWrapperScript;
|
||||
function validateGradleWrapper(buildRootDirectory) {
|
||||
const wrapperScript = path.resolve(buildRootDirectory, wrapperScriptFilename());
|
||||
verifyExists(wrapperScript, 'Gradle Wrapper script');
|
||||
verifyIsExecutableScript(wrapperScript);
|
||||
const wrapperProperties = path.resolve(buildRootDirectory, 'gradle/wrapper/gradle-wrapper.properties');
|
||||
if (!fs_1.default.existsSync(wrapperProperties)) {
|
||||
throw new Error(`Cannot locate a Gradle wrapper properties file at '${wrapperProperties}'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured.`);
|
||||
verifyExists(wrapperProperties, 'Gradle wrapper properties file');
|
||||
}
|
||||
function verifyExists(file, description) {
|
||||
if (!fs_1.default.existsSync(file)) {
|
||||
throw new Error(`Cannot locate ${description} at '${file}'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured.`);
|
||||
}
|
||||
}
|
||||
function verifyIsExecutableScript(toExecute) {
|
||||
try {
|
||||
fs_1.default.accessSync(toExecute, fs_1.default.constants.X_OK);
|
||||
}
|
||||
catch (err) {
|
||||
throw new Error(`Gradle script '${toExecute}' is not executable.`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73540,7 +73588,7 @@ function writeSummaryTable(results) {
|
||||
<th>Requested Tasks</th>
|
||||
<th>Gradle Version</th>
|
||||
<th>Build Outcome</th>
|
||||
<th>Build Scan™</th>
|
||||
<th>Build Scan®</th>
|
||||
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||
</table>
|
||||
`);
|
||||
@@ -73568,7 +73616,7 @@ function renderBuildScan(result) {
|
||||
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
||||
}
|
||||
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
||||
}
|
||||
@@ -73576,7 +73624,7 @@ function logSummaryTable(results) {
|
||||
core.info('============================');
|
||||
core.info('Gradle Builds');
|
||||
core.info('----------------------------');
|
||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan™');
|
||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®');
|
||||
core.info('----------------------------');
|
||||
for (const result of results) {
|
||||
core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
|
||||
|
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
107
dist/post/index.js
vendored
107
dist/post/index.js
vendored
@@ -61088,8 +61088,11 @@ var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
|
||||
// Max safe segment length for coercion.
|
||||
var MAX_SAFE_COMPONENT_LENGTH = 16
|
||||
|
||||
var MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6
|
||||
|
||||
// The actual regexps go on exports.re
|
||||
var re = exports.re = []
|
||||
var safeRe = exports.safeRe = []
|
||||
var src = exports.src = []
|
||||
var t = exports.tokens = {}
|
||||
var R = 0
|
||||
@@ -61098,6 +61101,31 @@ function tok (n) {
|
||||
t[n] = R++
|
||||
}
|
||||
|
||||
var LETTERDASHNUMBER = '[a-zA-Z0-9-]'
|
||||
|
||||
// Replace some greedy regex tokens to prevent regex dos issues. These regex are
|
||||
// used internally via the safeRe object since all inputs in this library get
|
||||
// normalized first to trim and collapse all extra whitespace. The original
|
||||
// regexes are exported for userland consumption and lower level usage. A
|
||||
// future breaking change could export the safer regex only with a note that
|
||||
// all input should have extra whitespace removed.
|
||||
var safeRegexReplacements = [
|
||||
['\\s', 1],
|
||||
['\\d', MAX_LENGTH],
|
||||
[LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
|
||||
]
|
||||
|
||||
function makeSafeRe (value) {
|
||||
for (var i = 0; i < safeRegexReplacements.length; i++) {
|
||||
var token = safeRegexReplacements[i][0]
|
||||
var max = safeRegexReplacements[i][1]
|
||||
value = value
|
||||
.split(token + '*').join(token + '{0,' + max + '}')
|
||||
.split(token + '+').join(token + '{1,' + max + '}')
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
// The following Regular Expressions can be used for tokenizing,
|
||||
// validating, and parsing SemVer version strings.
|
||||
|
||||
@@ -61107,14 +61135,14 @@ function tok (n) {
|
||||
tok('NUMERICIDENTIFIER')
|
||||
src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'
|
||||
tok('NUMERICIDENTIFIERLOOSE')
|
||||
src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'
|
||||
src[t.NUMERICIDENTIFIERLOOSE] = '\\d+'
|
||||
|
||||
// ## Non-numeric Identifier
|
||||
// Zero or more digits, followed by a letter or hyphen, and then zero or
|
||||
// more letters, digits, or hyphens.
|
||||
|
||||
tok('NONNUMERICIDENTIFIER')
|
||||
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'
|
||||
src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-]' + LETTERDASHNUMBER + '*'
|
||||
|
||||
// ## Main Version
|
||||
// Three dot-separated numeric identifiers.
|
||||
@@ -61156,7 +61184,7 @@ src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] +
|
||||
// Any combination of digits, letters, or hyphens.
|
||||
|
||||
tok('BUILDIDENTIFIER')
|
||||
src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'
|
||||
src[t.BUILDIDENTIFIER] = LETTERDASHNUMBER + '+'
|
||||
|
||||
// ## Build Metadata
|
||||
// Plus sign, followed by one or more period-separated build metadata
|
||||
@@ -61236,6 +61264,7 @@ src[t.COERCE] = '(^|[^\\d])' +
|
||||
'(?:$|[^\\d])'
|
||||
tok('COERCERTL')
|
||||
re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g')
|
||||
safeRe[t.COERCERTL] = new RegExp(makeSafeRe(src[t.COERCE]), 'g')
|
||||
|
||||
// Tilde ranges.
|
||||
// Meaning is "reasonably at or greater than"
|
||||
@@ -61245,6 +61274,7 @@ src[t.LONETILDE] = '(?:~>?)'
|
||||
tok('TILDETRIM')
|
||||
src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'
|
||||
re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g')
|
||||
safeRe[t.TILDETRIM] = new RegExp(makeSafeRe(src[t.TILDETRIM]), 'g')
|
||||
var tildeTrimReplace = '$1~'
|
||||
|
||||
tok('TILDE')
|
||||
@@ -61260,6 +61290,7 @@ src[t.LONECARET] = '(?:\\^)'
|
||||
tok('CARETTRIM')
|
||||
src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'
|
||||
re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g')
|
||||
safeRe[t.CARETTRIM] = new RegExp(makeSafeRe(src[t.CARETTRIM]), 'g')
|
||||
var caretTrimReplace = '$1^'
|
||||
|
||||
tok('CARET')
|
||||
@@ -61281,6 +61312,7 @@ src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] +
|
||||
|
||||
// this one has to use the /g flag
|
||||
re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g')
|
||||
safeRe[t.COMPARATORTRIM] = new RegExp(makeSafeRe(src[t.COMPARATORTRIM]), 'g')
|
||||
var comparatorTrimReplace = '$1$2$3'
|
||||
|
||||
// Something like `1.2.3 - 1.2.4`
|
||||
@@ -61309,6 +61341,14 @@ for (var i = 0; i < R; i++) {
|
||||
debug(i, src[i])
|
||||
if (!re[i]) {
|
||||
re[i] = new RegExp(src[i])
|
||||
|
||||
// Replace all greedy whitespace to prevent regex dos issues. These regex are
|
||||
// used internally via the safeRe object since all inputs in this library get
|
||||
// normalized first to trim and collapse all extra whitespace. The original
|
||||
// regexes are exported for userland consumption and lower level usage. A
|
||||
// future breaking change could export the safer regex only with a note that
|
||||
// all input should have extra whitespace removed.
|
||||
safeRe[i] = new RegExp(makeSafeRe(src[i]))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61333,7 +61373,7 @@ function parse (version, options) {
|
||||
return null
|
||||
}
|
||||
|
||||
var r = options.loose ? re[t.LOOSE] : re[t.FULL]
|
||||
var r = options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL]
|
||||
if (!r.test(version)) {
|
||||
return null
|
||||
}
|
||||
@@ -61388,7 +61428,7 @@ function SemVer (version, options) {
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
|
||||
var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL])
|
||||
var m = version.trim().match(options.loose ? safeRe[t.LOOSE] : safeRe[t.FULL])
|
||||
|
||||
if (!m) {
|
||||
throw new TypeError('Invalid Version: ' + version)
|
||||
@@ -61833,6 +61873,7 @@ function Comparator (comp, options) {
|
||||
return new Comparator(comp, options)
|
||||
}
|
||||
|
||||
comp = comp.trim().split(/\s+/).join(' ')
|
||||
debug('comparator', comp, options)
|
||||
this.options = options
|
||||
this.loose = !!options.loose
|
||||
@@ -61849,7 +61890,7 @@ function Comparator (comp, options) {
|
||||
|
||||
var ANY = {}
|
||||
Comparator.prototype.parse = function (comp) {
|
||||
var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var r = this.options.loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
|
||||
var m = comp.match(r)
|
||||
|
||||
if (!m) {
|
||||
@@ -61973,9 +62014,16 @@ function Range (range, options) {
|
||||
this.loose = !!options.loose
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
// First, split based on boolean or ||
|
||||
// First reduce all whitespace as much as possible so we do not have to rely
|
||||
// on potentially slow regexes like \s*. This is then stored and used for
|
||||
// future error messages as well.
|
||||
this.raw = range
|
||||
this.set = range.split(/\s*\|\|\s*/).map(function (range) {
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.join(' ')
|
||||
|
||||
// First, split based on boolean or ||
|
||||
this.set = this.raw.split('||').map(function (range) {
|
||||
return this.parseRange(range.trim())
|
||||
}, this).filter(function (c) {
|
||||
// throw out any that are not relevant for whatever reason
|
||||
@@ -61983,7 +62031,7 @@ function Range (range, options) {
|
||||
})
|
||||
|
||||
if (!this.set.length) {
|
||||
throw new TypeError('Invalid SemVer Range: ' + range)
|
||||
throw new TypeError('Invalid SemVer Range: ' + this.raw)
|
||||
}
|
||||
|
||||
this.format()
|
||||
@@ -62002,20 +62050,19 @@ Range.prototype.toString = function () {
|
||||
|
||||
Range.prototype.parseRange = function (range) {
|
||||
var loose = this.options.loose
|
||||
range = range.trim()
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]
|
||||
var hr = loose ? safeRe[t.HYPHENRANGELOOSE] : safeRe[t.HYPHENRANGE]
|
||||
range = range.replace(hr, hyphenReplace)
|
||||
debug('hyphen replace', range)
|
||||
// `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
|
||||
range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, re[t.COMPARATORTRIM])
|
||||
range = range.replace(safeRe[t.COMPARATORTRIM], comparatorTrimReplace)
|
||||
debug('comparator trim', range, safeRe[t.COMPARATORTRIM])
|
||||
|
||||
// `~ 1.2.3` => `~1.2.3`
|
||||
range = range.replace(re[t.TILDETRIM], tildeTrimReplace)
|
||||
range = range.replace(safeRe[t.TILDETRIM], tildeTrimReplace)
|
||||
|
||||
// `^ 1.2.3` => `^1.2.3`
|
||||
range = range.replace(re[t.CARETTRIM], caretTrimReplace)
|
||||
range = range.replace(safeRe[t.CARETTRIM], caretTrimReplace)
|
||||
|
||||
// normalize spaces
|
||||
range = range.split(/\s+/).join(' ')
|
||||
@@ -62023,7 +62070,7 @@ Range.prototype.parseRange = function (range) {
|
||||
// At this point, the range is completely trimmed and
|
||||
// ready to be split into comparators.
|
||||
|
||||
var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]
|
||||
var compRe = loose ? safeRe[t.COMPARATORLOOSE] : safeRe[t.COMPARATOR]
|
||||
var set = range.split(' ').map(function (comp) {
|
||||
return parseComparator(comp, this.options)
|
||||
}, this).join(' ').split(/\s+/)
|
||||
@@ -62123,7 +62170,7 @@ function replaceTildes (comp, options) {
|
||||
}
|
||||
|
||||
function replaceTilde (comp, options) {
|
||||
var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]
|
||||
var r = options.loose ? safeRe[t.TILDELOOSE] : safeRe[t.TILDE]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('tilde', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@@ -62164,7 +62211,7 @@ function replaceCarets (comp, options) {
|
||||
|
||||
function replaceCaret (comp, options) {
|
||||
debug('caret', comp, options)
|
||||
var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]
|
||||
var r = options.loose ? safeRe[t.CARETLOOSE] : safeRe[t.CARET]
|
||||
return comp.replace(r, function (_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr)
|
||||
var ret
|
||||
@@ -62223,7 +62270,7 @@ function replaceXRanges (comp, options) {
|
||||
|
||||
function replaceXRange (comp, options) {
|
||||
comp = comp.trim()
|
||||
var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]
|
||||
var r = options.loose ? safeRe[t.XRANGELOOSE] : safeRe[t.XRANGE]
|
||||
return comp.replace(r, function (ret, gtlt, M, m, p, pr) {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr)
|
||||
var xM = isX(M)
|
||||
@@ -62298,7 +62345,7 @@ function replaceXRange (comp, options) {
|
||||
function replaceStars (comp, options) {
|
||||
debug('replaceStars', comp, options)
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[t.STAR], '')
|
||||
return comp.trim().replace(safeRe[t.STAR], '')
|
||||
}
|
||||
|
||||
// This function is passed to string.replace(re[t.HYPHENRANGE])
|
||||
@@ -62624,7 +62671,7 @@ function coerce (version, options) {
|
||||
|
||||
var match = null
|
||||
if (!options.rtl) {
|
||||
match = version.match(re[t.COERCE])
|
||||
match = version.match(safeRe[t.COERCE])
|
||||
} else {
|
||||
// Find the right-most coercible string that does not share
|
||||
// a terminus with a more left-ward coercible string.
|
||||
@@ -62635,17 +62682,17 @@ function coerce (version, options) {
|
||||
// Stop when we get a match that ends at the string end, since no
|
||||
// coercible string can be more right-ward without the same terminus.
|
||||
var next
|
||||
while ((next = re[t.COERCERTL].exec(version)) &&
|
||||
while ((next = safeRe[t.COERCERTL].exec(version)) &&
|
||||
(!match || match.index + match[0].length !== version.length)
|
||||
) {
|
||||
if (!match ||
|
||||
next.index + next[0].length !== match.index + match[0].length) {
|
||||
match = next
|
||||
}
|
||||
re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
safeRe[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length
|
||||
}
|
||||
// leave it in a clean state
|
||||
re[t.COERCERTL].lastIndex = -1
|
||||
safeRe[t.COERCERTL].lastIndex = -1
|
||||
}
|
||||
|
||||
if (match === null) {
|
||||
@@ -73053,9 +73100,9 @@ function setup(option) {
|
||||
core.info('Enabling dependency graph generation');
|
||||
const jobCorrelator = getJobCorrelator();
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true');
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', jobCorrelator);
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId);
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports'));
|
||||
core.exportVariable('GITHUB_JOB_CORRELATOR', jobCorrelator);
|
||||
core.exportVariable('GITHUB_JOB_ID', github.context.runId);
|
||||
core.exportVariable('DEPENDENCY_GRAPH_REPORT_DIR', path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports'));
|
||||
}
|
||||
exports.setup = setup;
|
||||
function complete(option) {
|
||||
@@ -73409,7 +73456,7 @@ function writeSummaryTable(results) {
|
||||
<th>Requested Tasks</th>
|
||||
<th>Gradle Version</th>
|
||||
<th>Build Outcome</th>
|
||||
<th>Build Scan™</th>
|
||||
<th>Build Scan®</th>
|
||||
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||
</table>
|
||||
`);
|
||||
@@ -73437,7 +73484,7 @@ function renderBuildScan(result) {
|
||||
return renderBuildScanBadge('NOT_PUBLISHED', 'lightgrey', 'https://scans.gradle.com');
|
||||
}
|
||||
function renderBuildScanBadge(outcomeText, outcomeColor, targetUrl) {
|
||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`;
|
||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`;
|
||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`;
|
||||
}
|
||||
@@ -73445,7 +73492,7 @@ function logSummaryTable(results) {
|
||||
core.info('============================');
|
||||
core.info('Gradle Builds');
|
||||
core.info('----------------------------');
|
||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan™');
|
||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®');
|
||||
core.info('----------------------------');
|
||||
for (const result of results) {
|
||||
core.info(`${result.rootProjectName} | ${result.requestedTasks} | ${result.gradleVersion} | ${result.buildFailed ? 'FAILED' : 'SUCCESS'} | ${result.buildScanFailed ? 'Publish failed' : result.buildScanUri}`);
|
||||
|
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
877
package-lock.json
generated
877
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
13
package.json
13
package.json
@@ -42,14 +42,15 @@
|
||||
"string-argv": "0.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "16.11.21",
|
||||
"@types/jest": "29.5.2",
|
||||
"@types/node": "16.18.38",
|
||||
"@types/jest": "29.5.3",
|
||||
"@types/unzipper": "0.10.6",
|
||||
"@typescript-eslint/parser": "5.61.0",
|
||||
"@typescript-eslint/parser": "6.1.0",
|
||||
"@vercel/ncc": "0.36.1",
|
||||
"eslint": "8.44.0",
|
||||
"eslint-plugin-github": "4.8.0",
|
||||
"eslint-plugin-jest": "27.2.2",
|
||||
"eslint": "8.45.0",
|
||||
"eslint-plugin-github": "4.9.2",
|
||||
"eslint-plugin-jest": "27.2.3",
|
||||
"eslint-plugin-prettier": "5.0.0",
|
||||
"jest": "29.6.1",
|
||||
"js-yaml": "4.1.0",
|
||||
"patch-package": "7.0.0",
|
||||
|
@@ -21,10 +21,10 @@ export function setup(option: DependencyGraphOption): void {
|
||||
core.info('Enabling dependency graph generation')
|
||||
const jobCorrelator = getJobCorrelator()
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_ENABLED', 'true')
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR', jobCorrelator)
|
||||
core.exportVariable('GITHUB_DEPENDENCY_GRAPH_JOB_ID', github.context.runId)
|
||||
core.exportVariable('GITHUB_JOB_CORRELATOR', jobCorrelator)
|
||||
core.exportVariable('GITHUB_JOB_ID', github.context.runId)
|
||||
core.exportVariable(
|
||||
'GITHUB_DEPENDENCY_GRAPH_REPORT_DIR',
|
||||
'DEPENDENCY_GRAPH_REPORT_DIR',
|
||||
path.resolve(layout.workspaceDirectory(), 'dependency-graph-reports')
|
||||
)
|
||||
}
|
||||
|
@@ -1,12 +1,11 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as exec from '@actions/exec'
|
||||
import fs from 'fs'
|
||||
import * as gradlew from './gradlew'
|
||||
|
||||
export async function executeGradleBuild(executable: string | undefined, root: string, args: string[]): Promise<void> {
|
||||
// Use the provided executable, or look for a Gradle wrapper script to run
|
||||
const toExecute = executable ?? gradlew.locateGradleWrapperScript(root)
|
||||
verifyIsExecutableScript(toExecute)
|
||||
const toExecute = executable ?? gradlew.gradleWrapperScript(root)
|
||||
|
||||
const status: number = await exec.exec(toExecute, args, {
|
||||
cwd: root,
|
||||
ignoreReturnCode: true
|
||||
@@ -16,11 +15,3 @@ export async function executeGradleBuild(executable: string | undefined, root: s
|
||||
core.setFailed(`Gradle build failed: see console output for details`)
|
||||
}
|
||||
}
|
||||
|
||||
function verifyIsExecutableScript(toExecute: string): void {
|
||||
try {
|
||||
fs.accessSync(toExecute, fs.constants.X_OK)
|
||||
} catch (err) {
|
||||
throw new Error(`Gradle script '${toExecute}' is not executable.`)
|
||||
}
|
||||
}
|
||||
|
@@ -4,23 +4,39 @@ import fs from 'fs'
|
||||
const IS_WINDOWS = process.platform === 'win32'
|
||||
|
||||
export function wrapperScriptFilename(): string {
|
||||
return IS_WINDOWS ? 'gradlew.bat' : 'gradlew'
|
||||
return IS_WINDOWS ? './gradlew.bat' : './gradlew'
|
||||
}
|
||||
|
||||
export function installScriptFilename(): string {
|
||||
return IS_WINDOWS ? 'gradle.bat' : 'gradle'
|
||||
}
|
||||
|
||||
export function locateGradleWrapperScript(buildRootDirectory: string): string {
|
||||
export function gradleWrapperScript(buildRootDirectory: string): string {
|
||||
validateGradleWrapper(buildRootDirectory)
|
||||
return path.resolve(buildRootDirectory, wrapperScriptFilename())
|
||||
return wrapperScriptFilename()
|
||||
}
|
||||
|
||||
function validateGradleWrapper(buildRootDirectory: string): void {
|
||||
const wrapperScript = path.resolve(buildRootDirectory, wrapperScriptFilename())
|
||||
verifyExists(wrapperScript, 'Gradle Wrapper script')
|
||||
verifyIsExecutableScript(wrapperScript)
|
||||
|
||||
const wrapperProperties = path.resolve(buildRootDirectory, 'gradle/wrapper/gradle-wrapper.properties')
|
||||
if (!fs.existsSync(wrapperProperties)) {
|
||||
verifyExists(wrapperProperties, 'Gradle wrapper properties file')
|
||||
}
|
||||
|
||||
function verifyExists(file: string, description: string): void {
|
||||
if (!fs.existsSync(file)) {
|
||||
throw new Error(
|
||||
`Cannot locate a Gradle wrapper properties file at '${wrapperProperties}'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured.`
|
||||
`Cannot locate ${description} at '${file}'. Specify 'gradle-version' or 'gradle-executable' for projects without Gradle wrapper configured.`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
function verifyIsExecutableScript(toExecute: string): void {
|
||||
try {
|
||||
fs.accessSync(toExecute, fs.constants.X_OK)
|
||||
} catch (err) {
|
||||
throw new Error(`Gradle script '${toExecute}' is not executable.`)
|
||||
}
|
||||
}
|
||||
|
@@ -36,7 +36,7 @@ function writeSummaryTable(results: BuildResult[]): void {
|
||||
<th>Requested Tasks</th>
|
||||
<th>Gradle Version</th>
|
||||
<th>Build Outcome</th>
|
||||
<th>Build Scan™</th>
|
||||
<th>Build Scan®</th>
|
||||
</tr>${results.map(result => renderBuildResultRow(result)).join('')}
|
||||
</table>
|
||||
`)
|
||||
@@ -72,7 +72,7 @@ function renderBuildScan(result: BuildResult): string {
|
||||
}
|
||||
|
||||
function renderBuildScanBadge(outcomeText: string, outcomeColor: string, targetUrl: string): string {
|
||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%E2%84%A2-${outcomeText}-${outcomeColor}?logo=Gradle`
|
||||
const badgeUrl = `https://img.shields.io/badge/Build%20Scan%C2%AE-${outcomeText}-${outcomeColor}?logo=Gradle`
|
||||
const badgeHtml = `<img src="${badgeUrl}" alt="Build Scan ${outcomeText}" />`
|
||||
return `<a href="${targetUrl}" rel="nofollow">${badgeHtml}</a>`
|
||||
}
|
||||
@@ -81,7 +81,7 @@ function logSummaryTable(results: BuildResult[]): void {
|
||||
core.info('============================')
|
||||
core.info('Gradle Builds')
|
||||
core.info('----------------------------')
|
||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan™')
|
||||
core.info('Root Project | Requested Tasks | Gradle Version | Build Outcome | Build Scan®')
|
||||
core.info('----------------------------')
|
||||
for (const result of results) {
|
||||
core.info(
|
||||
|
@@ -23,7 +23,7 @@ if (isTopLevelBuild) {
|
||||
captureUsingBuildFinished(gradle, invocationId)
|
||||
}
|
||||
|
||||
// The `buildScanPublished` hook allows the capture of the build scan URI.
|
||||
// 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)
|
||||
@@ -34,7 +34,7 @@ if (isTopLevelBuild) {
|
||||
// By default, use 'buildFinished' to capture build results
|
||||
captureUsingBuildFinished(gradle, invocationId)
|
||||
|
||||
// The `buildScanPublished` hook allows the capture of the build scan URI.
|
||||
// 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)
|
||||
|
@@ -3,7 +3,7 @@ buildscript {
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.gradle:github-dependency-graph-gradle-plugin:0.0.5"
|
||||
classpath "org.gradle:github-dependency-graph-gradle-plugin:0.2.0"
|
||||
}
|
||||
}
|
||||
apply plugin: org.gradle.github.GitHubDependencyGraphPlugin
|
||||
|
@@ -1,24 +1,59 @@
|
||||
import org.gradle.util.GradleVersion
|
||||
|
||||
// Only run when dependency graph is explicitly enabled
|
||||
if (System.env.GITHUB_DEPENDENCY_GRAPH_ENABLED != "true") {
|
||||
return
|
||||
}
|
||||
|
||||
// Do not run for unsupported versions of Gradle
|
||||
if (GradleVersion.current().baseVersion < GradleVersion.version("5.0")) {
|
||||
println "::warning::Dependency Graph is not supported for Gradle versions < 5.0. No dependency snapshot will be generated."
|
||||
return
|
||||
}
|
||||
|
||||
def reportDir = System.env.GITHUB_DEPENDENCY_GRAPH_REPORT_DIR
|
||||
def jobCorrelator = System.env.GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR
|
||||
def reportFile = new File(reportDir, jobCorrelator + ".json")
|
||||
// Attempt to find a unique job correlator to use based on the environment variable
|
||||
// This is only required for top-level builds
|
||||
def isTopLevelBuild = gradle.getParent() == null
|
||||
if (isTopLevelBuild) {
|
||||
def reportFile = getUniqueReportFile(System.env.GITHUB_JOB_CORRELATOR)
|
||||
|
||||
if (reportFile.exists()) {
|
||||
println "::warning::No dependency snapshot generated for step: report file for '${jobCorrelator}' created in earlier step. Each build invocation requires a unique job correlator: specify GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR var for this step."
|
||||
return
|
||||
if (reportFile == null) {
|
||||
println "::warning::No dependency snapshot generated for step. Could not determine unique job correlator - specify GITHUB_JOB_CORRELATOR var for this step."
|
||||
return
|
||||
}
|
||||
|
||||
def githubOutput = System.getenv("GITHUB_OUTPUT")
|
||||
if (githubOutput) {
|
||||
new File(githubOutput) << "dependency-graph-file=${reportFile.absolutePath}\n"
|
||||
}
|
||||
|
||||
|
||||
println "Generating dependency graph into '${reportFile}'"
|
||||
}
|
||||
|
||||
println "Generating dependency graph for '${jobCorrelator}'"
|
||||
|
||||
// TODO:DAZ This should be conditionally applied, since the script may be present when not required.
|
||||
apply from: 'github-dependency-graph-gradle-plugin-apply.groovy'
|
||||
|
||||
/**
|
||||
* Using the supplied jobCorrelator value:
|
||||
* - Checks if report file already exists
|
||||
* - If so, tries to find a unique value that does not yet have a corresponding report file.
|
||||
* - When found, this value is set as a System property override.
|
||||
*/
|
||||
File getUniqueReportFile(String jobCorrelator) {
|
||||
def reportDir = System.env.DEPENDENCY_GRAPH_REPORT_DIR
|
||||
def reportFile = new File(reportDir, jobCorrelator + ".json")
|
||||
if (!reportFile.exists()) return reportFile
|
||||
|
||||
// Try at most 100 suffixes
|
||||
for (int i = 1; i < 100; i++) {
|
||||
def candidateCorrelator = jobCorrelator + "-" + i
|
||||
def candidateFile = new File(reportDir, candidateCorrelator + ".json")
|
||||
if (!candidateFile.exists()) {
|
||||
System.properties['GITHUB_JOB_CORRELATOR'] = candidateCorrelator
|
||||
return candidateFile
|
||||
}
|
||||
}
|
||||
|
||||
// Could not determine unique job correlator
|
||||
return null
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionSha256Sum=38f66cd6eef217b4c35855bb11ea4e9fbc53594ccccb5fb82dfd317ef8c2c5a3
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||
distributionSha256Sum=03ec176d388f2aa99defcadc3ac6adf8dd2bce5145a129659537c0874dea5ad1
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
@@ -1,6 +1,6 @@
|
||||
plugins {
|
||||
id "com.gradle.enterprise" version "3.13.4"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11"
|
||||
id "com.gradle.enterprise" version "3.14"
|
||||
id "com.gradle.common-custom-user-data-gradle-plugin" version "1.11.1"
|
||||
}
|
||||
|
||||
gradleEnterprise {
|
||||
|
@@ -24,7 +24,7 @@ class BaseInitScriptTest extends Specification {
|
||||
static final TestGradleVersion GRADLE_6_X = new TestGradleVersion(GradleVersion.version('6.9.4'), 8, 15)
|
||||
static final TestGradleVersion GRADLE_7_X = new TestGradleVersion(GradleVersion.version('7.6.2'), 8, 19)
|
||||
static final TestGradleVersion GRADLE_8_0 = new TestGradleVersion(GradleVersion.version('8.0.2'), 8, 19)
|
||||
static final TestGradleVersion GRADLE_8_X = new TestGradleVersion(GradleVersion.version('8.2'), 8, 19)
|
||||
static final TestGradleVersion GRADLE_8_X = new TestGradleVersion(GradleVersion.version('8.2.1'), 8, 19)
|
||||
|
||||
static final List<TestGradleVersion> ALL_VERSIONS = [
|
||||
GRADLE_3_X, // First version where TestKit supports environment variables
|
||||
@@ -139,7 +139,7 @@ class BaseInitScriptTest extends Specification {
|
||||
} else {
|
||||
"""
|
||||
plugins {
|
||||
id 'com.gradle.enterprise' version '3.13.4'
|
||||
id 'com.gradle.enterprise' version '3.14'
|
||||
}
|
||||
gradleEnterprise {
|
||||
server = '$mockScansServer.address'
|
||||
@@ -165,7 +165,7 @@ class BaseInitScriptTest extends Specification {
|
||||
} else if (gradleVersion < GradleVersion.version('6.0')) {
|
||||
"""
|
||||
plugins {
|
||||
id 'com.gradle.build-scan' version '3.13.4'
|
||||
id 'com.gradle.build-scan' version '3.14'
|
||||
}
|
||||
gradleEnterprise {
|
||||
server = '$mockScansServer.address'
|
||||
|
@@ -154,7 +154,7 @@ class TestBuildResultRecorder extends BaseInitScriptTest {
|
||||
when:
|
||||
settingsFile.text = """
|
||||
plugins {
|
||||
id 'com.gradle.enterprise' version '3.13.4' apply(false)
|
||||
id 'com.gradle.enterprise' version '3.14' apply(false)
|
||||
}
|
||||
gradle.settingsEvaluated {
|
||||
apply plugin: 'com.gradle.enterprise'
|
||||
|
@@ -8,7 +8,6 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
||||
static final List<TestGradleVersion> NO_DEPENDENCY_GRAPH_VERSIONS = [GRADLE_3_X, GRADLE_4_X]
|
||||
static final List<TestGradleVersion> DEPENDENCY_GRAPH_VERSIONS = ALL_VERSIONS - NO_DEPENDENCY_GRAPH_VERSIONS
|
||||
|
||||
|
||||
def "does not produce dependency graph when not enabled"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
@@ -30,9 +29,24 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
||||
|
||||
then:
|
||||
assert reportFile.exists()
|
||||
assert gitHubOutputFile.text == "dependency-graph-file=${reportFile.absolutePath}\n"
|
||||
|
||||
where:
|
||||
testGradleVersion << DEPENDENCY_GRAPH_VERSIONS
|
||||
testGradleVersion << GRADLE_8_X
|
||||
}
|
||||
|
||||
// Dependency-graph plugin doesn't support config-cache for 8.0 of Gradle
|
||||
def "produces dependency graph with configuration-cache on latest Gradle"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
when:
|
||||
run(['help'], initScript, testGradleVersion.gradleVersion, [], envVars)
|
||||
|
||||
then:
|
||||
assert reportFile.exists()
|
||||
|
||||
where:
|
||||
testGradleVersion << [GRADLE_8_X]
|
||||
}
|
||||
|
||||
def "warns and produces no dependency graph when enabled for older Gradle versions"() {
|
||||
@@ -49,18 +63,46 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
||||
testGradleVersion << NO_DEPENDENCY_GRAPH_VERSIONS
|
||||
}
|
||||
|
||||
def "warns and does not overwrite existing report file"() {
|
||||
def "constructs unique job correlator for each build invocation"() {
|
||||
assumeTrue testGradleVersion.compatibleWithCurrentJvm
|
||||
|
||||
def reportFile1 = new File(reportsDir, "CORRELATOR-1.json")
|
||||
def reportFile2 = new File(reportsDir, "CORRELATOR-2.json")
|
||||
|
||||
buildFile << """
|
||||
task firstTask {
|
||||
doLast {
|
||||
println "First"
|
||||
}
|
||||
}
|
||||
task secondTask {
|
||||
doLast {
|
||||
println "Second"
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
when:
|
||||
reportsDir.mkdirs()
|
||||
reportFile << "DUMMY CONTENT"
|
||||
def result = run(['help'], initScript, testGradleVersion.gradleVersion, [], envVars)
|
||||
run(['help'], initScript, testGradleVersion.gradleVersion, [], envVars)
|
||||
|
||||
then:
|
||||
assert reportFile.text == "DUMMY CONTENT"
|
||||
assert result.output.contains("::warning::No dependency snapshot generated for step")
|
||||
assert reportFile.exists()
|
||||
|
||||
when:
|
||||
run(['first'], initScript, testGradleVersion.gradleVersion, [], envVars)
|
||||
|
||||
then:
|
||||
assert reportFile.exists()
|
||||
assert reportFile1.exists()
|
||||
|
||||
when:
|
||||
run(['second'], initScript, testGradleVersion.gradleVersion, [], envVars)
|
||||
|
||||
then:
|
||||
assert reportFile.exists()
|
||||
assert reportFile1.exists()
|
||||
assert reportFile2.exists()
|
||||
|
||||
where:
|
||||
testGradleVersion << DEPENDENCY_GRAPH_VERSIONS
|
||||
}
|
||||
@@ -68,12 +110,13 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
||||
def getEnvVars() {
|
||||
return [
|
||||
GITHUB_DEPENDENCY_GRAPH_ENABLED: "true",
|
||||
GITHUB_DEPENDENCY_GRAPH_JOB_CORRELATOR: "CORRELATOR",
|
||||
GITHUB_DEPENDENCY_GRAPH_JOB_ID: "1",
|
||||
GITHUB_DEPENDENCY_GRAPH_REPORT_DIR: reportsDir.absolutePath,
|
||||
GITHUB_JOB_CORRELATOR: "CORRELATOR",
|
||||
GITHUB_JOB_ID: "1",
|
||||
GITHUB_REF: "main",
|
||||
GITHUB_SHA: "123456",
|
||||
GITHUB_WORKSPACE: testProjectDir.absolutePath
|
||||
GITHUB_WORKSPACE: testProjectDir.absolutePath,
|
||||
DEPENDENCY_GRAPH_REPORT_DIR: reportsDir.absolutePath,
|
||||
GITHUB_OUTPUT: gitHubOutputFile.absolutePath
|
||||
]
|
||||
}
|
||||
|
||||
@@ -84,4 +127,8 @@ class TestDependencyGraph extends BaseInitScriptTest {
|
||||
def getReportFile() {
|
||||
return new File(reportsDir, "CORRELATOR.json")
|
||||
}
|
||||
|
||||
def getGitHubOutputFile() {
|
||||
return new File(testProjectDir, "GITHUB_OUTPUT")
|
||||
}
|
||||
}
|
||||
|
@@ -49,7 +49,7 @@ test('will cleanup unused gradle versions', async () => {
|
||||
|
||||
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.2")
|
||||
const gradleCurrent = path.resolve(gradleUserHome, "caches/8.2.1")
|
||||
|
||||
expect(fs.existsSync(gradle802)).toBe(true)
|
||||
expect(fs.existsSync(wrapper802)).toBe(true)
|
||||
|
Reference in New Issue
Block a user