Browse files

Removes run task aliases within metadata. fix #882

Removes the task to be run residing within a project's metadata (inside
:without-profiles) in addition to the original map, in order to prevent
"with-profile" from reviving already used aliases.
  • Loading branch information...
1 parent 2b00468 commit d6ba16b9da2d8414ebea90a925e85a6ef2850594 @hypirion hypirion committed Dec 11, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 leiningen-core/src/leiningen/core/main.clj
@@ -142,12 +142,20 @@
(:arglists (meta task))))
+(defn- remove-alias
+ "Removes an alias from the specified project and its metadata (which lies
+ within :without-profiles) to avoid recursive alias calls."
+ [project alias]
+ (-> project
+ (update-in [:aliases] dissoc alias)
+ (vary-meta update-in [:without-profiles :aliases] dissoc alias)))
(defn apply-task
"Resolve task-name to a function and apply project and args if arity matches."
[task-name project args]
(let [[task-alias] (for [[k v] (:aliases project) :when (= v task-name)] k)
- project (and project (update-in project [:aliases] (fnil dissoc {})
- (or task-alias task-name)))
+ project (and project (remove-alias project
+ (or task-alias task-name)))
task (resolve-task task-name)]
(when-not (or project (:no-project-needed (meta task)))
(abort "Couldn't find project.clj, which is needed for" task-name))

0 comments on commit d6ba16b

Please sign in to comment.