Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Honor hooks declared in jar metadata #401

Closed
technomancy opened this Issue · 12 comments

6 participants

@technomancy
Owner

Need to sketch out a good convention for this.

@technomancy
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?

@Raynes
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.

@technomancy
Owner

Ruling out 1 after some IRC discussion on the topic.

@hugoduncan

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

@technomancy
Owner

middleware from plugins could probably be applied the same way.

@erickg

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?

@ninjudd
Collaborator

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

@ninjudd ninjudd referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@ninjudd ninjudd referenced this issue from a commit
@ninjudd ninjudd 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
@ninjudd ninjudd referenced this issue from a commit
@ninjudd ninjudd 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
@ninjudd ninjudd was assigned
@technomancy
Owner

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

@ninjudd ninjudd referenced this issue from a commit
@ninjudd ninjudd 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
@ninjudd ninjudd referenced this issue from a commit
@ninjudd ninjudd 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
@ninjudd
Collaborator

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

@ninjudd ninjudd closed this
@technomancy technomancy reopened this
@technomancy
Owner

Reopening this since we need documentation.

@technomancy
Owner

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
Something went wrong with that request. Please try again.