-
-
Notifications
You must be signed in to change notification settings - Fork 21
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 CLJ_JVM_OPTS when downloading the clojure-tools. #66
Comments
@ikappaki When using the
However, I'm open to respecting This could potentially work by parsing this environment variable and setting the system properties while running deps.clj. Was that also your idea?
Thanks for being so considerate :) |
Hi @borkdude, I don't think this would be good enough, since we want to set the
I think this might work in most cases. Java advanced network configuration (such as proxies and certificates configuration) is done via java properties, so parsing the env variable and setting all The latter, calling
So, here is the simple idea: the clojure-tools download is done by a But what program do we call with java to perform the download? Clojure is not installed yet so as to run a simple script to download the dependencies, nor do we have any jars with us to call upon; The idea is to base64 encode a jar that we build with So, I can see two options so far
I think #1 could work in most of the cases unless testing or someone else demonstrates otherwise. #2 is the ultimate solution on par what we do with dependencies download, that is likely to be future proof. What do you recommend? Thanks, |
To get a sense of the importance of this issue: is this a problem you are currently experiencing, or just a problem that might happen to someone, theoretically? Alternatives:
|
As an example, I've seen this issue happening in Calva when the
Sure, this sounds like an all encompassing solution and much clearer than embedding a blob. The only minor disadvantage is that it does not support Java 1.8.
I don't think so, assuming that
This would be frustrating to newcomers that have no experience with Clojure and not sure why the need this. Ideally, I would like to tell to people with no previous experience in Clojure, to set up this variable to let Clojure tooling connect to the internet, download Calva and that's all they need to get them started. Calva is just given as an example here. Thanks |
@ikappaki I'm open to an experimental and minimal PR for downloading the tools.jar stuff, which:
I think we only have to do this if the Are there any systems around that don't have |
Hi @borkdude, let me take a step back and explain the driver behind all this, so you have a better view of why we are doing this in case you have other better ideas. It is common nowadays in large organisations to control internet traffic and this results to extra setup required for applications to connect to the wider internet. If we are to support clojure tools in these enclaves (which to me is very important for extending the clojure reach) then we need to have a way to address the network configuration part. in the tools The traditional way to address this was to introduce specific handling for specific parts of the configuration, e.g. Having solved this issue for the official clojure tools, I'm trying to apply the same solution to the other most essential tools like
This is getting slightly more complicated than I first envisaged, but I have no issue going with it. Another option perhaps could be that we use the java9+ runtime compilation facilities and fallback to the old way and if that fails to a message like "please download and install the clojure tools manually" on java1.8? I think the user codebase using java1.8 must be minimal and ready to deal with any shortcomings manually. This will address the Thanks! |
Sounds good. We can assume Java 9+ going forward for the "CLJ_JVM_OPTS" download method and fall back to the old method otherwise. |
Hi @borkdude, could you point me to an example or documentation to compile java source at runtime with the Java9+ facility? The only relevant reference I found is using the Thanks |
public class Foo {
public static void main(String [] args) {
System.out.println("Hello");
}
}
That's it. |
Note: |
Hi @borkdude,
The Clojure tools scripts have recently introduced a change to pass the value of the
CLJ_JVM_OPTS
to thejava
invocation, so as to configure the JVM while mainly downloading dependencies from the internet. A use case for this, whereby the JVM is directed to switch to the MS-Windows certificate store to connect to the internet as described at https://ask.clojure.org/index.php/12190/certificate-exception-downloading-dependencies-firewall.This has been recently implemented in
deps.clj
with #60, but there is an additional unique case thatdeps.clj
that also needs to support: the downloading of theClojureTools
from the Clojure website.This can't work out of the box, because
deps.clj
does not invoke thejava
executable when downloading the tools (so as to pass theCLJ_JVM_OPTS
at thejava
invocation) but rather uses theclojure-tools-jar-download
fn in-process to do so:deps.clj/src/borkdude/deps.clj
Lines 255 to 265 in 864d6c5
Thus, in this particular example case, when the JVM has to use an alternative certificate store, there is no way for the downloading logic to switch to an alternative certificate store, and
deps.clj
fails right at the beginning.I think what I'm advocating here is for the tools downloading logic to make use of the
CLJ_JVM_OPTS
options, and this to work across all potential uses, i.e. whendeps.clj
is called as a library dependency, or as a native executable or frombabashka
either natively or via thedeps.[.clj|bat]
scripts.Do you have any suggestions how to achieve this? I have an idea that appears to have good potential that I tested it to work in a limited scope, but I don't want to scare you off with it yet :)
Thanks
The text was updated successfully, but these errors were encountered: