Fork me on GitHub
#shadow-cljs
<
2018-08-06
>
bupkis05:08:20

after updating to shadow-cljs 2.4.30, the I get an empty .nrepl-port, and shadow-cljs server shows shadow-cljs - nREPL server started on port (no port shown). the shadow-cljs.edn is very simple:

{:dependencies [[zprint "0.4.10"]
                [funcool/cuerdas "2.0.5"]]
 :source-paths ["src"]
 :builds {:test2 {:target :node-script
                  :main fmtz2.core/main
                  :output-to "out/test2.js"}}}

bupkis05:08:23

going back to 2.4.28 works fine

thheller07:08:40

@samuel.wagen there should be a warning printed on startup if nrepl fails?

bupkis07:08:43

shadow-cljs - config: /Users/bupkis/dev/test2/shadow-cljs.edn  cli version: 2.4.30  node: v10.8.0
shadow-cljs - starting ...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.xnio.nio.NioXnio$2 (file:/Users/bupkis/.m2/repository/org/jboss/xnio/xnio-nio/3.3.8.Final/xnio-nio-3.3.8.Final.jar) to constructor sun.nio.ch.KQueueSelectorProvider()
WARNING: Please consider reporting this to the maintainers of org.xnio.nio.NioXnio$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
shadow-cljs - server version: 2.4.30
shadow-cljs - server running at 
shadow-cljs - socket REPL running on port 55789
shadow-cljs - nREPL server started on port

bupkis07:08:50

only warnings are the JDK10 ones in xnio

bupkis07:08:57

but I get those with working versions too

thheller07:08:32

oh right nevermind. I just broke it

thheller07:08:56

@samuel.wagen should be fixed in 2.4.31

bupkis08:08:57

it now starts the nrepl server, but when I do (shadow/node-repl) from Cursive - I get RuntimeException Can't resolve find-ns clojure.lang.Util.runtimeException (Util.java:221)

thheller08:08:08

what the heck

thheller08:08:50

this used to only happen with cider

bupkis08:08:02

no cider in this particular project

thheller08:08:24

do you have the full stacktrace?

bupkis08:08:36

cursive isn't showing it to me

bupkis08:08:11

let me try outside of cursive

bupkis08:08:59

hmm that only happens in cursive

bupkis08:08:28

if i start the server, and in another terminal do shadow-cljs clj-repl and from that I do (shadow/node-repl) - I get to the CLJS repl no problem

bupkis08:08:39

but in cursive - the above error. going back to 2.4.28 fixes it

thheller08:08:02

yeah the problem lies in nrepl

thheller08:08:18

it is doing something with the classloader

bupkis08:08:20

intellij is 2018.2, cursive is 1.8.0-eap4-2018.2 if that matters

thheller08:08:35

no its a shadow-cljs side problem

thheller08:08:41

or rather nrepl server side

bupkis08:08:59

