-
Notifications
You must be signed in to change notification settings - Fork 1
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
Caches not rebuilt during git operations #27
Comments
Hidden cache data is also used in the |
Here's a quick review of where I've been on this: I started (in v2 of the generator API dropped the class-based structure. Generators are now only required to be objects. If they have a v3 is the API that will be created to fix this issue. It must combine the best aspects of v1 and v2. |
Another note: I must weight redesigning the API against just rebuilding the caches. It is possible to simply defer vcs changes instead of dropping them. I only need to read the headers of changed files, and at worse this would be like a full scan, which I do on startup anyway. The existence of Plus I'm already thinking about situations in which I need to defer VCS changes, e.g. because ephemeral generators need to be able to rebuild their files. |
Another thought: what happens when a generator's implementation performs some dynamic logic and decides whether or not to generate a particular output file? Let's say on a first run it decides to create |
After thinking about this a while I'm pretty sure the right thing to do is to make this the responsibility of changesets. Changesets associate one non-generated file with all the generated files that get made on its behalf. What we want to do is to keep multiple copies of that state -- one from before some watcher change and one from after running our generators. Then we can diff the two and figure out if there's anything built in the filesystem that should be removed. |
I was most right on the 13th. Changesets were eliminated because to have a graph you need one map which allows looking up your nodes, and it is highly useful in catching corner cases to treat the problem as a graph traversal. Previously each changeset had a queue and some state built into it. Now we have a single |
Wow it took me a long time to consider this problem : (
If our goal is not to have to do rebuild when a git checkout occurs, our algorithm can't rely on any hidden cache data because that data would not be rebuilt. Right now the most important way we use hidden cache data is to know how to delete files -- we essentially cache a graph of which files were written by which generators so that we can delete files which were written when a source disappears. For example let's say we have a config which takes
*.orig.js
and generates*.gen.js
. While checking out a commitfoo.orig.js
and the generatedfoo.gen.js
are created, but no changeset will be created forfoo.orig.js
. In this state whenfoo.orig.js
is deletedfoo.gen.js
remains because it is not clear how to delete it.Our original design for generators was not subject to this problem because it made deletion the responsibility of the generator itself. Thus the generator would simply process the
remove foo.orig.js
change and would be required to removefoo.gen.js
. Presumably assistance would be offered to the author of generators in order to make sure they get this right.The text was updated successfully, but these errors were encountered: