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

Support for aliases/alternative create-basis #32

Open
thenonameguy opened this issue Nov 7, 2022 · 1 comment
Open

Support for aliases/alternative create-basis #32

thenonameguy opened this issue Nov 7, 2022 · 1 comment
Labels
bug Something isn't working feedback Waiting for feedback

Comments

@thenonameguy
Copy link
Contributor

This might be possible today, but I have yet to figure it out how it would be doable:
I want to build 2 uberjars from my application code.

  1. the "normal" one, just using deps.edn with no aliaes whatsoever.
  2. a custom dev-specific one, just with AOT'd code. This way FE devs are not compiling every single day the whole classpath including :test and :dev aliases from scratch.

Use-case 1. works perfectly.
For 2. I tried defining a custom buildCommand with a build.clj that calls create-basis with the necessary aliases.
This didn't work as it tried resolving the maven dependency ranges during sandboxed build-time (network calls).
https://github.com/clojure/tools.deps.alpha/blob/master/src/main/clojure/clojure/tools/deps/alpha/extensions/maven.clj#L79-L80

From a preliminary look https://github.com/bevuta/clojure-nix-locker seems to be able to solve this problem using it's design, but I much prefer clj-nix conceptually and don't want to switch away for this reason.
Is this a solveable problem using the current lock-file layout?

@jlesquembre
Copy link
Owner

hi, if I understood it, in theory you should be able to do that (use any aliases in a custom buildCommand)

But there are some corner cases with maven I wasn't able to solve yet. Specifically, if one of your dependencies uses version ranges, sometime maven hits the network.
What is the dependency giving you problems?

I remember in clojure-lsp, maven insisted on downloading a dependency even if it was excluded:

https://github.com/jlesquembre/clojure-lsp/blob/58947e43f51641b571682918a63e4e1e6b54bc4a/cli/deps.edn#L6-L7

The solution was hacky, I added a file to the maven cache, so maven thought that the dependency was there:
https://github.com/jlesquembre/clojure-lsp/blob/58947e43f51641b571682918a63e4e1e6b54bc4a/flake.nix#L36-L49

Can you share the problematic dependency to check if it's the same issue? I'd like to have a proper solution for this case, but unfortunately I didn't have too much time to work onclj-nix lately.

One last question, are you sure that https://github.com/bevuta/clojure-nix-locker will work on your case? My understanding is that clojure-nix-locker should face the same issue. If not, I'll take a look again to see how they fixed it.

@jlesquembre jlesquembre added bug Something isn't working feedback Waiting for feedback labels Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feedback Waiting for feedback
Projects
None yet
Development

No branches or pull requests

2 participants