Fork me on GitHub
#calva
<
2023-06-03
>
wickedev16:06:37

I have been experimenting with gradle recently, but I'm encountering issues with Calva when working with multi-modules. Calva seems to struggle with handling multiple .nrepl-port files for each module. I believe I need to choose one of the modules declared in settings.gradle or settings.gradle.kts and connect to it using the jack-in. if my understanding is correct, I'm planning to submit a PR to improve it. Thanks for making a great project.

bringe18:06:25

I'm not familiar with using gradle, but you can disable the auto selection of an nrepl port from a port file using the setting calva.autoSelectNReplPortFromPortFile (defaults to true). Maybe with that disabled, you can start your repl(s) without using jack-in, then use the Calva command "Calva: Connect to a Running REPL Server in the Project" - this should prompt you for a host and port for nrepl.

bringe18:06:21

If you want jack-in to work with your project, maybe it can/does, but more info about your project structure would help.

bringe18:06:48

And maybe @U0ETXRFEW can help more here.

pez21:06:51

I’m not sure what this means: > Calva seems to struggle with handling multiple .nrepl-port files for each module. OTH, I don’t know what multi-modules is either. 😃 Please elaborate a bit, @U03N5K4DZ1D. You could do that in an issue, if you like, describing what the PR would fixing it would do.

wickedev02:06:24

The menu selection is omitted in calva Gradle. This will excute ./gradlew clojureRepl instead of ./gradlew :submodule:clojureRepl to run the clojureRepl task in all modules. Because each module's clojureRepl task creates its own .nrepl-port, the REPL seems to be confused about which port to select. In my opinion, the problem would be solved by extracting the module declared in settings.gradle or settings.gradle.kts with regular expression and making it selectable.

bringe16:06:22

@U0ETXRFEW Do we want to add something specific to Gradle to the jack-in process, or should this be left as a "connect only" scenario?

pez17:06:26

I think we already have gradle jack-in.

👍 2
pez17:06:55

@U03N5K4DZ1D you are welcome to have a look at what could be done. It sounds a bit brittle with using regex, but it will depend on where we apply them.

wickedev17:06:30

I looked for a groovy or kotlin script parser that can use in javascript, but didn't find one. I thought it would be overkill to write a full parser in js for this task, so I suggested regular expressions, albeit imperfectly. If JVM runtime is available, have a bit more choice.

wickedev17:06:55

In groovy script [ "foo", "bar", "baz" ] should be extracted.

include 'foo', "bar"
include 'baz'
In kotlin script, can replace it like below.
include("foo", "bar")
include("baz")