-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Portable .tsbuildinfo #32023
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
Comments
Seems to be implemented by #31985 |
Currently looking at porting build outputs between machines to speed up our project build in CI and stumbled onto this issue. tsbuildinfo files don't track the hashes of the build outputs, and instead only track the most recently changed file. If moved between multiple machines, that the individual file mtimes for both the input source files and the copied cache files are going to be updated to the time the cache changed. I think that means that the cache-verification process will likely be incorrect on the first several runs if tsbuildinfo files + build outputs are copied to a new machine with a new checkout of whatever repo they come from.
It looks like the cache is being verified by a single file's timestamp because its faster than checking content hashes. On a project I work on, we solve this by storing both the hashes of all the expected output files, as well as a timestamp + machine ID to do quick reverification to work around this exact issue. I think I can work around this by also tracking and artificially updating the mtime on files in our repo's caching setup script, but I figured I'd resurrect this long-closed thread to bring up the issue and offer to help on a solution, if portable caches is something the project is still interested in. |
While we are making it easier to port |
On further investigation, moving mtimes between machines isn't super feasible either -- this would require performing content-hash checks while restoring the mtimes on new machines -- which is approaching just writing a parallel reimplementation of tsbuildinfo verification. That makes using the tsc cache across machines in its current state prohibitively cumbersome :/ If you want me to jump in and make the changes to |
As i mentioned, we dont want to add complexity to tsbuildinfo. We do not want to encode extra information and checks as it comes with the cost. We have done the changes to support portability in past where it was simple and not costly but we do not want to be encoding hashes of output or machine ids etc |
In that case @sheetalkamat would you consider adding documentation on how tsbuildinfo works so users can work around it? I have a similar situation where:
Developers are reporting that sometimes |
Is it possible to make the
tsbuildinfo
-file portable so it can be shared between different machine environments?Search Terms
tsbuildinfo, portable, cache
Suggestion
Looking at a
tsbuildinfo
-file, it contains absolute paths, both infileInfos
andoptions
. I don't know how the hashes inversion
andsignature
are created, and if they contain elements of the absolute path in some way. If not, then maybe it's enough to make the paths relative?Use Cases
We want to cache
outDir
on the CI and on local dev machines to enable instant incremental builds. But we can't currently bring back atsbuildinfo
-file from a different environment since it will be discarded as it contains absolute paths. In this case, the project will have to be rebuilt.Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: