-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Reset fileset should merge changes on top of source files (fixes #330) #338
Conversation
@micha what will happen if the user modifies the original file? I.e. some tasks modify |
@martinklepsch yep, and this is correct behavior i think, because if you want to modify those files incrementally you'd put the associated tasks after the watch task in the pipeline. |
Hm. The alternative would be to have the task-modified versions take precedence which would also make sense in a way because the watch task watches things "after" those tasks? |
The task-modified versions do take precedence with this patch. The bug that was reported was that task-modified versions were being overwritten by the user files. |
This is all kind of a bikeshed too, because why make things complicated? Just put the watch task first in the pipeline and avoid all these complications. |
I think we misunderstood then but everything is clear now. I think it makes sense to have tasks that are only required to run once outside of the watch loop. Less overhead for incremental compilation cycles. That said probably tasks like |
👍 🚀 |
Yeah all tasks should be caching their own results and doing a diff on the fileset to avoid doing unnecessary work. That said, the cljs-repl task is only writing this one file which is adding maybe a few microseconds to the build time. I guess it's more of a problem that people see the task saying it's doing things and they think that they can make things faster by optimizing their pipeline, which isn't really the case. So we should probably have the tasks not rewrite those files just to avoid confusing the user. |
Reset fileset should merge changes on top of source files (fixes #330)
@micha The reason I put It's not a big deal if "that's not the way to do it" (in my case I just put it after), but how will users know that? |
@pandeiro I wasn't trying to say "that's not the way to do it", sorry if it looked that way :) Is there any reason why your task isn't compatible with being called again by the watcher? |
@pandeiro I think the behavior you reported was a bug and thus has been changed to preserve the file as it has been changed by tasks in the pipeline before |
@micha Nope it totally can be put after |
@pandeiro If a task before watch modifies a file this modified version will be passed to any further invocations in the watch loop no matter if you change this file in your source dirs. This is the only caveat as far as I'm aware/understand. |
Yep, I think that's the situation. Like in your case, the main.cljs.edn file is processed by the repl task before the watch task is called. This patch ensures that the version of the file produced by the task overwrites the original main.cljs.edn file in your source paths each time the rest of the pipeline runs. Now if you change main.cljs.edn the changes won't be seen by tasks after the watch task, because the changes are being overwritten by the version produced by the repl task. This is logical and correct, because there is no way for the watcher task to know that it should rerun things that come before it, like the repl task, to accomodate changes to main.cljs.edn in your source files. So the reason why you wouldn't want to put the repl task in front of the watch task is to eliminate the need for the user to know the relationship between main.cljs.edn and the repl task. Basically, if you put tasks in front of the watch task you're fixing those files at that point in time, and that might have other consequences that are not readily apparent to the user. |
No description provided.