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

Swift tasks are not created when project has both cmake and swiftpm configurations #798

Open
xedin opened this issue May 13, 2024 · 8 comments
Labels
bug Something isn't working waiting on input Stalled waiting on Input

Comments

@xedin
Copy link

xedin commented May 13, 2024

Describe the bug

Attempting to open SwiftPM project in VSCode with both CMake and Swift extensions installed means that the project cannot be built.

To Reproduce
Steps to reproduce the behavior:

  1. Clone git@github.com:apple/swift-package-manager.git
  2. Install Swift extension and CMake (+ tools) extension
  3. Open the project as a workspace
  4. Cmd-Shift-P -> Tasks: Run Task
  5. There is only one task there Resolve Dependencies
  6. Status bar button Build comes from cmake extension and pressing it results in failures

Expected behavior

Package manager configuration is preferred over CMake and tasks to build the project are generated correctly after first open.

Environment

  • OS: MacOS 14.4
  • Swift version 6.0-dev (LLVM 85bfcc565707685, Swift 0ab3d69bd307345)
  • Visual Studio Code version: 1.89.1
  • vscode-swift version: v1.9.0
@xedin xedin added the bug Something isn't working label May 13, 2024
@adam-fowler
Copy link
Contributor

Tasks: Run Task will show you a list of recently run tasks, and a list of extensions contributing tasks. swift should be in that list. Click on it and it will list all the build tasks. Alternatively use Tasks: Run Build Task (Ctrl/Cmd+Shift+B) to get a list of build tasks regardless of whether they have been run.

@xedin
Copy link
Author

xedin commented May 13, 2024

I see, When I tried to add swift build task it created a new tasks.json file. I guess the only problem here is related to CMake build that happens automatically and results in failures as soon as workspace is opened.

@adam-fowler
Copy link
Contributor

You shouldn't need to add a tasks.json unless you are doing something out of the ordinary. The Swift extension will provide tasks to build debug or release versions of every target. You should be able to see this list with Cmd + Shift + B. These are only available though once the initial project load and resolve has finished.

@xedin
Copy link
Author

xedin commented May 13, 2024

The UI there might be confusing then because if that action is already available why even add tasks.json?

@adam-fowler
Copy link
Contributor

As I said in the previous comment you don't need to as the extension generates the build tasks for you.

@xedin
Copy link
Author

xedin commented May 14, 2024

I am simply trying to explain what happens, I didn’t direct it to create that file, it just does probably because cmake configuration shadows one from package manager, I don’t know.

@adam-fowler
Copy link
Contributor

Sorry I misunderstood. When you say "I tried to add swift build task", what did you do exactly?
You shouldn't need to add a build task. They are generated for you. And you use Tasks: Run Build Task to access the list of build tasks. If you click on the cog at the right hand side of the menu it will create a tasks.json but you should not need to do that. You can just select the tasks and it'll run.

@award999
Copy link
Contributor

FWIW you are able to hit the configure (gear) button for the list of provided task presented when running the Tasks: Run Task command which will place the current configuration in the tasks.json and you can modify from there. So you are able to add and modify build task configurations. @xedin is that how you were trying to add a build task or were you going through some different steps?

@award999 award999 added the waiting on input Stalled waiting on Input label May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working waiting on input Stalled waiting on Input
Projects
None yet
Development

No branches or pull requests

3 participants