Open Bug 1338035 Opened 8 years ago Updated 2 years ago

Track compilation database dependency on the build system inside the build system

Categories

(Firefox Build System :: General, defect)

defect

Tracking

(Not tracked)

People

(Reporter: ehsan.akhgari, Unassigned, NeedInfo)

References

Details

Right now compile_commands.json is just an artifact of building the CompileCommands backend and there is nothing that will keep it up to date as the build config files change. Is it possible to make the build system regenerate this file (if it exists in the first place) the same way it regenerates the make backend to make sure that if the build config is current, compile_commands.json is also current? This is useful for the upcoming mach static-analyis command so that we wouldn't need to do manual file timestamp checks there.
Flags: needinfo?(mh+mozilla)
run mach build-backend --backend=CompileDB?
Flags: needinfo?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #1) > run mach build-backend --backend=CompileDB? My point is, how do I know when to run this command? The build system can know when the output is stale, otherwise I'd have to compare things like the config.status timestamp manually to know when to run this command.
Flags: needinfo?(mh+mozilla)
Looks like `mach build backend.CompileDBBackend` would do what you want, but only if CompileDB is in the list of build backends given to configure.
Flags: needinfo?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #3) > Looks like `mach build backend.CompileDBBackend` would do what you want, but > only if CompileDB is in the list of build backends given to configure. Is there a way to achieve the same result without CompileDB being passed to configure? My main goal here is to make it possible for people to run static analysis checks locally without having to change their development environment, and so far I have achieved that, so it will be nice if I don't have to ask people to change their configure options... Also as a side goal, I'd like to try to avoid having to run a mach command every time as much as possible to speed things up. Unfortunately I do need to run make export regardless so if I have to add another command there that's not the end of the world. Thanks!
(In reply to :Ehsan Akhgari from comment #4) > (In reply to Mike Hommey [:glandium] from comment #3) > > Looks like `mach build backend.CompileDBBackend` would do what you want, but > > only if CompileDB is in the list of build backends given to configure. > > Is there a way to achieve the same result without CompileDB being passed to > configure? My main goal here is to make it possible for people to run > static analysis checks locally without having to change their development > environment, and so far I have achieved that, so it will be nice if I don't > have to ask people to change their configure options... Why not just make configure check for clang-tidy and use it when it can find it, automatically enabling the CompileDBBackend? Then we can just add a make target for static analysis, that has the right dependencies on the backend file and the right export stuff.
(In reply to Mike Hommey [:glandium] from comment #5) > (In reply to :Ehsan Akhgari from comment #4) > > (In reply to Mike Hommey [:glandium] from comment #3) > > > Looks like `mach build backend.CompileDBBackend` would do what you want, but > > > only if CompileDB is in the list of build backends given to configure. > > > > Is there a way to achieve the same result without CompileDB being passed to > > configure? My main goal here is to make it possible for people to run > > static analysis checks locally without having to change their development > > environment, and so far I have achieved that, so it will be nice if I don't > > have to ask people to change their configure options... > > Why not just make configure check for clang-tidy and use it when it can find > it, automatically enabling the CompileDBBackend? Then we can just add a make > target for static analysis, that has the right dependencies on the backend > file and the right export stuff. I'm not sure if I understand your suggestion completely. We don't want to use clang-tidy out of the box, since the clang-tidy that we want to use is a custom one that we build ourselves and we need to download and install and manage in a custom way. We will have a custom mach command to allow people to use this clang-tidy (./mach static-analysis) which means there is nothing to check for in configure so it can automatically enable the CompileDBBackend, so your suggestion would only work if we enable that backend by default. Would that be acceptable?
Flags: needinfo?(mh+mozilla)
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.