Remove deprecated input parameters

This commit is contained in:
daz 2024-07-19 14:56:50 -06:00
parent db8e69bc03
commit ded8009fcf
No known key found for this signature in database
5 changed files with 24 additions and 81 deletions

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

@ -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,
@ -19,6 +19,7 @@ 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( recordDeprecation(
'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`'
) )
@ -38,11 +39,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

@ -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'
@ -173,11 +172,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 +190,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 +229,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 +302,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 +319,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 +326,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

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