dev: Add template for VSCode settings and devcontainers #1828
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR aims at making the set up of a new development environment for OwnTone a bit easier for newcomers by offering near automatic set up for VSCode with the help of devcontainers.
Setting up a development environment for OwnTone is not a trivial task. To get everything working from the C compiler chain, the dependencies, the web interface and building the documentation, requires a lot of knowledge which tools have to be installed etc. There exists already a lot of documentation (from the docs to the container files or the github yaml files), but you have to dig a bit through the different sources to get everything working.
With this PR, to set up a fully working environment it should be enough to:
.dev/vscode
to.vscode
.dev/devcontainer
to.devcontainer
VSCode will then use the config in
.devcontainer
to build a container image that contains all the necessary tooling and then opening the workspace in this container. The build is only necessary once, it takes quite a while to finish, but subsequent opening of the workspace are much faster.In addition to making the onboarding for new contributors easier, devcontainer also make it easier to test different scenarios, e. g. with different userspace (ubuntu, fedora, ...) or different dependency versions (e. g. building libevent from git). For example, I used it to test the later by copying the "ubuntu" subfolder and modifying the Dockerfile to build libevent from git.
The first commit, requires a closer look. It adds a command line argument to specify where the sqlite extension for OwnTone can be found. This allows to point to the locally build (and not yet installed) extension.
The second commit adds the config files for VSCode / devcontainers. Because I like a bit of terminal bling, there are some non essential tools installed like starship and atuin.
I also added a first version of a
.clang-format
file to make formatting easier (VSCode has issues with mixed tabs/spaces), but this needs a bit of work to tweak it for minimal changes across the C code base.Let me know, if you think, this is helpful. If this is something that you consider merging, I will add some documentation to the docs.