Prepare for v4 release (#303)

Resolves #297
Resolves #26
This commit is contained in:
Daz DeBoer 2024-07-19 17:13:42 -06:00 committed by GitHub
commit 8e4868ab4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 41 additions and 398 deletions

View File

@ -53,14 +53,6 @@ jobs:
if: ${{ needs.determine-suite.outputs.suite != 'full' }} if: ${{ needs.determine-suite.outputs.suite != 'full' }}
uses: ./.github/actions/build-dist uses: ./.github/actions/build-dist
action-inputs:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-action-inputs.yml
with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
build-scan-publish: build-scan-publish:
needs: [determine-suite, build-distribution] needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-build-scan-publish.yml uses: ./.github/workflows/integ-test-build-scan-publish.yml
@ -118,22 +110,6 @@ jobs:
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-' cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }} skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
execution-with-caching:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-execution-with-caching.yml
with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
execution:
needs: [determine-suite, build-distribution]
uses: ./.github/workflows/integ-test-execution.yml
with:
runner-os: '${{ needs.determine-suite.outputs.runner-os }}'
cache-key-prefix: '${{ needs.determine-suite.outputs.cache-key-prefix }}-'
skip-dist: ${{ needs.determine-suite.outputs.suite == 'full' }}
develocity-injection: develocity-injection:
if: ${{ ! github.event.pull_request.head.repo.fork }} if: ${{ ! github.event.pull_request.head.repo.fork }}
needs: [determine-suite, build-distribution] needs: [determine-suite, build-distribution]

View File

@ -1,62 +0,0 @@
name: demo-failure-cases
on:
workflow_dispatch:
jobs:
build-distribution:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Build and upload distribution
uses: ./.github/actions/build-dist
failing-build:
needs: build-distribution
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Test build failure
uses: ./setup-gradle
continue-on-error: true
with:
build-root-directory: .github/workflow-samples/kotlin-dsl
arguments: not-a-valid-task
wrapper-missing:
needs: build-distribution
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Test wrapper missing
uses: ./setup-gradle
continue-on-error: true
with:
build-root-directory: .github/workflow-samples/no-wrapper
arguments: help
bad-configuration:
needs: build-distribution
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Test bad config value
uses: ./setup-gradle
continue-on-error: true
with:
build-root-directory: .github/workflow-samples/no-wrapper
arguments: help
cache-disabled: yes

View File

@ -1,42 +0,0 @@
name: Test action inputs
on:
workflow_call:
inputs:
cache-key-prefix:
type: string
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
skip-dist:
type: boolean
default: false
env:
SKIP_DIST: ${{ inputs.skip-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: action-inputs-${{ inputs.cache-key-prefix }}
jobs:
action-inputs:
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Invoke with multi-line arguments
uses: ./setup-gradle
with:
build-root-directory: .github/workflow-samples/groovy-dsl
arguments: |
--configuration-cache
--build-cache
-DsystemProperty=FOO
-PgradleProperty=BAR
test
jar

View File

@ -1,60 +0,0 @@
name: Test execution with caching
on:
workflow_call:
inputs:
cache-key-prefix:
type: string
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
skip-dist:
type: boolean
default: false
env:
SKIP_DIST: ${{ inputs.skip-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-with-caching-${{ inputs.cache-key-prefix }}
GRADLE_BUILD_ACTION_CACHE_DEBUG_ENABLED: true
jobs:
seed-build:
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Execute Gradle build
uses: ./setup-gradle
with:
cache-read-only: false # For testing, allow writing cache entries on non-default branches
build-root-directory: .github/workflow-samples/groovy-dsl
arguments: test
# Test that the gradle-user-home is restored
verify-build:
needs: seed-build
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Execute Gradle build
uses: ./setup-gradle
with:
cache-read-only: true
build-root-directory: .github/workflow-samples/groovy-dsl
arguments: test --offline -DverifyCachedBuild=true

View File

@ -1,99 +0,0 @@
name: Test execution
on:
workflow_call:
inputs:
cache-key-prefix:
type: string
runner-os:
type: string
default: '["ubuntu-latest", "windows-latest", "macos-latest"]'
skip-dist:
type: boolean
default: false
env:
SKIP_DIST: ${{ inputs.skip-dist }}
GRADLE_BUILD_ACTION_CACHE_KEY_PREFIX: execution-${{ inputs.cache-key-prefix }}
jobs:
# Tests for executing with different Gradle versions.
# Each build verifies that it is executed with the expected Gradle version.
gradle-execution:
strategy:
fail-fast: false
matrix:
os: ${{fromJSON(inputs.runner-os)}}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Test use defined Gradle version
uses: ./setup-gradle
with:
cache-read-only: false # For testing, allow writing cache entries on non-default branches
gradle-version: 6.9
build-root-directory: .github/workflow-samples/no-wrapper
arguments: help -DgradleVersionCheck=6.9
- name: Test use Gradle version alias
uses: ./setup-gradle
with:
gradle-version: release-candidate
build-root-directory: .github/workflow-samples/no-wrapper
arguments: help
- name: Test with non-executable wrapper
uses: ./setup-gradle
with:
gradle-version: wrapper
build-root-directory: .github/workflow-samples/non-executable-wrapper
arguments: help
gradle-versions:
strategy:
fail-fast: false
matrix:
gradle: [7.5.1, 6.9.2, 5.6.4, 4.10.3, 3.5.1]
os: ${{fromJSON(inputs.runner-os)}}
include:
- java-version: 11
- gradle: 5.6.4
build-root-suffix: -gradle-5
- gradle: 4.10.3
build-root-suffix: -gradle-4
- gradle: 3.5.1
build-root-suffix: -gradle-4
java-version: 8
exclude:
- os: macos-latest # Java 8 is not supported on macos-latest, so we cannot test Gradle 3.5.1
gradle: 3.5.1
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Initialize integ-test
uses: ./.github/actions/init-integ-test
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ matrix.java-version }}
- name: Run Gradle build
uses: ./setup-gradle
id: gradle
with:
cache-read-only: false # For testing, allow writing cache entries on non-default branches
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
if: ${{ !steps.gradle.outputs.build-scan-url }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('No Build Scan detected')

View File

@ -143,21 +143,6 @@ inputs:
required: false required: false
# DEPRECATED ACTION INPUTS # DEPRECATED ACTION INPUTS
build-scan-terms-of-service-url:
description: The URL to the Build Scan® terms of use. This input must be set to 'https://gradle.com/terms-of-service'.
required: false
deprecation-message: The input has been renamed to align with the Develocity API. Use 'build-scan-terms-of-use-url' instead.
build-scan-terms-of-service-agree:
description: Indicate that you agree to the Build Scan® terms of use. This input value must be "yes".
required: false
deprecation-message: The input has been renamed to align with the Develocity API. Use 'build-scan-terms-of-use-agree' instead.
generate-job-summary:
description: When 'false', no Job Summary will be generated for the Job.
required: false
default: true
deprecation-message: Superceded by the new 'add-job-summary' and 'add-job-summary-as-pr-comment' parameters.
# EXPERIMENTAL ACTION INPUTS # EXPERIMENTAL ACTION INPUTS
# The following action properties allow fine-grained tweaking of the action caching behaviour. # The following action properties allow fine-grained tweaking of the action caching behaviour.

View File

@ -46,7 +46,7 @@ inputs:
By default, no cleanup is performed. It can be configured to run every time, or only when all Gradle builds succeed for the Job. By default, no cleanup is performed. It can be configured to run every time, or only when all Gradle builds succeed for the Job.
Valid values are 'never', 'on-success' and 'always'. Valid values are 'never', 'on-success' and 'always'.
required: false required: false
default: 'never' default: 'on-success'
gradle-home-cache-cleanup: gradle-home-cache-cleanup:
description: When 'true', the action will attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache. description: When 'true', the action will attempt to remove any stale/unused entries from the Gradle User Home prior to saving to the GitHub Actions cache.
@ -80,7 +80,7 @@ inputs:
dependency-graph: dependency-graph:
description: | description: |
Specifies if a GitHub dependency snapshot should be generated for each Gradle build, and if so, how. Specifies if a GitHub dependency snapshot should be generated for each Gradle build, and if so, how.
Valid values are 'disabled' (default), 'generate', 'generate-and-submit', 'generate-and-upload', 'download-and-submit' and 'clear'. Valid values are 'disabled' (default), 'generate', 'generate-and-submit', 'generate-and-upload', and 'download-and-submit'.
required: false required: false
default: 'disabled' default: 'disabled'
@ -166,31 +166,10 @@ inputs:
default: false default: false
# DEPRECATED ACTION INPUTS # DEPRECATED ACTION INPUTS
build-scan-terms-of-service-url:
description: The URL to the Build Scan® terms of use. This input must be set to 'https://gradle.com/terms-of-service'.
required: false
deprecation-message: The input has been renamed to align with the Develocity API. Use 'build-scan-terms-of-use-url' instead.
build-scan-terms-of-service-agree:
description: Indicate that you agree to the Build Scan® terms of use. This input value must be "yes".
required: false
deprecation-message: The input has been renamed to align with the Develocity API. Use 'build-scan-terms-of-use-agree' instead.
generate-job-summary:
description: When 'false', no Job Summary will be generated for the Job.
required: false
default: true
deprecation-message: Superceded by the new 'add-job-summary' and 'add-job-summary-as-pr-comment' parameters.
arguments: arguments:
description: Gradle command line arguments (supports multi-line input) description: Gradle command line arguments (supports multi-line input)
required: false required: false
deprecation-message: Using the action to execute Gradle directly is deprecated in favor of using the action to setup Gradle, and executing Gradle in a subsequent Step. deprecation-message: This parameter has been deprecated and removed. It is only left here to allow for better reporting to assist users to migrate.
build-root-directory:
description: Path to the root directory of the build. Default is the root of the GitHub workspace.
required: false
deprecation-message: Using the action to execute Gradle directly is deprecated in favor of using the action to setup Gradle, and executing Gradle in a subsequent Step.
# EXPERIMENTAL ACTION INPUTS # EXPERIMENTAL ACTION INPUTS
# The following action properties allow fine-grained tweaking of the action caching behaviour. # The following action properties allow fine-grained tweaking of the action caching behaviour.

View File

@ -1,5 +1,5 @@
import * as setupGradle from '../../setup-gradle' import * as setupGradle from '../../setup-gradle'
import * as gradle from '../../execution/gradle' import * as provisioner from '../../execution/provision'
import * as dependencyGraph from '../../dependency-graph' import * as dependencyGraph from '../../dependency-graph'
import { import {
BuildScanConfig, BuildScanConfig,
@ -10,7 +10,7 @@ import {
getActionId, getActionId,
setActionId setActionId
} from '../../configuration' } from '../../configuration'
import {recordDeprecation, saveDeprecationState} from '../../deprecation-collector' import {failOnUseOfRemovedFeature, saveDeprecationState} from '../../deprecation-collector'
import {handleMainActionError} from '../../errors' import {handleMainActionError} from '../../errors'
/** /**
@ -19,13 +19,13 @@ import {handleMainActionError} from '../../errors'
export async function run(): Promise<void> { export async function run(): Promise<void> {
try { try {
if (getActionId() === 'gradle/gradle-build-action') { if (getActionId() === 'gradle/gradle-build-action') {
recordDeprecation( failOnUseOfRemovedFeature(
'The action `gradle/gradle-build-action` has been replaced by `gradle/actions/setup-gradle`' 'The action `gradle/gradle-build-action` has been replaced by `gradle/actions/setup-gradle`'
) )
} else {
setActionId('gradle/actions/setup-gradle')
} }
setActionId('gradle/actions/setup-gradle')
// Check for invalid wrapper JARs if requested // Check for invalid wrapper JARs if requested
if (doValidateWrappers()) { if (doValidateWrappers()) {
await setupGradle.checkNoInvalidWrapperJars() await setupGradle.checkNoInvalidWrapperJars()
@ -38,11 +38,8 @@ export async function run(): Promise<void> {
await dependencyGraph.setup(new DependencyGraphConfig()) await dependencyGraph.setup(new DependencyGraphConfig())
const config = new GradleExecutionConfig() const config = new GradleExecutionConfig()
await gradle.provisionAndMaybeExecute( config.verifyNoArguments()
config.getGradleVersion(), await provisioner.provisionGradle(config.getGradleVersion())
config.getBuildRootDirectory(),
config.getArguments()
)
saveDeprecationState() saveDeprecationState()
} catch (error) { } catch (error) {

View File

@ -3,19 +3,19 @@ import * as core from '@actions/core'
import * as validate from '../../wrapper-validation/validate' import * as validate from '../../wrapper-validation/validate'
import {getActionId, setActionId} from '../../configuration' import {getActionId, setActionId} from '../../configuration'
import {recordDeprecation, emitDeprecationWarnings} from '../../deprecation-collector' import {failOnUseOfRemovedFeature, emitDeprecationWarnings} from '../../deprecation-collector'
import {handleMainActionError} from '../../errors' import {handleMainActionError} from '../../errors'
export async function run(): Promise<void> { export async function run(): Promise<void> {
try { try {
if (getActionId() === 'gradle/wrapper-validation-action') { if (getActionId() === 'gradle/wrapper-validation-action') {
recordDeprecation( failOnUseOfRemovedFeature(
'The action `gradle/wrapper-validation-action` has been replaced by `gradle/actions/wrapper-validation`' 'The action `gradle/wrapper-validation-action` has been replaced by `gradle/actions/wrapper-validation`'
) )
} else {
setActionId('gradle/actions/wrapper-validation')
} }
setActionId('gradle/actions/wrapper-validation')
const result = await validate.findInvalidWrapperJars( const result = await validate.findInvalidWrapperJars(
path.resolve('.'), path.resolve('.'),
+core.getInput('min-wrapper-count'), +core.getInput('min-wrapper-count'),

View File

@ -12,9 +12,9 @@ export const EXISTING_GRADLE_HOME = `[Cache was disabled to avoid overwriting a
export const CLEANUP_DISABLED_READONLY = `[Cache cleanup](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup) is always disabled when cache is read-only or disabled.` export const CLEANUP_DISABLED_READONLY = `[Cache cleanup](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup) is always disabled when cache is read-only or disabled.`
export const DEFAULT_CLEANUP_DISABLED_REASON = `[Cache cleanup](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup) was not enabled. It must be explicitly enabled.` export const DEFAULT_CLEANUP_ENABLED_REASON = `[Cache cleanup](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup) was enabled. Stale files in Gradle User Home were purged before saving to the cache.`
export const DEFAULT_CLEANUP_ENABLED_REASON = `[Cache cleanup](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup) was enabled.` export const DEFAULT_CLEANUP_DISABLED_REASON = `[Cache cleanup](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup) was disabled via action parameter. No cleanup of Gradle User Home was performed.`
export const CLEANUP_DISABLED_DUE_TO_FAILURE = export const CLEANUP_DISABLED_DUE_TO_FAILURE =
'[Cache cleanup was disabled due to build failure](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup). Use `cache-cleanup: always` to override this behavior.' '[Cache cleanup was disabled due to build failure](https://github.com/gradle/actions/blob/v3/docs/setup-gradle.md#enabling-cache-cleanup). Use `cache-cleanup: always` to override this behavior.'

View File

@ -51,6 +51,12 @@ export async function restore(
// Mark the state as restored so that post-action will perform save. // Mark the state as restored so that post-action will perform save.
core.saveState(CACHE_RESTORED_VAR, true) core.saveState(CACHE_RESTORED_VAR, true)
if (cacheConfig.isCacheCleanupEnabled()) {
core.info('Preparing cache for cleanup.')
const cacheCleaner = new CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']!)
await cacheCleaner.prepare()
}
if (cacheConfig.isCacheWriteOnly()) { if (cacheConfig.isCacheWriteOnly()) {
core.info('Cache is write-only: will not restore from cache.') core.info('Cache is write-only: will not restore from cache.')
cacheListener.setWriteOnly() cacheListener.setWriteOnly()
@ -60,12 +66,6 @@ export async function restore(
await core.group('Restore Gradle state from cache', async () => { await core.group('Restore Gradle state from cache', async () => {
await gradleStateCache.restore(cacheListener) await gradleStateCache.restore(cacheListener)
}) })
if (cacheConfig.isCacheCleanupEnabled()) {
core.info('Preparing cache for cleanup.')
const cacheCleaner = new CacheCleaner(gradleUserHome, process.env['RUNNER_TEMP']!)
await cacheCleaner.prepare()
}
} }
export async function save( export async function save(

View File

@ -4,7 +4,6 @@ import * as cache from '@actions/cache'
import * as deprecator from './deprecation-collector' import * as deprecator from './deprecation-collector'
import {SUMMARY_ENV_VAR} from '@actions/core/lib/summary' import {SUMMARY_ENV_VAR} from '@actions/core/lib/summary'
import {parseArgsStringToArgv} from 'string-argv'
import path from 'path' import path from 'path'
const ACTION_ID_VAR = 'GRADLE_ACTION_ID' const ACTION_ID_VAR = 'GRADLE_ACTION_ID'
@ -23,11 +22,9 @@ export class DependencyGraphConfig {
return DependencyGraphOption.GenerateAndUpload return DependencyGraphOption.GenerateAndUpload
case 'download-and-submit': case 'download-and-submit':
return DependencyGraphOption.DownloadAndSubmit return DependencyGraphOption.DownloadAndSubmit
case 'clear':
return DependencyGraphOption.Clear
} }
throw TypeError( throw TypeError(
`The value '${val}' is not valid for 'dependency-graph'. Valid values are: [disabled, generate, generate-and-submit, generate-and-upload, download-and-submit, clear]. The default value is 'disabled'.` `The value '${val}' is not valid for 'dependency-graph'. Valid values are: [disabled, generate, generate-and-submit, generate-and-upload, download-and-submit]. The default value is 'disabled'.`
) )
} }
@ -81,8 +78,7 @@ export enum DependencyGraphOption {
Generate = 'generate', Generate = 'generate',
GenerateAndSubmit = 'generate-and-submit', GenerateAndSubmit = 'generate-and-submit',
GenerateAndUpload = 'generate-and-upload', GenerateAndUpload = 'generate-and-upload',
DownloadAndSubmit = 'download-and-submit', DownloadAndSubmit = 'download-and-submit'
Clear = 'clear'
} }
export class CacheConfig { export class CacheConfig {
@ -173,11 +169,6 @@ export class SummaryConfig {
return false return false
} }
// Check if Job Summary is disabled using the deprecated input
if (!this.isJobSummaryEnabled()) {
return false
}
return this.shouldAddJobSummary(this.getJobSummaryOption(), hasFailure) return this.shouldAddJobSummary(this.getJobSummaryOption(), hasFailure)
} }
@ -196,10 +187,6 @@ export class SummaryConfig {
} }
} }
private isJobSummaryEnabled(): boolean {
return getBooleanInput('generate-job-summary', true)
}
private getJobSummaryOption(): JobSummaryOption { private getJobSummaryOption(): JobSummaryOption {
return this.parseJobSummaryOption('add-job-summary') return this.parseJobSummaryOption('add-job-summary')
} }
@ -239,11 +226,11 @@ export class BuildScanConfig {
} }
getBuildScanTermsOfUseUrl(): string { getBuildScanTermsOfUseUrl(): string {
return this.getTermsOfUseProp('build-scan-terms-of-use-url', 'build-scan-terms-of-service-url') return core.getInput('build-scan-terms-of-use-url')
} }
getBuildScanTermsOfUseAgree(): string { getBuildScanTermsOfUseAgree(): string {
return this.getTermsOfUseProp('build-scan-terms-of-use-agree', 'build-scan-terms-of-service-agree') return core.getInput('build-scan-terms-of-use-agree')
} }
getDevelocityAccessKey(): string { getDevelocityAccessKey(): string {
@ -312,22 +299,6 @@ export class BuildScanConfig {
} }
return true return true
} }
/**
* TODO @bigdaz: remove support for the deprecated input property in the next major release of the action
*/
private getTermsOfUseProp(newPropName: string, oldPropName: string): string {
const newProp = core.getInput(newPropName)
if (newProp !== '') {
return newProp
}
const oldProp = core.getInput(oldPropName)
if (oldProp !== '') {
deprecator.recordDeprecation('The `build-scan-terms-of-service` input parameters have been renamed')
return oldProp
}
return core.getInput(oldPropName)
}
} }
export class GradleExecutionConfig { export class GradleExecutionConfig {
@ -345,16 +316,6 @@ export class GradleExecutionConfig {
return resolvedBuildRootDirectory return resolvedBuildRootDirectory
} }
getArguments(): string[] {
const input = core.getInput('arguments')
if (input.length !== 0) {
deprecator.recordDeprecation(
'Using the action to execute Gradle via the `arguments` parameter is deprecated'
)
}
return parseArgsStringToArgv(input)
}
getDependencyResolutionTask(): string { getDependencyResolutionTask(): string {
return core.getInput('dependency-resolution-task') || ':ForceDependencyResolutionPlugin_resolveAllDependencies' return core.getInput('dependency-resolution-task') || ':ForceDependencyResolutionPlugin_resolveAllDependencies'
} }
@ -362,6 +323,16 @@ export class GradleExecutionConfig {
getAdditionalArguments(): string { getAdditionalArguments(): string {
return core.getInput('additional-arguments') return core.getInput('additional-arguments')
} }
verifyNoArguments(): void {
const input = core.getInput('arguments')
if (input.length !== 0) {
deprecator.failOnUseOfRemovedFeature(
`The 'arguments' parameter is no longer supported for ${getActionId()}`,
'Using the action to execute Gradle via the `arguments` parameter is deprecated'
)
}
}
} }
export function doValidateWrappers(): boolean { export function doValidateWrappers(): boolean {

View File

@ -36,12 +36,6 @@ export async function setup(config: DependencyGraphConfig): Promise<void> {
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext()) maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_SHA', getShaFromContext())
maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', getWorkspaceDirectory()) maybeExportVariable('GITHUB_DEPENDENCY_GRAPH_WORKSPACE', getWorkspaceDirectory())
maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory()) maybeExportVariable('DEPENDENCY_GRAPH_REPORT_DIR', config.getReportDirectory())
// To clear the dependency graph, we generate an empty graph by excluding all projects and configurations
if (option === DependencyGraphOption.Clear) {
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_PROJECTS', '')
core.exportVariable('DEPENDENCY_GRAPH_INCLUDE_CONFIGURATIONS', '')
}
} }
function maybeExportVariable(variableName: string, value: unknown): void { function maybeExportVariable(variableName: string, value: unknown): void {
@ -59,7 +53,6 @@ export async function complete(config: DependencyGraphConfig): Promise<void> {
case DependencyGraphOption.DownloadAndSubmit: // Performed in setup case DependencyGraphOption.DownloadAndSubmit: // Performed in setup
return return
case DependencyGraphOption.GenerateAndSubmit: case DependencyGraphOption.GenerateAndSubmit:
case DependencyGraphOption.Clear: // Submit the empty dependency graph
await findAndSubmitDependencyGraphs(config) await findAndSubmitDependencyGraphs(config)
return return
case DependencyGraphOption.GenerateAndUpload: case DependencyGraphOption.GenerateAndUpload:

View File

@ -22,6 +22,11 @@ export function recordDeprecation(message: string): void {
} }
} }
export function failOnUseOfRemovedFeature(removalMessage: string, deprecationMessage: string = removalMessage): void {
const deprecation = new Deprecation(deprecationMessage)
core.error(`${removalMessage}. See ${deprecation.getDocumentationLink()}`)
}
export function getDeprecations(): Deprecation[] { export function getDeprecations(): Deprecation[] {
return recordedDeprecations return recordedDeprecations
} }