[SERVER-54107] compile_commands.json should have an order-only dependency on generated-sources Created: 28/Jan/21 Updated: 29/Oct/23 Resolved: 11/May/22 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Build |
| Affects Version/s: | None |
| Fix Version/s: | 6.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Mathias Stearn | Assignee: | Tausif Rahman (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Dev Platform 2022-05-02, Dev Platform 2022-05-16 |
| Participants: |
| Description |
|
Adding an order-only dependency edge ensures that all of the generated sources are built before writing the compile_commands.json. This ensures that by the time that tooling sees the compiledb, it is able to build everything in it. Without it, you may get spurious failures in an indexer if it notices the new db and tries to build anything that relies on new generated sources. This also allows people to just run ninja compiledb in order to get indexing working, and to keep it up to date as things change. |
| Comments |
| Comment by Githook User [ 11/May/22 ] |
|
Author: {'name': 'Tausif Rahman', 'email': '62212154+trahman1318@users.noreply.github.com', 'username': 'trahman1318'}Message: |
| Comment by Githook User [ 10/May/22 ] |
|
Author: {'name': 'Tausif Rahman', 'email': 'tausif.rahman@mongodb.com', 'username': 'trahman1318'}Message: Revert " |
| Comment by Tausif Rahman (Inactive) [ 09/May/22 ] |
|
Thanks for the clarification mathias@mongodb.com. Are there instances where compile_commands.json is needed/useful/valid without running generated-sources? I'm evaluating whether it is worth accommodating both scenarios or not. |
| Comment by Mathias Stearn [ 02/May/22 ] |
|
I don't think the committed fix was quite right. The order only edge needs to be specifically from compile_commands.json to generated-sources. Doing it from compiledb isn't sufficient. The issue is that we need to ensure that the generated sources are in place prior to generating the compile_commands.json file, otherwise tooling can get very confused. Tools may start processing the compile_commands.json file as soon as it exists and set up tracking for all TUs listed along with transitively included headers. Unfortunately many tools can't correctly track files that don't exist yet, so they will just note that the TU failed to compiled (hopefully it doesn't find the wrong header somewhere else!), and not automatically try compiling once the sources are generated. This can lead to incomplete results when doing things like renames or find-all-references. |
| Comment by Githook User [ 27/Apr/22 ] |
|
Author: {'name': 'Tausif Rahman', 'email': 'tausif.rahman@mongodb.com', 'username': 'trahman1318'}Message: |
| Comment by Andrew Morrow (Inactive) [ 19/Apr/22 ] |
|
Note that there are times where it is useful to be able to get just the compiledb without the generated sources. We probably want to be able to do both. |