Skip to content
This repository

Honor hooks declared in jar metadata #401

Closed
technomancy opened this Issue February 13, 2012 · 12 comments

6 participants

Phil Hagelberg Justin Balthrop Anthony Grimes Hugo Duncan Erick Gonzalez Alexander Yakushev
Phil Hagelberg
Owner

Need to sketch out a good convention for this.

Phil Hagelberg
Owner

Two options so far:

0) For each entry in :plugins, look for a leiningen.$PLUGIN.hooks namespace and require it.

1) Scan all jar manifests coming from plugins for a certain lein-specific key pointing to namespaces containing hooks and require them.

The former is probably faster, but it does not allow for hooks to be declared in transitive dependencies. This may be a good thing. Thoughts?

Anthony Grimes
Collaborator

It feels like the former solution is the cleaner of the two and the most simplistic. I'd prefer it unless there were specific reasons that it would be disadvantageous.

Phil Hagelberg
Owner

Ruling out 1 after some IRC discussion on the topic.

Hugo Duncan

How about middleware from plugins? or maybe that is a separate issue...

Phil Hagelberg
Owner

middleware from plugins could probably be applied the same way.

Erick Gonzalez
erickg commented June 06, 2012

As a follow up to the post I made on the group, this mechanism would indeed fill the gap left after the fix for #599 . I am working on a relatively large project where we have a plugin that allows us to "centralize" dependencies accross all modules. Until now, we were using a middleware from this plugin to add all required dependencies (and other properties) to the project. So option 0. would be nice, and of course being able to still modify the project before being passed to the tasks as middlewares were able to do until recently.

Alexander Yakushev

So what is the status of this? Will Leiningen 2 be released without plugin middleware support?

Justin Balthrop
Collaborator

I'm working on implementing this based on the discussion here: http://lazybot.org/logs/#leiningen/2012-07-19

Justin Balthrop ninjudd referenced this issue from a commit July 24, 2012
Commit has since been removed from the repository and is no longer available.
Justin Balthrop ninjudd referenced this issue from a commit July 24, 2012
Justin Balthrop automatically load middleware and hooks from plugins
- this is a first pass at #401
- there are still some questions about the order of everything
- the current implementation may still break #599
5b349ab
Justin Balthrop ninjudd referenced this issue from a commit July 25, 2012
Justin Balthrop apply middleware whenever project profiles are modified
This can happen in merge-profiles, unmerge-profiles or in the newly
added reset-profiles. All three rebuild the project map from scratch
using `(:without-profiles (meta project))`. This prevents middleware
from being applied twice to the same project map.

We also have to call apply-middleware explicitly in init-project because
we want to load-plugins before applying middleware in this case only. An
alternative would be to load plugins every time project profiles are
modified. @technomancy, what do you think of that option?

Issue #401
373d529
Phil Hagelberg
Owner

Should we try to get this in for preview8? I would like to release it early next week.

Justin Balthrop ninjudd referenced this issue from a commit July 24, 2012
Justin Balthrop automatically load middleware and hooks from plugins
- this is a first pass at #401
- there are still some questions about the order of everything
- the current implementation may still break #599
ddc2ca0
Justin Balthrop ninjudd referenced this issue from a commit July 25, 2012
Justin Balthrop apply middleware whenever project profiles are modified
This can happen in merge-profiles, unmerge-profiles or in the newly
added reset-profiles. All three rebuild the project map from scratch
using `(:without-profiles (meta project))`. This prevents middleware
from being applied twice to the same project map.

We also have to call apply-middleware explicitly in init-project because
we want to load-plugins before applying middleware in this case only. An
alternative would be to load plugins every time project profiles are
modified. @technomancy, what do you think of that option?

Issue #401

Conflicts:
	leiningen-core/src/leiningen/core/main.clj
	src/leiningen/pom.clj
84c93a2
Justin Balthrop
Collaborator

I just merged this from the auto-middleware branch into master.

Justin Balthrop ninjudd closed this August 13, 2012
Phil Hagelberg technomancy reopened this August 21, 2012
Phil Hagelberg
Owner

Reopening this since we need documentation.

Phil Hagelberg
Owner

Sounds like the docs are in for this; cool.

Phil Hagelberg technomancy closed this August 24, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.