Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache build targets #58

Open
bahmanm opened this issue Aug 26, 2023 · 2 comments
Open

Cache build targets #58

bahmanm opened this issue Aug 26, 2023 · 2 comments
Labels
💡 idea Needs investigation/research

Comments

@bahmanm
Copy link
Owner

bahmanm commented Aug 26, 2023

Follow up on a conversation on Mastodon.

Is it possible to have a smarter™ way of caching a target based on the contents rather than modification time?

For example:

_expensive-target-workhorse:
	a bunch of expensive commands

expensive-target : _expensive-target-workhorse!cached

One idea for the implementation (non-PHONY targets) is to store the caches in PROJECT_ROOT/.bmakelib-caches & use checksums to identify if a target exists in the cache and retrieve the value. In the case of directories, the checksum of the tar'ed archive can be used.

@bahmanm bahmanm added the 💡 idea Needs investigation/research label Aug 26, 2023
@bahmanm bahmanm added the ✅ enhancement New feature or request label Sep 30, 2023
@ACleverDisguise
Copy link

I'm not sure how this would work. Could you outline what you mean?

@bahmanm
Copy link
Owner Author

bahmanm commented Oct 5, 2023

Say you have a target named expensive.bin which does some expensive compiling and linking to produce, well, the executable expensive.bin.

You've also got one simple file which expensive.bin depends upon. For example, simple.foo.

  1. You make expensive.bin and do some tests.
  2. You modify simple.foo and make expensive.bin.
  3. You're not happy w/ the results, so you undo your changes and make expensive.bin which makes simple.foo in the process too.

If there was a build cache, the "remaking in (3) could have been avoided b/c Make could tell that it had already made simple.foo and expensive.bin w/ the exact same contents in (2) and there's no need to remake things. In that case, could simply move the artefacts from the cache to the "build" directory and call it done.

Does that make sense?

@bahmanm bahmanm added ✅ enhancement New feature or request and removed ✅ enhancement New feature or request labels Oct 22, 2023
@bahmanm bahmanm removed the ✅ enhancement New feature or request label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 idea Needs investigation/research
Projects
None yet
Development

No branches or pull requests

2 participants