librelist archives

« back to archive

changing with-profile from first-wins to last-wins

changing with-profile from first-wins to last-wins

From:
Justin Balthrop
Date:
2012-09-12 @ 23:38
It turns out that the current behavior of reversing the profile order so 
that the first profile passed to the 'with-profile' task wins is breaking 
leiningen.core.project/merge-profile so that :test cannot override :dev 
when running tests.

I'm going to remove the reverse in leiningen.core.project/apply-profiles 
to fix this.

Is anyone horribly opposed to changing how 'with-profile' works? I can 
always add a reverse in leiningen.with-profile, but it seems to me that 
having a consistent last-wins policy across the board is simpler.

- Justin

Re: [leiningen] changing with-profile from first-wins to last-wins

From:
Phil Hagelberg
Date:
2012-09-13 @ 00:02
Justin Balthrop <justin@justinbalthrop.com> writes:

> Is anyone horribly opposed to changing how 'with-profile' works? I can
> always add a reverse in leiningen.with-profile, but it seems to me
> that having a consistent last-wins policy across the board is simpler.

Just a little background here: the first-wins behaviour of with-profile
is undesirable because it's inconsistent with both clojure.core/merge
and similar functions as well as the command-line options for `java` and
friends. So while I'm reluctant to bring in a breaking change, I'd
rather do it sooner. But if it's going to cause a lot of breakage it's
up for discussion.

-Phil

Re: [leiningen] changing with-profile from first-wins to last-wins

From:
Sean Corfield
Date:
2012-09-13 @ 00:09
On Wed, Sep 12, 2012 at 4:38 PM, Justin Balthrop
<justin@justinbalthrop.com> wrote:
> Is anyone horribly opposed to changing how 'with-profile' works? I can 
always add a reverse in leiningen.with-profile, but it seems to me that 
having a consistent last-wins policy across the board is simpler.

last-wins seems more in keeping with Clojure's "thinking" with assoc etc...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

Re: [leiningen] changing with-profile from first-wins to last-wins

From:
Hugo Duncan
Date:
2012-09-13 @ 19:36
> On Wed, Sep 12, 2012 at 4:38 PM, Justin Balthrop
> <justin@justinbalthrop.com> wrote:
>> Is anyone horribly opposed to changing how 'with-profile' works? I
>> can always add a reverse in leiningen.with-profile, but it seems to
>> me that having a consistent last-wins policy across the board is
>> simpler.

Will this have any effect on dependency resolution? In particular, will
this cause transitive dependencies from plugins to overrule project
specified dependencies?

Hugo

Re: [leiningen] changing with-profile from first-wins to last-wins

From:
Justin Balthrop
Date:
2012-09-13 @ 20:02
I don't think so. Although I did notice that 
`leiningen.core.project/profile-key-merge` is concatenating collections in
reverse order:


https://github.com/technomancy/leiningen/blob/master/leiningen-core/src/leiningen/core/project.clj#L196

I believe this will have to be changed to `(concat result latter)` along 
with the removal of the reverse in 
`leiningen.core.project/apply-profiles`.



On Sep 13, 2012, at 12:36 PM, Hugo Duncan <hugo@hugoduncan.org> wrote:

> 
>> On Wed, Sep 12, 2012 at 4:38 PM, Justin Balthrop
>> <justin@justinbalthrop.com> wrote:
>>> Is anyone horribly opposed to changing how 'with-profile' works? I
>>> can always add a reverse in leiningen.with-profile, but it seems to
>>> me that having a consistent last-wins policy across the board is
>>> simpler.
> 
> Will this have any effect on dependency resolution? In particular, will
> this cause transitive dependencies from plugins to overrule project
> specified dependencies?
> 
> Hugo