Skip to content

input variables not supported in task args #1281

@dshick-nydig

Description

@dshick-nydig

Extension Name: vscode-gradle
Extension Version: v3.12.4
OS Version: macOS Monterey
VSCode version: 1.70.2

Describe the bug
PR #1035 doesn't seem to have included support for input variables

To Reproduce
Define a gradle workflow and reference an input variable from the args, e.g.

{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "gradle",
			"script": "app:run",
			"args": "-PfileToRun=${input:fileToRun}",
			...
		}
	],
	"inputs": [
		{
			"type": "pickString",
			"id": "fileToRun",
			"description": "What file do you want to run?",
			"options": [
				"File1",
				"File2"
			]
		},
	]
}

A possible build.gradle.kts might include...

application {
    // Define the main class for the application.
    mainClass.set("com.example." + project.findProperty("fileToRun").toString() + "Kt")
}

Expected behavior
the input variable should be dereferenced in the resulting command's arguments

Output from "Gradle for Java"

> :app:run
Error: Could not find or load main class com.example.${input:fileToRun}Kt
Caused by: java.lang.ClassNotFoundException: com.example.${input:fileToRun}Kt

Does the bug still exist if you disable all other extensions?
Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions