A proposal for the interface of the new build system integration.
Similar to CompilationDatabase, but will provide more functionality and live
in clangd instead of tooling until stabilized.
Main points of interest are:
- clangd::Integration is a user-facing API, it handles loading the proper build system integrations from the directory structure and notifying the clients about all changes. It implements clang::GlobalCompilationDatabase and is used by all of clangd to get compile commands, etc.
- clangd::BuildSystem interface is for build system implementations. It handles interactions with a single build system (initially only 'compile_commands.json', but we also plan to experiment with adding direct CMake or ninja support).
- The clangd::GlobalCompilationDatabase now also provides a VFS instance alongside the compile command. The idea is to allow build systems to overlay generated files, if they can need (this is Bazel-specific AFAIK). It is also the responsibility of the buildsystem to update any dependencies (e.g. the generated files) it knows about before providing the compile commands.
'Integration' is a bit of a weird name, as it doesn't tell me what it does.
What I'd have expected is an abstraction like 'Workspace' (which I believe is a domain term in IDEs) that would:
-> be in some form coupled to 1 build system
-> provide a file system view on the workspace
-> provide the ability to watch for changed files
Then the BuildSystem would:
-> provide the ability to watch for changed inputs / commands
-> provide the ability to "prepare all inputs"
-> potentially provide the ability to get a build graph
If Integration wants to be that, it should: