Is it tractable to adapt this VSCode extension to be usable without SwiftPM, e.g, to use vscode-swift with Bazel? #1326
-
Hello, Currently I am working on an Xcode project that is built with Bazel. I am super interested to see how tractable it is to adapt the vscode-swift extension to work with my project's Bazel system, instead of Swift packet manager? I am quite new to this space and was hoping to get some high level insight from the community on this topic. From my primitive understanding, our bazel build system results in compiled If we do the following, could we expect using this vscode-swift extension with bazel to be possible?
Once those steps are accomplished, would I expect the extension to provide correct code completions & diagnostics (errors, warnings, etc)? Would this be on the right track, or am I missing any crucial ideas / things to be aware of? Any insight would be greatly appreciated on this topic, thank you so much for your time 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It should be possible to make this work if you can manage to generate a The gist of it is to use |
Beta Was this translation helpful? Give feedback.
It should be possible to make this work if you can manage to generate a
compile_commands.json
file. However, that can be tricky to do with Bazel's sandboxing. Something like https://github.com/kiron1/bazel-compile-commands, but for the Swift rules that you use.The gist of it is to use
bazel aquery
to find the actions associated with compiling Swift (you'll have to find out which rule mnemonics do this). You can then extract the build commands for these actions. However, they will have Bazel sandbox directories in them which you'll have to deal with. You'll also have to deal with generated files as inputs if there are any.