Support alternate solution for bazel based C++ builds
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Funcionalidade
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Pouca atividade
- Stack de tecnologia
- cpp
- Domínio
- build-system
Direção de pesquisa
Comece pela documentação vinculada do CodeQL e pelo workflow existente do Bazel; em seguida, determine quais informações de build a CLI exige durante a criação do banco de dados. Compare as abordagens propostas de compile_commands.json, clang indexstore, Kythe e scip-clang, incluindo as restrições de execução remota e cache. Está concluído quando uma alternativa compatível estiver definida e seus requisitos de documentação e validação estiverem claros.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Currently the codeql documentation contains this example for use with bazel based projects:
# Navigate to the Bazel workspace.
# Before building, remove cached objects
# and stop all running Bazel server processes.
bazel clean --expunge
# Build using the following Bazel flags, to help CodeQL detect the build:
# `--spawn_strategy=local`: build locally, instead of using a distributed build
# `--nouse_action_cache`: turn off build caching, which might prevent recompilation of source code
# `--noremote_accept_cached`, `--noremote_upload_local_results`: avoid using a remote cache
# `--disk_cache=`: avoid using a disk cache. Note that a disk cache is no longer considered a remote cache as of Bazel 6.
codeql database create new-database --language=<language> \
--command='bazel build --spawn_strategy=local --nouse_action_cache --noremote_accept_cached --noremote_upload_local_results --disk_cache= //path/to/package:target'
# After building, stop all running Bazel server processes.
# This ensures future build commands start in a clean Bazel server process
# without CodeQL attached.
bazel shutdown
The gist of this is that you must start from scratch and build the whole project on the local machine without any caching. For many projects that moved to bazel moving away from this model was one of the core motivations. For large builds that rely on caching / remote execution, it may no longer be feasible to run the entire build on 1 machine, even if it's only on a scheduled cadence. Moreover the user might not even host the infrastructure to do this anymore, as all of their actual developer and CI builds go through remote execution.
It would be great if there was another way to communicate the necessary information to codeql, in a way that could work alongside bazel's model.
I can't tell from the documentation what the codeql CLI is actually pulling from the build, and I imagine it's quite in depth, but I assume there are other models that could work for providing the same information for certain types of builds.
For example for C++ some natural alternatives (from the user perspective) would be to:
- produce a compile_commands.json, which is also used in many other developer workflows like C++ LSPs
- produce a clang indexstore, which can be used as a query-able database for the project
- produce a kythe index
- produce a scip-clang index
Each of these options would work better in the bazel model, since indexes could be produced remotely, and cached, and compile_commands.json should already be supported for developer workflows.
related:
- Linguagem predominante
- CodeQL
- Estrelas
- 10.1k
- Forks
- 2.1k
- Merge médio
- 2d 16h
- PRs com merge (30d)
- 143
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/codeql
-
agentic-workflows
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
false-positive javascript
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
false-positive
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
Todas as issues de github/codeql
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
freedomofpress/dangerzone#1562 ·
-
Mend: dependency security vulnerability status: needs triage 🕵️♀️
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
carbon-design-system/ibm-products#9907 ·
-
intake mcp-intake needs-ac needs-human-review priority:medium type:feature
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
Ikalus1988/MisakaNet#2102 · 2 comentários ·
-
onnx-ir re-exports ModelProto and GraphProto but not NodeProto, AttributeProto and AttributeType Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
llvm/lighthouse#283 ·