I want to test the nrepl stuff and ClojureCLR in general. Though I have no clue how to. I’m on a Mac. Want to see if I can keep the .Net stuff in Docker. Here’s my WIP project: https://github.com/PEZ/clojure-clr-test Am I even close? Clojure.Main fails if I run it from the terminal in the docker container…
Clojure.Main is not on your PATH
try this
FROM
RUN apt-get update \
&& apt-get install -y wget unzip
RUN dotnet tool install --global --version 1.12.0-alpha7 Clojure.Main
RUN apt-get clean \
&& rm -rf /var/lib/apt/lists/*
CMD ["/root/.dotnet/tools/Clojure.Main"] you can run the stable version too, but then you’ll need a base image that provides version 6 of .NET
I’d go with the latest alpha 🙂
Thanks! Now I get the REPL prompt!
A bit late to the party but I came here say you can run dotnet tools like this: dotnet tool run Clojure.Main .
Now trying to figure out how to test clr.tools.nrepl . There are Leiningen/maven coordinates in the README…. Is there a tutorial on how to create a project setup?
environment variable CLOJURE_LOAD_PATH is the equivalent.
The equivalent to the classpath? I tried this now:
user=> (System.Environment/GetEnvironmentVariable "CLOJURE_LOAD_PATH")
"/my_clojureclr_project/test:/my_clojureclr_project/src:/my_clojureclr_project/dev-resources:/my_clojureclr_project/resources:/my_clojureclr_project/target/classes:/root/.m2/repository/org/clojure/clr/tools.nrepl/0.1.0-alpha1/tools.nrepl-0.1.0-alpha1.jar:/root/.m2/repository/org/clojure/clr/tools.reader/1.3.7/tools.reader-1.3.7.jar:/root/.m2/repository/nrepl/nrepl/1.0.0/nrepl-1.0.0.jar:/root/.m2/repository/org/nrepl/incomplete/0.1.0/incomplete-0.1.0.jar"
user=> (require '[clojure.tools.nrepl])
Execution error (FileNotFoundException) at System.Diagnostics.StackFrame/ (NO_FILE:0).
Could not locate clojure/tools/nrepl with extensions .cljr, .cljc, .cljr, .cljr.dll, .cljc.dll, or .clj.dll on load path.A big part of the problem here is that I do not know what I am doing. It was 15 years ago since I did anything .Net.
(I created that load path using Leiningen.)
The code for breaking down the components of the CLOJURE_LOAD_PATH is
string rawpaths = (string)System.Environment.GetEnvironmentVariable(ClojureLoadPathString);
string[] paths = rawpaths.Split(Path.PathSeparator);
The value of Path.PathSeparator is supposed to be system-dependent. Maybe eval
System.IO.Path/PathSeparator
and see what it says. Leiningen should know the proper paths, for sure.Are you still doing this out of Docker? Getting paths right in that circumstance is beyond my knowledge.
Still in Docker, yes. Am I supposed to be able to do lein run?
What do I do with the paths once I have separated them?
Ah, so that’s the code that ClojureCLR uses?
user=> System.IO.Path/PathSeparator
\:
user=> The path looks cool to me.
# ls /root/.m2/repository/org/clojure/clr/tools.nrepl/0.1.0-alpha1/
_remote.repositories tools.nrepl-0.1.0-alpha1.pom
tools.nrepl-0.1.0-alpha1.jar tools.nrepl-0.1.0-alpha1.pom.sha1
tools.nrepl-0.1.0-alpha1.jar.sha1Lein runs in java land and knows how to use maven, read poms, grok jars. That's what is doing in the background to get the code in your local cache. ClojureCLR can't handle all that. (which is why i'm working feverishly to port tools.deps -- then we weill be able to get automatic pulls of dependencies from git repos and nuget.) For now, I'd just clone the repo into someplace nice and have the path include something-nice.../src/main/clojure .
And wish me speedy success on porting tools.deps.
Wishing you speedy success!
Clone what repo? The nrepl one?
nrepl and whatever it depends on.
I tried with installing Leiningen in the container and can adding a project.clj, using the :main.cmd to launch the nrepl server. But this is probably not the way to go. Leiningen is run by Java and and complains.
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
So, how do I get clr.tool.nrepl on the classpath? (If classpath is even a concept on the CLR…) My test project is here: https://github.com/PEZ/clojure-clr-test