| ▲ | stackghost 3 hours ago | |
>Build everything from source within a single unified workspace, cache whatever artifacts were already built with content-addressable storage so that you don't need to build them again. Which tool do you use for content-addressable storage in your builds? >You should also avoid libraries, as they reduce granularity and needlessly complexify the logic. This isn't always feasible though. What's the best practice when one cannot avoid a library? | ||
| ▲ | mgaunard 2 hours ago | parent [-] | |
You can use S3 or equivalent; a normal filesystem (networked or not) also works well. You hash all the inputs that go into building foo.cpp, and then that gives you /objs/<hash>.o. If it exists, you use it; if not, you build it first. Then if any other .cpp file ever includes foo.hpp (directly or indirectly), you mark that it needs to link /objs/<hash>.o. You expand the link requirements transitively, and you have a build system. 200 lines of code. Your code is self-describing and you never need to write any build logic again, and your build system is reliable, strictly builds only what it needs while sharing artifacts across the team, and never leads to ODR. | ||