-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add support for lein checkouts #517
base: master
Are you sure you want to change the base?
Conversation
plugin/src/leiningen/figwheel.clj
Outdated
(source-paths-for-classpath | ||
(normalize-data project build-ids)) | ||
(normalize-data project build-ids) | ||
project) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you pass in the project created on line 437 to normalize data you won't have to change source-paths-for-classpath.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or alternatively you can just distinct-concat them onto the classpaths on line 438
plugin/src/leiningen/figwheel.clj
Outdated
(map (fn [build] | ||
(update build :source-paths concat checkout-paths)) | ||
builds))))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add checkouts needs to consider [:figwheel :builds] as well.
The approach of doing this as early as possible is the best approach. If you append the checkouts to :source-paths they can automatically be added to the classpath. This behavior should not happen if :watch-paths or :compile-paths is set. You should take a moment to look at the new :watch-paths and :compile-paths, :source-paths functionality. These give the programmer a lot more control over the behavior of the system. |
I'm curious: is there a perf cost to automatically watching checkouts? I'm
pretty liberal with checkouts but i don't necessarily add them to
:source-paths because it seems to slow things down
…On Thu, Feb 2, 2017 at 9:04 AM, Bruce Hauman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In plugin/src/leiningen/figwheel.clj
<#517>:
> (source-paths-for-classpath
- (normalize-data project build-ids))
+ (normalize-data project build-ids)
+ project)
Or alternatively you can just distinct-concat them onto the classpaths on
line 438
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#517>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADrVA8aHyIQe_VYSCFoaf3jGC_Odn7qfks5rYeKFgaJpZM4L0qMi>
.
|
Good question and it implies that this should have a knobs.
I have been thinking about
:source-paths ["src" :checkouts]
:watch-paths ["src" :checkouts :foreign-libs]
…On Thu, Feb 2, 2017 at 1:18 PM, pkpkpk ***@***.***> wrote:
I'm curious: is there a perf cost to automatically watching checkouts? I'm
pretty liberal with checkouts but i don't necessarily add them to
:source-paths because it seems to slow things down
On Thu, Feb 2, 2017 at 9:04 AM, Bruce Hauman ***@***.***>
wrote:
> ***@***.**** commented on this pull request.
> ------------------------------
>
> In plugin/src/leiningen/figwheel.clj
> <#517>:
>
> > (source-paths-for-classpath
> - (normalize-data project build-ids))
> + (normalize-data project build-ids)
> + project)
>
> Or alternatively you can just distinct-concat them onto the classpaths on
> line 438
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <#517>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ADrVA8aHyIQe_
VYSCFoaf3jGC_Odn7qfks5rYeKFgaJpZM4L0qMi>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#517 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAKQP-F5G6ngGkOmogC1IkyWzHi0RJFks5rYh4PgaJpZM4L0qMi>
.
|
how about :watch-paths ["src" :checkouts :foreign-libs :exclusions
["checkouts/clojurescript"]] , exclusions could be general I guess
On Thu, Feb 2, 2017 at 6:23 PM, Bruce Hauman <[email protected]>
wrote:
… Good question and it implies that this should have a knobs.
I have been thinking about
:source-paths ["src" :checkouts]
:watch-paths ["src" :checkouts :foreign-libs]
On Thu, Feb 2, 2017 at 1:18 PM, pkpkpk ***@***.***> wrote:
> I'm curious: is there a perf cost to automatically watching checkouts?
I'm
> pretty liberal with checkouts but i don't necessarily add them to
> :source-paths because it seems to slow things down
>
> On Thu, Feb 2, 2017 at 9:04 AM, Bruce Hauman ***@***.***>
> wrote:
>
> > ***@***.**** commented on this pull request.
> > ------------------------------
> >
> > In plugin/src/leiningen/figwheel.clj
> > <#517>:
> >
> > > (source-paths-for-classpath
> > - (normalize-data project build-ids))
> > + (normalize-data project build-ids)
> > + project)
> >
> > Or alternatively you can just distinct-concat them onto the classpaths
on
> > line 438
> >
> > —
> > You are receiving this because you are subscribed to this thread.
> > Reply to this email directly, view it on GitHub
> > <#517>, or mute the
thread
> > <https://github.com/notifications/unsubscribe-auth/ADrVA8aHyIQe_
> VYSCFoaf3jGC_Odn7qfks5rYeKFgaJpZM4L0qMi>
> > .
> >
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub
> <#517#
issuecomment-277038072>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AAAKQP-
F5G6ngGkOmogC1IkyWzHi0RJFks5rYh4PgaJpZM4L0qMi>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#517 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADrVA5WF88i_csTdL5gVUed-0T-NiNQ7ks5rYmWDgaJpZM4L0qMi>
.
|
@danielcompton Would you mind clarifying your question regarding cljsbuild, in particular "cljsbuild seems to not add all of the source paths to be built”? Not adding all of the source paths to where? Or do you mean it's not passing all of the source paths to the cljs build api? Thank you 🙂 |
@mneise the way my PR is currently, it will add all of the source paths of all of the cljsbuild configs in a checkout project to the figwheel build. Looking at the way cljsbuild behaves, it seems like it doesn't add all of the configs, only some, but I'm not sure how it does this. I could be misunderstanding things though. |
What is the use case for not watching and compiling checkouts but having them setup? One of the things I'm trying to avoid with this PR is that when we have different team members working on the same project, we each might have different checkouts (or none at all), so it would be great if we didn't need to modify the config and keep that config change out of our commits that we publish back. I'll do some testing to verify what the performance impact is of watching checkouts. Are you talking about the performance impact of watching more paths or of recompiling them? In both cases, I'm still not sure what the value of having knobs to turn would be, i.e. if there is a checkouts directory in place, why wouldn't you want projects in it to be watched and compiled? |
Daniel, I just want to make sure that you know that I'm not sold on this functionality yet. |
Simply to get bug fixes/features without the overhead of watching a couple dozen files unnecessarily. In my experience, watching a ton of files drags on recompilation times and it breaks the fw spell. Maybe things have gotten better recently idk, but given variable OS watching apis, I think a user should be able to opt out |
I'm quite keen on this functionality bacause leiningen automatically picks up checkout directories without changing a project file. |
@danielcompton if we make this a configurable option that defaults to off I'm open to moving this forward |
Ok great, I'll take another look at it and address the issues you raised. Not sure when I'll get the chance though, might be in a few weeks time. |
What is the state of this PR? I'd love to see it happen. But, if it remains controversial, perhaps a smaller change would be to modify I'd obviously prefer no-warning builds in both production and development; both with and without a checkouts directory. The status quo gives me workable production builds with just a warning about the missing checkouts dir. But, when someone else tries running my projects under Figwheel, without checkouts, the hit a hard stop of a crash:
|
@deg I hope to take another look at this PR again soonish to get it over the line, but can't give a solid date. Happy for you (or anyone else) to take my commits and open a new PR to finish this off. |
0c7e9c6
to
5c6ceda
Compare
- Add checkouts source directories to the classpath - Add checkouts source directories to :source-paths Fixes bhauman#9
I've taken another crack at this and completely reworked it to be easier to test, understand, and modify. It's ready for another review.
I've checked this. If
I added a large internal library that we have and couldn't notice any impact at all of watching the extra files. The recompile started as fast as I could save the files. If you want more fine control over the behaviour you can use
I don't really like this approach, because it is no longer automatic, and now relies on the user adding the symlinked project, and updating the project. The beauty of checkouts is that it is configured automatically and "just works". This is also the behaviour that Leiningen and lein-cljsbuild have, so it would be surprising to have to add this config for Figwheel, and would probably also conflict with using the same config for cljsbuild. |
5c6ceda
to
013ba71
Compare
OK, this looks good, I would like an explicit opt-in option. It is very plausible that there are a number of projects out there that have a lein checkouts directory that only have The main problem is that Figwheel is very different from This is a big difference, given that currently Figwheel by default only watches files in the :source-paths of the configured ClojureScript build and it doesn't watch the files specified at top level lein project.clj In terms of not breaking things for people who are currently using figwheel and as a method of trying this patch out I'd like to make it In response to not noticing lag: |
plugin/src/leiningen/figwheel.clj
Outdated
(source-paths-for-classpath | ||
(normalize-data project build-ids)) | ||
(vec build-ids)))) | ||
(let [checkout-sources (checkout-source-paths project) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could be added on https://github.com/bhauman/lein-figwheel/pull/517/files#diff-a2d728de692e56087ac2612b95a8bc4aL513 in the top level function, but it felt more appropriate to put them here. Happy to move them though, if you prefer.
Great, I'll add this. |
Awesome
…Sent from my iPad
On Jan 10, 2018, at 7:06 PM, Daniel Compton ***@***.***> wrote:
OK, this looks good, I would like an explicit opt-in option.
Great, I'll add this.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hey @danielcompton, some of your tests failed for me, because the relativized paths were coming through as e.g. “../utils-lib/src” rather than “checkouts/utils-lib/src”. I changed the tests and did a tiny refactor (just pulling a couple of things into let expressions) in this commit: atroche@3612f23 Do you think this could be a difference between our environments? I'm using OS X 10.12 and Java 1.8. |
And here's my attempt at adding the opt-in option for it: |
Will try and take a look at this again soon. I'd love to get it over the line, but I've been pretty busy and haven't quite had the brain space for it. |
This isn't necessarily ready for merge, I'm opening it to get a discussion about the way I've done this. I originally tried to get the checkouts information and pass it through into
figwheel-sidecar.repl-api
for it to add it to the source paths, but I think this way is cleaner and keeps sidecar agnostic to build tools.It might be better to add the checkouts source paths in
l.figwheel.cljs-builds
or maybe infigwheel-main
andbuild-once
? I'm not quite sure yet.Todo:
Fixes #9