Skip to content

Consider adding a Clean Build option with SPM #1499

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

Open
compnerd opened this issue Apr 12, 2025 · 2 comments
Open

Consider adding a Clean Build option with SPM #1499

compnerd opened this issue Apr 12, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@compnerd
Copy link
Member

Is your feature request related to a problem? Please describe.
When building with CMake, it is possible to do a clean build. This is not currently an option with the SPM based projects with VSCode.

Describe the solution you'd like
Having an additional build entry for Clean Build would allow you to do a full complete, clean build in a single invocation.

Describe alternatives you've considered
Running swift package clean before running the build task is a workaround.

Additional context

@adam-fowler
Copy link
Contributor

If you right click in a Swift file the context menu has a Swift submenu which includes a clean build entry.

@plemarquand
Copy link
Contributor

plemarquand commented Apr 14, 2025

I think this would be best if left up to the extension user to define in their .vscode/tasks.json and/or .vscode/launch.json. This approach gives users the flexibility to tailor the order and specific commands run.

.vscode/tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "Swift: Clean Build Folder",
            "type": "shell",
            "command": "swift package clean",
            "group": "build"
        }
    ]
}

.vscode/launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Swift: Clean and Build",
            "type": "swift",
            "request": "launch",
            "program": "${workspaceFolder}/.build/debug/<program_name>"
            "preLaunchTask": "Swift: Clean Build Folder"
        }
    ],
    "tasks": {
        "version": "2.0.0",
        "tasks": [
            // Optionally define tasks here instead of tasks.json
        ]
    }
}

@award999 award999 moved this from Todo to Backlog in Swift Extension for Visual Studio Code May 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants