paritytech / forklift

Forklift helps Cargo with caching
MIT License
22 stars 0 forks source link

Delta to `sccache` #3

Open drahnr opened 2 months ago

drahnr commented 2 months ago

Hey, I just stumbled upon this project. It appears to be a subset of #mozilla/sccache iiuc. Could you outline the difference in particular for rust projects? How do you handle c library dependencies?

AndWeHaveAPlan commented 2 months ago

Hello! This is not a fork of sccache, but the main idea is quite similar. Forklift is made specifically for Cargo caching, taking into account how Cargo builds rust code. The main difference should be the ability to cache any type of crate and do not use the absolute path, so multiple projects could share the cache (not fully implemented yet). Also, the server process is a bit "smarter" and it does some calculations, like tracking if a dependency of the current crate has already been rebuilt and we don't even need to check if cache is available. Native deps and build_script output is currently not cached, but that's the main next planned feature

drahnr commented 2 months ago

Well aware it's not a fork.

Note that abs paths would be fixable upstream, see https://github.com/paritytech/cachepot/pull/116

How do you do the mapping from rust invocation to output? How do you handle dependencies to other files and env? It appears to me that's a lot of logic reimplementation, no?

I am a bit confused on what you refer to as checking if it exists, it still needs to be fetched if it exists.

drahnr commented 2 months ago

So, looking at the code, I fail to see how you handle any dependencies that are not explicitly given. I.e.

  1. how are environment flags passed on that can result in a altered build behaviour?
  2. How are target specifics handled, i.e. compiling for a different target than the host?
  3. Where can I see the dependencies of build.rs artifact outputs as lib input dependencies, a special case of include_bytes!.

I'd be happy to see how you solved these problems? Or are they not a concern for forklift?