could it be connected to another problem I'm having with versions >2.4.28? it also has issues in a project where I use refactor-nrepl (`[WARNING] No nREPL middleware descriptor in metadata of #'refactor-nrepl.middleware/wrap-refactor, see nrepl.middleware/set-descriptor!`), but I guess that's not a shadow issue, more of an issue between the new nrepl and refactor-nrepl

thheller08:08:49

cider-nrepl as of 0.18.0 uses nrepl 0.4

thheller08:08:25

I'm not sure if there is a refactor-nrepl upgrade out yet

thheller08:08:39

but I said you use cursive? why the middleware then?

bupkis08:08:47

I said above it's in a different project, just thought it could be related since it started in >2.4.28 too.

bupkis08:08:50

sorry for confusing you

thheller08:08:08

the entire problem is due to nrepl 0.4 not being compatible with 0.2

thheller08:08:26

so libraries written for 0.2 stop working

thheller08:08:48

cider had a new release yesterday for 0.4

bupkis08:08:56

but Cursive perhaps isn't supporting 0.4 yet?

thheller08:08:04

cursive doesn't care

thheller08:08:17

it doesn't use any middleware so it works either way

bupkis08:08:23

but it still uses nrepl?

bupkis08:08:38

ah so only the middlewares are having issues, not vanilla nrepl clients

thheller08:08:35

clients are unaffected since the nrepl messages didn't change

bupkis08:08:56

but shadow is affected (in the cursive case) somewhat?

thheller08:08:40

it seems to work for me. I cannot reproduce the find-ns problem

bupkis08:08:18

weird. let me blow away the .shadow-cljs directory and try again. the config is above - very vanilla

thheller08:08:18

hehe what the actual F*$#

thheller08:08:05

I tracked the problem down to tools.logging a while ago but thought it was just masking a different underlying issue

thheller08:08:11

I now fixed the tools.logging issue

thheller08:08:15

and the problem goes away

bupkis08:08:37

ha, it really is a wtf

bupkis08:08:56

why does tools.logging mess with the class loader

thheller08:08:49

so tools.logging uses *ns* all over the place which results in this find-ns call

thheller08:08:56

WHY exactly it fails I have no idea

thheller08:08:10

so I'm really just treating a symptom when fixing tools.logging

thheller08:08:17

the underlying issue I have not yet identified

bupkis08:08:19

that thread is ridiculous, why are they being so stubborn to even acknowledge the issue, not to mention accept a fix

thheller08:08:05

I shouldn't have made it about load time ... and really should have just started by patching tools.logging instead

thheller08:08:34

which I'll replace now I guess

eoliphant12:08:20

Hi, i’ve just done a release build and it’s pretty obnoxiously large (~5Mb) , is there any way to figure out what the contributors are ?

eoliphant14:08:52

duh 🙂 cool thanks.

heyarne15:08:32

Hm.. I'm getting a warning cljs.core.ICounted is not a protocol when trying to implement a record with custom counting, however my tests seem to show that it's working correctly. Am I missing something?

thheller15:08:56

cljs.core/ICounted

thheller15:08:22

well maybe. not actually sure 🙂

thheller15:08:51

@samuel.wagen the find-ns issue should hopefully be fixed in 2.4.32. I can no longer reproduce it at least.

bupkis18:08:39

@thheller yep, works perfectly, vielen Dank

👍 4
eoliphant19:08:06

anyone using the aws-sdk? It’s adding like 2Mb to my build, I’m only requiring the following

["aws-sdk" :default AWS]
    ["aws-sdk/clients/s3" :default S3]

thheller20:08:02

hmm aws seems to import a crapton of JSON files

thheller20:08:04

it may work if you do

["aws-sdk/lib/util" :as AWS]
    ["aws-sdk/clients/s3" :as S3]

thheller20:08:38

if you import aws-sdk it'll bring in every single thing including the stuff you don't actually use

thheller20:08:55

so you should awlays try to only require what you actually need

samarth20:08:58

I’m trying to use shadow-cljs in a small project which uses some npm modules that I want to require in my ClojureScript code. I’m using Emacs with CIDER and followed the instructions on https://shadow-cljs.github.io/docs/UsersGuide.html#cider to start a server and connect to the repl, but running M-x cider-connect times out with the error:

[nREPL] Establishing direct connection to localhost:55098 ...
[nREPL] Direct connection to localhost:55098 established
helm-M-x: Sync nREPL request timed out (op clone id 1)
I’m very new to all of this ClojureScript stuff and want to try it out so any help would be appreciated. Thanks!

thheller20:08:25

@samarthkishor1 I don't know anything about cider unfortunately

samarth20:08:33

@thheller I’ll try posting this in the cider channel then. Thanks for the response!

thheller20:08:30

cider is in this weird spot right now due to the nrepl 0.4 migration. are you on 0.18.0 already?

thheller20:08:55

I tried my best at supporting both nrepl versions but that has proven to be much harder than anticipated

thheller20:08:01

may be related to this though

samarth20:08:38

I upgraded to the latest version of cider this morning and the dependencies section of my shadow-cljs.edn file looks like this:

:dependencies [[cider/cider-nrepl "0.18.0"]]

thheller20:08:58

are you on the latest shadow-cljs too?

thheller20:08:17

fixed a few related bugs just today

samarth20:08:29

I installed it yesterday from npm but I can try the latest version

thheller20:08:41

2.4.32 should hopefully fix most issues

samarth21:08:07

I got the repl to run but I can’t send expressions to the repl from a cljs buffer or evaluate them. At least I have something to work with though. Thanks!

thheller21:08:26

no idea how current that is though

samarth21:08:03

M-x cider-create-sibling-cljs-repl doesn’t seem to be a command. I’ll look in the cider docs to see if it got renamed to something else

kanwei21:08:17

updated to 2.4.32 and getting this:

kanwei21:08:19

<< Building for release >>
[:mp360] Compiling ...
The required namespace "doublethedonation.integrations.app" is not available.

[:ddregister] Compiling ...
The required namespace "doublethedonation.register" is not available.

[:ddplugin] Compiling ...
The required namespace "doublethedonation.external" is not available.

[:mp360partners] Compiling ...
The required namespace "doublethedonation.partner-portal.app" is not available.

kanwei21:08:26

downgraded to .31 and it works fine

thheller21:08:47

hmm thats odd. nothing changed regarding compilation. only logging stuff.

thheller21:08:47

@kanwei how are you calling things? << Building for release >> looks like something custom maybe?

kanwei21:08:58

calling it with

(cljs/release :builds #{:mp360 :mp360partners :ddregister :ddplugin})

thheller21:08:32

hmm I don't know boot, can you try it without boot?

thheller21:08:23

the errors sugguests that maybe the classpath isn't configured properly. but nothing changed regarding that in 2.4.32

flyboarder21:08:17

it was originally based on that gist (or a similar one)

flyboarder21:08:49

alternatively try with the standalone cli app as @thheller suggests

thheller21:08:37

oh heck I know what it is

thheller21:08:48

I dropped the java.classpath dependency and its single use

thheller21:08:28

which I guess boot relies on

thheller21:08:45

totally forgot about that. I'll revert that change.

flyboarder21:08:11

@thheller where was that modified? Is this something I can patch in the boot task directly?

thheller21:08:02

can boot set the java.class.path property?

flyboarder21:08:38

@thheller boot does I believe as it abstracts the actual classpath with a virtual one, via the fileset concept

thheller21:08:15

yes but shadow-cljs needs to read the classpath

thheller21:08:28

since it can't do that by looking at the classloaders in Java9

thheller21:08:42

it does that by looking at the system property java.class.path

thheller21:08:55

and I removed the "old" stuff which looks at the classloader

thheller21:08:07

but I guess boot really needs that

flyboarder21:08:59

@thheller we should be able to provide a class path, since boot requires building it’s own

thheller21:08:02

this should fix it

thheller21:08:30

@kanwei try 2.4.33, sorry about that. didn't think anyone was relying on that old behaviour since it doesn't work in java9+

thheller21:08:01

@flyboarder does boot work with java9+?

flyboarder21:08:21

yep all the way to Java 11

thheller21:08:51

but how do you get the classpath from in side a pod?

flyboarder21:08:10

(boot.pod/get-classpath)

thheller21:08:59

well I can't add boot specific api calls to shadow-cljs

flyboarder21:08:34

right, so we need to be able to pass a classpath to shadow-cljs config

thheller21:08:57

I guess you could replace the shadow.build.classpath/get-classpath fn with something that calls the boot thing?

flyboarder21:08:04

or we can build the pod using an existing classpath from shadow

thheller21:08:49

the gist already has a prepare-runtime fn that seems to do some stuff

thheller21:08:25

you could try

thheller21:08:27

(in-ns 'shadow.build.classpath)

(defn get-classpath []
  (boot.pod/get-classpath))

thheller21:08:53

but you can open an issue about the classpath via config thing

thheller21:08:02

should be easy enough to hook up

flyboarder21:08:20

where is the shadow class path being constructed?

flyboarder21:08:27

I wonder if I can just use that?

thheller21:08:46

what do you mean?

flyboarder21:08:06

Is it just checking the property? or does it build it’s own?

thheller21:08:26

the shadow-cljs npm command builds the classpath and starts with JVM with it set

thheller21:08:03

this then reads that

flyboarder21:08:40

@alandipert Do you know of a way to fix this classpath issue above? Ideally I’d like to just patch it within a boot task to the shadow pod

flyboarder22:08:42

@thheller I’ll keep looking into this and see if I can patch it from the boot task instead of requiring changes to the internals of shadow

thheller22:08:43

from what I know its no longer possible to inspect the classpath by looking at classloaders in java9+

thheller22:08:59

only with very ugly reflection warnings which I don't want

flyboarder22:08:16

Boot has to be doing something that makes this possible 😛

thheller22:08:34

but that might not actually be true. so if someone knows a way to still do it in java9+ I'm happy to consider it

thheller22:08:59

@flyboarder its only a problem is something actually tries to inspect the classpath. you don't usually have much reason to do so

thheller22:08:04

those are the reflection warnings I want to avoid

flyboarder22:08:23

@thheller looks like there was an issue open to add boot class path support to external tools, a quick check for boot.class.path could also do the trick

thheller22:08:02

is that documented somewhere? impossible to google

thheller22:08:16

ok I can add the extra check for that

thheller22:08:33

tomorrow though. off to bed. gn8

flyboarder22:08:28

@kanwei can you post your boot environment also? Does it include the source folders that are also in shadow-cljs.edn?