Skip to content

Conversation

@darwin
Copy link

@darwin darwin commented Apr 12, 2016

The problem with generated .lein-env is that it does not play well with more advanced project.clj setups where one would like to run multiple lein tasks in parallel or use different lein profiles with different env settings. Currently, the last task "wins" (or .lein-env could get potentially clobbered).

This is just a proposal which works for my scenarios. It relies on the fact that shell-command is called for all java-related compilations (including clojurescript) and we can modify init form to set environment directly. I'm unable to reason about its full correctness under all circumstances because I'm not an Leiningen expert. I would like to discuss it here.

The problem with generated .lein-env is that it does not play well with
more advanced project.clj setups where one would like to run multiple
lein tasks in parallel or use different lein profiles with different env
settings.
@darwin darwin force-pushed the direct-env-setup branch from e414719 to c05a4a1 Compare April 12, 2016 15:33
@weavejester
Copy link
Owner

This seems like it could be fragile around trampolining, and perhaps other Leiningen functions. Is this just trading one set of problems for another? Also, using an atom seems like it might cause issues for parallel Leiningen build chains, such as in lein pdo.

@darwin
Copy link
Author

darwin commented Apr 12, 2016

Yes, I agree that this could be fragile. Maybe someone could come up with a better solution.

I don't like the env capturing in atom at all. Would be great if that information could be obtained safely in shell-command hook somehow.

@brianru
Copy link

brianru commented Jan 18, 2017

What about adding a PID suffix to the file?

I just ran into this issue, though the fix I'm going with is to use separate environment variables for each of the builds we're running in parallel. Which makes sense for my use-case as I'm building different services from one mono-repo, but may not make sense for other use-cases.

@weavejester
Copy link
Owner

I don't think there's a platform independent way of getting the PID in Java, unfortunately.

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.

3 participants