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

Fix parallel inherited aliases #74

Merged
merged 4 commits into from
Sep 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ This project adheres to [Semantic Versioning](http://semver.org/).
will be properly quoted for shells.
[#27](https://github.com/amperity/lein-monolith/issues/27)
[#72](https://github.com/amperity/lein-monolith/pull/72)
- When `each` is used with `:parallel`, task aliases are now correctly resolved
before iteration starts.
[#36](https://github.com/amperity/lein-monolith/issues/36)
[#74](https://github.com/amperity/lein-monolith/pull/74)


## [1.5.0] - 2020-09-17
Expand Down
1 change: 1 addition & 0 deletions example/libs/lib-b/project.clj
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(defproject example/lib-b "0.2.0"
:description "Example lib depending on lib-a."
:monolith/inherit [:aliases]

:dependencies
[[example/lib-a "1.0.0"]
Expand Down
7 changes: 6 additions & 1 deletion example/project.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
(defproject example/all "MONOLITH"
:description "Overarching example project."

:aliases
{"version+" ["version"]
"version++" ["version+"]}

:plugins
[[lein-monolith "1.5.1-SNAPSHOT"]
[lein-pprint "1.2.0"]]
Expand All @@ -14,7 +18,8 @@

:monolith
{:inherit
[:test-selectors
[:aliases
:test-selectors
:env]

:inherit-leaky
Expand Down
21 changes: 11 additions & 10 deletions src/lein_monolith/task/each.clj
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@
subproject
(reduce-kv
(fn inject-profile [p k v] (assoc-in p [:profiles k] v))
subproject inherited)
subproject
inherited)
(config/debug-profile "init-subproject"
(locking init-lock
(project/init-project subproject (cons :default (keys inherited)))))
Expand Down Expand Up @@ -254,22 +255,22 @@
(defn- resolve-tasks
"Perform an initial resolution of the task to prevent metadata-related
arglist errors when namespaces are loaded in parallel."
[task+args]
(let [task (first task+args)]
[project task+args]
(let [[task args] (lein/task-args task+args project)]
(lein/resolve-task task)
;; Some tasks pull in other tasks, so also resolve them.
(condp = task
"do"
(doseq [subtask+args (lein-do/group-args (rest task+args))]
(resolve-tasks subtask+args))
(doseq [subtask+args (lein-do/group-args args)]
(resolve-tasks project subtask+args))

"update-in"
(let [subtask+args (rest (drop-while #(not= "--" %) task+args))]
(resolve-tasks subtask+args))
(let [subtask+args (rest (drop-while #(not= "--" %) args))]
(resolve-tasks project subtask+args))

"with-profile"
(let [subtask+args (drop 2 task+args)]
(resolve-tasks subtask+args))
(let [subtask+args (rest args)]
(resolve-tasks project subtask+args))

;; default no-op
nil)))
Expand Down Expand Up @@ -344,7 +345,7 @@
[ctx threads targets]
(let [deps (partial dep/upstream-keys (dep/dependency-map (:subprojects ctx)))
thread-pool (executor/fixed-thread-executor threads)]
(resolve-tasks (:task ctx))
(resolve-tasks (:monolith ctx) (:task ctx))
(->
(reduce
(fn future-builder
Expand Down