Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive vscode task.json inputs #108625

Closed
TylerGubala opened this issue Oct 13, 2020 · 1 comment
Closed

Recursive vscode task.json inputs #108625

TylerGubala opened this issue Oct 13, 2020 · 1 comment
Assignees
Labels
*extension-candidate Issue identified as good extension implementation

Comments

@TylerGubala
Copy link

TylerGubala commented Oct 13, 2020

TL;DR: Desire a documented way for commands intended to be run to generate inputs to themselves depend on inputs

As part of a separate discussion, the seemingly intentional exclusion of task inputs that can be generated by a shell command is very strange to me.

For instance, I cannot use workbench.terminal.run as the command parameter of an input with the type of command.

I am coping with this by installing Task Shell Input, a command by Augusto César Dias (thank you!)

What this allows me to do, is prompt for user input for example, when I want to control or filter which subversion tags are displayed in a user pick list.

When the user selects my SVN - Checkout Blender Precompiled Libs Trunk on Windows, I have to ask them which windows library they want, since Blender Foundation has split up the precompiled libraries based on Visual Studio version.

ice_video_20201013-172644_edit_0

What isn't working is when the user wants to first select the tag to checkout, and then I want to prompt them with a list of available Windows versions.

Here is the relevant parts of my `task.json` file (click to expand)
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "SVN - Checkout Blender Precompiled Libs Tag",
            "type": "process",
            "command": "svn",
            "linux": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/linux_centos7_x86_64/"
                ]
            },
            "osx": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/darwin/"
                ]
            },
            "windows": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/${input:BfSvnTagNTPlatform}"
                ]
            },
            "options": {
                "cwd": "${workspaceFolder}/Blender/lib"
            },
            "problemMatcher": []
        }
    ],
    "inputs": [
        {
            "id": "BfSvnTag",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "svn ls https://svn.blender.org/svnroot/bf-blender/tags/"
            }
        },
        {
            "id": "BfSvnTagNTPlatform",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "svn ls https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/ | findstr \"^win\""
            }
        }
    ]
}
Here is my complete `tasks.json`
{
    // See https://go.microsoft.com/fwlink/?LinkId=733558
    // for the documentation about the tasks.json format
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Python - Publish to PyPI",
            "type": "process",
            "command": "${config:python.pythonPath}",
            "args": [
                "-m",
                "twine",
                "upload",
                "${workspaceFolder}/dist/*"
            ],
            "problemMatcher": []
        },
        {
            "label": "Python - Publish to PyPI [TEST]",
            "type": "process",
            "command": "${config:python.pythonPath}",
            "args": [
                "-m",
                "twine",
                "upload",
                "--repository",
                "pypitest",
                "${workspaceFolder}/dist/*"
            ],
            "problemMatcher": []
        },
        {
            "label": "Python - Upgrade pip",
            "type": "process",
            "command": "${config:python.pythonPath}",
            "args": [
                "-m",
                "pip",
                "install",
                "-U",
                "pip"
            ],
            "problemMatcher": []
        },
        {
            "label": "Python - Install Dependencies",
            "type": "process",
            "command": "${config:python.pythonPath}",
            "args": [
                "-m",
                "pip",
                "install",
                "-r",
                "${workspaceFolder}/requirements.txt"
            ],
            "dependsOn": [
                "Python - Upgrade pip"
            ],
            "problemMatcher": []
        },
        {
            "label": "Make Blender Source & Libs Folder",
            "type": "shell",
            "linux": {
                "command": "mkdir -p ${workspaceFolder}/Blender/lib"
            },
            "osx": {
                "command": "mkdir -p ${workspaceFolder}/Blender/lib"
            },
            "windows": {
                "command": "mkdir -p ${workspaceFolder}/Blender/lib"
            },
            "problemMatcher": []
        },
        {
            "label": "Make Build Folder",
            "type": "shell",
            "linux": {
                "command": "mkdir -p ${workspaceFolder}/build/linux"
            },
            "osx": {
                "command": "mkdir -p ${workspaceFolder}/build/osx"
            },
            "windows": {
                "command": "mkdir -p ${workspaceFolder}/build/windows"
            },
            "problemMatcher": []
        },
        {
            "label": "Make OptiX Folder",
            "type": "shell",
            "linux": {
                "command": "mkdir -p ${workspaceFolder}/OptiX"
            },
            "osx": {
                "command": "mkdir -p ${workspaceFolder}/OptiX"
            },
            "windows": {
                "command": "mkdir -p ${workspaceFolder}/OptiX"
            },
            "problemMatcher": []
        },
        {
            "label": "Browser - Get OptiX [Requires Registration]",
            "type": "shell",
            "linux": {
                "command": "open https://developer.nvidia.com/designworks/optix/download"
            },
            "osx": {
                "command": "open https://developer.nvidia.com/designworks/optix/download"
            },
            "windows": {
                "command": "start https://developer.nvidia.com/designworks/optix/download"
            },
            "dependsOn": [
                "Make OptiX Folder"
            ],
            "problemMatcher": []
        },
        {
            "label": "Git - Clone Blender Sources",
            "type": "process",
            "command": "git",
            "args": [
                "clone",
                "git://git.blender.org/blender.git"
            ],
            "options": {
                "cwd": "${workspaceFolder}/Blender"
            },
            "dependsOn": [
                "Make Blender Source & Libs Folder"
            ],
            "problemMatcher": []
        },
        {
            "label": "Git - Fetch Blender Commits",
            "type": "process",
            "command": "git",
            "args": [
                "fetch"
            ],
            "options": {
                "cwd": "${workspaceFolder}/Blender/blender"
            },
            "problemMatcher": []
        },
        {
            "label": "Git - Pull Blender Commits",
            "type": "process",
            "command": "git",
            "args": [
                "pull"
            ],
            "options": {
                "cwd": "${workspaceFolder}/Blender/blender"
            },
            "problemMatcher": []
        },
        {
            "label": "Git - Checkout Blender Tag",
            "type": "process",
            "command": "git",
            "args": [
                "checkout",
                "tags/${input:BfGitTag}",
                "-b",
                "origin/master"
            ],
            "options": {
                "cwd": "${workspaceFolder}/Blender/blender"
            },
            "dependsOn": [
                "Git - Fetch Blender Commits"
            ],
            "problemMatcher": []
        },
        {
            "label": "Git - Checkout Blender Master",
            "type": "process",
            "command": "git",
            "args": [
                "checkout",
                "master"
            ],
            "options": {
                "cwd": "${workspaceFolder}/Blender/blender"
            },
            "dependsOn": [
                "Git - Fetch Blender Commits"
            ],
            "problemMatcher": []
        },
        {
            "label": "Git - Switch To Blender Master [Checkout & Pull]",
            "dependsOn": [
                "Git - Checkout Blender Master",
                "Git - Pull Blender Commits"
            ],
            "dependsOrder": "sequence",
            "problemMatcher": []
        },
        {
            "label": "Update Blender Sources [Checks out master branch]",
            "type": "shell",
            "command": "./make update",
            "options": {
                "cwd": "${workspaceFolder}/Blender/blender"
            },
            "dependsOn": [
                "Git - Checkout Blender Master"
            ],
            "problemMatcher": []
        },
        {
            "label": "SVN - Checkout Blender Precompiled Libs Trunk",
            "type": "process",
            "command": "svn",
            "linux": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/trunk/lib/linux_centos7_x86_64/"
                ]
            },
            "osx": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/trunk/lib/darwin/"
                ]
            },
            "windows": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/trunk/lib/${input:BfSvnTrunkNTPlatform}"
                ]
            },
            "options": {
                "cwd": "${workspaceFolder}/Blender/lib"
            },
            "problemMatcher": []
        },
        {
            "label": "SVN - Checkout Blender Precompiled Libs Tag",
            "type": "process",
            "command": "svn",
            "linux": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/linux_centos7_x86_64/"
                ]
            },
            "osx": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/darwin/"
                ]
            },
            "windows": {
                "args": [
                    "checkout",
                    "https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/${input:BfSvnTagNTPlatform}"
                ]
            },
            "options": {
                "cwd": "${workspaceFolder}/Blender/lib"
            },
            "problemMatcher": []
        },
        {
            "label": "Configure",
            "type": "shell",
            "linux": {
                "command": "cmake ${workspaceFolder}/Blender/blender -DWITH_PYTHON_INSTALL=OFF -DWITH_PYTHON_MODULE=ON -DWITH_CYCLES_CUDA_BINARIES=ON -DWITH_CYCLES_DEVICE_OPTIX=ON -DOPTIX_ROOT_DIR=/NVIDIA-OptiX-SDK-7.1.0-linux64-x86_64",
                "options": {
                    "cwd": "${workspaceFolder}/build/linux"
                }
            },
            "osx": {
                "command": "cmake ${workspaceFolder}/Blender/blender -DWITH_PYTHON_INSTALL=OFF -DWITH_PYTHON_MODULE=ON",
                "options": {
                    "cwd": "${workspaceFolder}/build/osx"
                }
            },
            "windows": {
                "command": "cmake ${workspaceFolder}/Blender/blender -DWITH_PYTHON_INSTALL=OFF -DWITH_PYTHON_MODULE=ON -DWITH_CYCLES_CUDA_BINARIES=ON -DWITH_CYCLES_DEVICE_OPTIX=ON -DOPTIX_ROOT_DIR=/NVIDIA-OptiX-SDK-7.1.0-linux64-x86_64",
                "options": {
                    "cwd": "${workspaceFolder}/build/windows"
                }
            },
            "problemMatcher": []
        },
        {
            "label": "Build",
            "type": "shell",
            "linux": {
                "command": "./make install",
                "options": {
                    "cwd": "${workspaceFolder}/build/linux"
                }
            },
            "osx": {
                "command": "./make install",
                "options": {
                    "cwd": "${workspaceFolder}/build/osx"
                }
            },
            "windows": {
                "command": "./make install",
                "options": {
                    "cwd": "${workspaceFolder}/build/windows"
                }
            },
            "problemMatcher": [],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        },
        {
            "label": "Docker - Full Clean",
            "type": "process",
            "command": "docker",
            "args": [
                "system",
                "prune",
                "--all",
                "--force",
                "--volumes"
            ],
            "problemMatcher": []
        },
        {
            "label": "Docker - Create Manylinux Wheel Build Environment",
            "type": "process",
            "command": "docker",
            "args": [
                "build",
                "--target",
                "blenderpy-manylinux-wheel-builder",
                "-t",
                "blenderpy/manylinux-wheel-builder",
                "-f",
                "${workspaceFolder}/.containers/Dockerfile",
                "."
            ],
            "problemMatcher": []
        },
        {
            "label": "Docker - Create Windows Wheel Build Environment",
            "type": "process",
            "command": "docker",
            "args": [
                "build",
                "--target",
                "blenderpy-windows-wheel-builder",
                "-t",
                "blenderpy/windows-wheel-builder",
                "-f",
                "${workspaceFolder}/.containers/Dockerfile",
                "."
            ],
            "problemMatcher": []
        },
        {
            "label": "Docker - Delete All Containers & Volumes",
            "type": "shell",
            "command": "docker rm -vf $(docker ps -a -q)",
            "problemMatcher": []
        },
        {
            "label": "Docker - Delete All Images",
            "type": "shell",
            "command": "docker rmi -f $(docker images -a -q)",
            "problemMatcher": []
        },
        {
            "label": "Docker - Delete EVERYTHING",
            "type": "shell",
            "dependsOn": [
                "Docker - Delete All Containers & Volumes",
                "Docker - Delete All Images"
            ],
            "dependsOrder": "sequence",
            "problemMatcher": []
        }
    ],
    "inputs": [
        {
            "id": "BfGitTag",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "cd Blender/blender && git tag"
            }
        },
        {
            "id": "BfSvnTag",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "svn ls https://svn.blender.org/svnroot/bf-blender/tags/"
            }
        },
        {
            "id": "BfSvnTrunkNTPlatform",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "svn ls https://svn.blender.org/svnroot/bf-blender/trunk/lib/ | findstr \"^win\""
            }
        },
        {
            "id": "BfSvnTagNTPlatform",
            "type": "command",
            "command": "shellCommand.execute",
            "args": {
                "command": "svn ls https://svn.blender.org/svnroot/bf-blender/tags/${input:BfSvnTag}/lib/ | findstr \"^win\""
            }
        }
    ]
}

What Happens:

Error

What I Would Like (opinion)

I would like to be able to have a task input that would accept a type of shell or process (like task). The user would supply a shell command or process (optionally breaking it down by OS variant [like task]). The output of the shell or process would produce text that would be split by newline in VS Code natively. Each split would be a list item for the input.

What Could Work

If there was some documented way for commands run by inputs to gather inputs themselves, then this would work today.

See Also

augustocdias/vscode-shell-command#10

@TylerGubala TylerGubala changed the title Recursive inputs Recursive vscode task.json inputs Oct 13, 2020
@alexr00
Copy link
Member

alexr00 commented Oct 14, 2020

If you need to collect many inputs, the current recommendation is that you write an extension that has a command that prompts for input. We do not want to make task inputs recursive, since that gets us into the territory of writing a new programming language.

@alexr00 alexr00 closed this as completed Oct 14, 2020
@alexr00 alexr00 added the *extension-candidate Issue identified as good extension implementation label Oct 14, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*extension-candidate Issue identified as good extension implementation
Projects
None yet
Development

No branches or pull requests

2 participants