Skip to content
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

Honor hooks declared in jar metadata #401

Closed
technomancy opened this issue Feb 14, 2012 · 12 comments
Closed

Honor hooks declared in jar metadata #401

technomancy opened this issue Feb 14, 2012 · 12 comments
Assignees
Milestone

Comments

@technomancy
Copy link
Owner

Need to sketch out a good convention for this.

@technomancy
Copy link
Owner Author

Two options so far:

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

  2. 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?

@Raynes
Copy link
Collaborator

Raynes commented Apr 2, 2012

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.

@technomancy
Copy link
Owner Author

Ruling out 1 after some IRC discussion on the topic.

@hugoduncan
Copy link
Contributor

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

@technomancy
Copy link
Owner Author

middleware from plugins could probably be applied the same way.

@ghost
Copy link

ghost commented Jun 6, 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
Copy link

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

@ninjudd
Copy link
Collaborator

ninjudd commented Jul 23, 2012

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

ninjudd added a commit that referenced this issue Jul 25, 2012
- this is a first pass at #401
- there are still some questions about the order of everything
- the current implementation may still break #599
ninjudd added a commit that referenced this issue Jul 26, 2012
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
@ghost ghost assigned ninjudd Aug 1, 2012
@technomancy
Copy link
Owner Author

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

ninjudd added a commit that referenced this issue Aug 13, 2012
- this is a first pass at #401
- there are still some questions about the order of everything
- the current implementation may still break #599
ninjudd added a commit that referenced this issue Aug 13, 2012
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
@ninjudd
Copy link
Collaborator

ninjudd commented Aug 13, 2012

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

@ninjudd ninjudd closed this as completed Aug 13, 2012
@technomancy technomancy reopened this Aug 21, 2012
@technomancy
Copy link
Owner Author

Reopening this since we need documentation.

@technomancy
Copy link
Owner Author

Sounds like the docs are in for this; cool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants