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 each composite profiles #77

Merged
merged 6 commits into from
Sep 29, 2020
Merged

Fix each composite profiles #77

merged 6 commits into from
Sep 29, 2020

Conversation

greglook
Copy link
Collaborator

This bug turns out to be a really gnarly interaction deep inside Leiningen that I still don't fully understand, but for some reason supplying multiple profiles to init-project adds a number of metadata profiles with :aliases nil entries here:
https://github.com/technomancy/leiningen/blob/94a1b2e6c9cd2028400c2e8abb4797d3f4116ef1/leiningen-core/src/leiningen/core/project.clj#L1019-L1022

This in turn causes the meta-merge call in apply-profiles to try merging {:aliases nil} into the :uberjar profile:
https://github.com/technomancy/leiningen/blob/94a1b2e6c9cd2028400c2e8abb4797d3f4116ef1/leiningen-core/src/leiningen/core/project.clj#L621

When :uberjar is a map, this works okay because the nil is a no-op. When it's a composite profile though, this tries to merge the map into the vector, which winds up coercing it into a sequence. The main difference in how these profiles get activated is that each injects the profiles directly by supplying it as a default vs a subproject where it is loaded by metadata. Since the subproject case works, try injecting the middleware instead of the profiles and let the machinery operate the same way there.

Fixes #29

@greglook greglook requested a review from a team September 28, 2020 16:19
Copy link
Member

@jstokes jstokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

src/lein_monolith/plugin.clj Outdated Show resolved Hide resolved
@greglook greglook merged commit 353e050 into master Sep 29, 2020
@greglook greglook deleted the fix-each-composite-profiles branch September 29, 2020 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

:monolith/inherit breaks composite profiles when run from repo root
2 participants