Make dependency-submission and setup-gradle play nicely

Now, a `dependency-submission` step will trigger a dependency-graph
generation, even if it follows a `setup-gradle` step in the workflow.

Similarly, a `setup-gradle` step with `dependency-graph` configured
will function as expected even if it follows a `setup-gradle` step.
This commit is contained in:
daz
2024-04-06 19:03:51 -06:00
parent ebf4d13461
commit ed4d086d37
7 changed files with 33 additions and 26 deletions

View File

@@ -4,6 +4,8 @@ import * as setupGradle from '../setup-gradle'
import * as execution from '../execution'
import * as provisioner from '../provision'
import * as layout from '../repository-layout'
import * as dependencyGraph from '../dependency-graph'
import {parseArgsStringToArgv} from 'string-argv'
import {DependencyGraphOption, getDependencyGraphOption} from '../input-params'
@@ -12,16 +14,12 @@ import {DependencyGraphOption, getDependencyGraphOption} from '../input-params'
*/
export async function run(): Promise<void> {
try {
if (process.env['GRADLE_BUILD_ACTION_SETUP_COMPLETED']) {
core.setFailed(
'The dependency-submission action cannot be used in the same Job as the setup-gradle action. Please use a separate Job for dependency submission.'
)
return
}
// Configure Gradle environment (Gradle User Home)
await setupGradle.setup()
// Configure the dependency graph submission
await dependencyGraph.setup(getDependencyGraphOption())
if (getDependencyGraphOption() === DependencyGraphOption.DownloadAndSubmit) {
// No execution to perform
return