-
Notifications
You must be signed in to change notification settings - Fork 9
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
Always prepend -m with -M to avoid deprecation warning #62
base: master
Are you sure you want to change the base?
Conversation
Thanks much! Looks nice to me, will take another look asap |
@rrudakov my analysis would be that this namespace should generally forward what's given as an argument - it shouldn't fix stuff for the user. Our official clojure.sh script already uses I suspect that what happens is that Elisp side, Analysis / PR welcome for cider. Cheers - V |
Hi @vemv. This PR is not related to elisp or emacs. I want to start nrepl outside of emacs and connect to it using |
A bit more details. I have the following alias in :nREPL
{:extra-deps {com.kohlschutter.junixsocket/junixsocket-common {:mvn/version "2.9.0"}
com.kohlschutter.junixsocket/junixsocket-native-common {:mvn/version "2.9.0"}
nrepl/nrepl {:mvn/version "1.1.1"}
cider/cider-nrepl {:mvn/version "0.45.0"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.9.1"}}
:main-opts ["-m" "nrepl.cmdline"
"--middleware" "[refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware]"
"--socket" "nrepl.sock"]} If I copy the Makefile from the README and add As you can see
/Users/rrudakov/.emacs.d/elpa/cider-20240220.720/clojure.sh /opt/homebrew/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.1.1\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.45.0\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.9.1\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\]\"\]\}\}\} -M:cider/nrepl It doesn't pass |
Would it be valid if deps.edn specified the following?
(edit: probably this is a bad idea if not invalid - better focus on my next post) |
Also, the Makefile says: enrich-classpath/examples/Makefile Lines 28 to 29 in f3244ba
So |
vemv ***@***.***> writes:
Would it be valid if deps.edn specified the following?
```
:main-opts ["-M" "-m" "nrepl.cmdline"
```
No, I've tried. In this case I cannot use this alias as `clojure
-M:nREPL` normally from command line.
--
Best regards, Roman
|
Yes. My Makefile: .PHONY: enrich-nrepl nrepl
HOME=$(shell echo $$HOME)
HERE=$(shell echo $$PWD)
.DEFAULT_GOAL := nrepl
SHELL = /bin/bash -Eeu
DEPS_MAIN_OPTS ?= "-M:local/backend:test/clj:nREPL"
ENRICH_CLASSPATH_VERSION="1.19.0"
.enrich-classpath-deps-repl: Makefile deps.edn $(wildcard $(HOME)/.clojure/deps.edn) $(wildcard $(XDG_CONFIG_HOME)/.clojure/deps.edn)
cd $$(mktemp -d -t enrich-classpath.XXXXXX); clojure -Sforce -Srepro -J-XX:-OmitStackTraceInFastThrow -J-Dclojure.main.report=stderr -Sdeps '{:deps {mx.cider/tools.deps.enrich-classpath {:mvn/version $(ENRICH_CLASSPATH_VERSION)}}}' -M -m cider.enrich-classpath.clojure "clojure" "$(HERE)" "true" "-M" $(DEPS_MAIN_OPTS) | grep "^clojure" > $(HERE)/$@
enrich-nrepl: .enrich-classpath-deps-repl
@if grep --silent "^clojure" .enrich-classpath-deps-repl; then \
eval $$(cat .enrich-classpath-deps-repl); \
else \
echo "Falling back to Clojure repl... (you can avoid further falling back by removing .enrich-classpath-deps-repl)"; \
clojure $(DEPS_MAIN_OPTS); \
fi
nrepl:
clojure -M:local/backend:test/clj:nREPL the full generated command in clojure "-M:local/backend:test/clj:nREPL" \
-Sforce \
-Srepro \
-J-XX:-OmitStackTraceInFastThrow \
-J-Dclojure.main.report=stderr \
-Scp src/clj:test/clj:test/resources:env/dev/clj:resources:/Users/rrudakov/.m2/repository/org/clojure/clojure/1.11.1/clojure-1.11.1.jar:/Users/rrudakov/.m2/repository/org/clojure/core.async/1.6.673/core.async-1.6.673.jar:................huge-list-here...........................:/Users/rrudakov/.m2/repository/io/netty/incubator/netty-incubator-transport-native-io_uring/0.0.18.Final/netty-incubator-transport-native-io_uring-0.0.18.Final-linux-x86_64.jar:/Users/rrudakov/.cache/mx.cider/enrich-classpath/17010/3847723509/582121401.jar:/Users/rrudakov/.cache/mx.cider/unzipped-jdk-sources/17010 \
-J--add-opens=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \
-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED \
-J-XX:-OmitStackTraceInFastThrow \
-J-client \
-J-XX:+TieredCompilation \
-J-XX:TieredStopAtLevel=1 \
-J-Xmx4g \
-J-Dclojure.tools.logging.factory=clojure.tools.logging.impl/slf4j-factory \
-J-Djdk.attach.allowAttachSelf \
-m nrepl.cmdline \
--middleware [refactor-nrepl.middleware/wrap-refactor,cider.nrepl/cider-middleware] \
--socket nrepl.sock I see my aliases are specified right after |
Probably it came to be like that for a good reason (cannot immediately check). Thanks much for helping out with the analysis. I'll give it another review during the week. Perhaps you can contribute another unit test for the -A behavior? If the user specifies -A, should a -M be prepended? Maybe the right behavior is different for -A relative to -M? |
vemv ***@***.***> writes:
I'll give it another review during the week.
Sounds good.
Perhaps you can contribute another unit test for the -A behavior? If
the user specifies -A, should a -M be prepended? Maybe the right
behavior is different for -A relative to -M?
Good point, I'll try to do some research on the topic a bit later.
--
Best regards, Roman
|
Hopefully close #37