Honor hooks declared in jar metadata #401

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

Comments

5 participants
@technomancy
Owner

technomancy commented Feb 14, 2012

Need to sketch out a good convention for this.

@technomancy

This comment has been minimized.

Show comment
Hide comment
@technomancy

technomancy Apr 2, 2012

Owner

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?

Owner

technomancy commented Apr 2, 2012

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

This comment has been minimized.

Show comment
Hide comment
@Raynes

Raynes Apr 2, 2012

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.

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

This comment has been minimized.

Show comment
Hide comment
@technomancy

technomancy Apr 2, 2012

Owner

Ruling out 1 after some IRC discussion on the topic.

Owner

technomancy commented Apr 2, 2012

Ruling out 1 after some IRC discussion on the topic.

@hugoduncan

This comment has been minimized.

Show comment
Hide comment
@hugoduncan

hugoduncan May 10, 2012

Contributor

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

Contributor

hugoduncan commented May 10, 2012

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

@technomancy

This comment has been minimized.

Show comment
Hide comment
@technomancy

technomancy May 10, 2012

Owner

middleware from plugins could probably be applied the same way.

Owner

technomancy commented May 10, 2012

middleware from plugins could probably be applied the same way.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost 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.

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

This comment has been minimized.

Show comment
Hide comment
@alexander-yakushev

alexander-yakushev Jul 23, 2012

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

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

@ninjudd

This comment has been minimized.

Show comment
Hide comment
@ninjudd

ninjudd Jul 23, 2012

Collaborator

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

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

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

ninjudd added a commit that referenced this issue Jul 26, 2012

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

@ghost ghost assigned ninjudd Aug 1, 2012

@technomancy

This comment has been minimized.

Show comment
Hide comment
@technomancy

technomancy Aug 10, 2012

Owner

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

Owner

technomancy commented Aug 10, 2012

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

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

ninjudd added a commit that referenced this issue Aug 13, 2012

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
@ninjudd

This comment has been minimized.

Show comment
Hide comment
@ninjudd

ninjudd Aug 13, 2012

Collaborator

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

Collaborator

ninjudd commented Aug 13, 2012

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

@ninjudd ninjudd closed this Aug 13, 2012

@technomancy technomancy reopened this Aug 21, 2012

@technomancy

This comment has been minimized.

Show comment
Hide comment
@technomancy

technomancy Aug 21, 2012

Owner

Reopening this since we need documentation.

Owner

technomancy commented Aug 21, 2012

Reopening this since we need documentation.

@technomancy

This comment has been minimized.

Show comment
Hide comment
@technomancy

technomancy Aug 24, 2012

Owner

Sounds like the docs are in for this; cool.

Owner

technomancy commented Aug 24, 2012

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