Fork me on GitHub
#boot
<
2017-08-24
>
coetry02:08:46

I can’t seem to get garden in my repl although I have it in my build.boot

coetry02:08:08

#object[TypeError TypeError: goog.net.jsloader.load is not a function]
TypeError: goog.net.jsloader.load is not a function
    at adzerk.boot_reload.client.patch_goog_base_BANG_.goog.global.CLOSURE_IMPORT_SCRIPT ()
    at Object.goog.importScript_ ()
    at Object.goog.writeScripts_ ()
    at Object.goog.require [as require__] ()
    at Object.clojure.browser.repl.bootstrap.goog.require ()
    at eval (eval at <anonymous> (), <anonymous>:1:6)
    at 
    at 
    at cljs.core.MultiFn.G__12138__2 ()
    at cljs.core.MultiFn.G__12138 [as call] ()

coetry02:08:27

I get that when I enter (require '[garden.core :refer [css]])

seancorfield02:08:11

Caveat: I don't do any cljs work but that sounds to me like something might be pulling in an incompatible version of the Google JS library?

coetry02:08:48

Hmm, I have the latest cljs version in there, so I would hope it would load the correct one

coetry02:08:57

but that’s possible

seancorfield02:08:47

How do you start your repl? (I just created a test project with that build.boot file and ran boot dev and that started the watcher...)

coetry02:08:37

I connect to the nrepl

coetry02:08:41

through cider

coetry02:08:49

and then run (start repl)

coetry02:08:00

(start-repl)

seancorfield02:08:09

Hmm, I get this error when I try that:

boot.user=> (start-repl)

java.lang.IllegalStateException: Can't change/establish root binding of: *cljs-repl-env* with set
So I'm guessing I can't just fire up a new boot repl and type that in... just a sec...

coetry02:08:29

you have to visit localhost:3000

coetry02:08:35

to establish a websocket connection

coetry02:08:57

hold on, let me post the whole project to github with the source fiels

seancorfield02:08:30

Cool. Learning how the whole cljs thing works is something I should do so this will help 🙂

coetry02:08:05

🙂 I’m itching to do some serious web dev with full-stack Clojure, currently trying to do static react sites. Having the components and css all represented in native Clojure data structures is amazingly simple and powerful

coetry02:08:31

I haven’t even start playing with Macros yet! I’m kinda new to the Lisp world, but am so ready to dive in! I just gotta get past some battles with the tooling lol

seancorfield02:08:21

OK, all caught up... the WS stuff doesn't seem to work in Microsoft Edge so I had to switch browsers...

seancorfield02:08:31

(probably because I'm working across VMs)

seancorfield02:08:04

And I can repro... that's a good first step...

coetry02:08:40

Ugh I wish there was an easy way to handle version conflicts 😔

seancorfield02:08:07

Bing turns up a commit on the Google closure library that "deletes deprecated goog.net.jsloader.load" https://github.com/google/closure-library/commit/988ff900886e959a888485ee56d1540d1bf2f29d so the problem seems to be picking up a more recent version of the Google closure library (from the latest ClojureScript) and Adzerk boot-reload doesn't work with it.

seancorfield02:08:00

@coetry Looks like you need this in build.boot:

:dependencies '[[org.clojure/clojurescript "1.9.908"
                  :exclusions [org.clojure/google-closure-library]]
                 [org.clojure/google-closure-library "0.0-20170519-fa0499ef"]

seancorfield02:08:32

That at least lets the require of Garden complete without an error...

coetry02:08:40

hmmm interesting, maybe that’s a bug experienced when developing in the repl, because i know you for sure want google closure in production

coetry02:08:46

that’s where all the js optimizations happen

coetry02:08:52

but you don’t need that in dev

coetry02:08:59

let me try that out

seancorfield02:08:04

So I guess the Adzerk guys need to update boot-reload to work with the latest Google closure version.

seancorfield02:08:26

Note that I excluded it from clojurescript and added a specific dependency on an older version

coetry02:08:46

Ahhhhh, gotcha. I’m gonna try that right now. Thank you so much for your help Sean!

seancorfield02:08:28

Hmm, that doesn't get you much further it seems

cljs.user=> (require '[garden.core :refer [css]])

cljs.user=> (css [:body {:font-size "32px"}])

#object[ReferenceError ReferenceError: Can't find variable: garden]


eval code
eval@[native code]

coetry02:08:44

ahh, that was the second error i was getting

seancorfield02:08:49

So I'm not sure what to suggest at that point.

coetry02:08:12

I’ll continue tinkering with it and see what I can do

seancorfield02:08:39

This is why we gave up trying to use cljs about two years ago and figured we'd revisit it some day once tooling has become less fragile...

seancorfield02:08:57

Sorry I can't help more. Dinner time here...

coetry02:08:35

No worries at all, I appreciate the time! I’ll ask the #clojurescript guys

seancorfield04:08:01

@coetry BTW, I looked a bit more deeply at boot-reload and it has almost no dependencies and nothing to do with cljs so it's not at fault. Apologies to the Adzerk guys for jumping to that conclusion.

seancorfield04:08:55

Hopefully someone in #clojurescript -- or someone here with more knowledge of the cljs ecosystem -- can help you. I'll be interested to know what the solution is either way (I'm not in #clojurescript tho').

hkjels08:08:02

@coetry There are parts of garden that does not work entirely in cljs

hkjels08:08:19

you could just fire-up a clj-repl

martinklepsch09:08:45

Anyone an idea why some lein plugins that are not listed in a jar’s pom.xml would still leak into boot? Example boot -d morse show -d

martinklepsch09:08:45

If you look at the deps tree you’ll see venantius/ultra show up even though that is not listed in the jar’s pom.xml

hkjels10:08:56

venantius/ultra is a tooling thing that you would usually put into profile.clj, but I thought that was lein-domain

martinklepsch10:08:00

@hkjels yeah I learned about that but also don’t have a profile.clj (not that that should influence boot in any way)

seancorfield16:08:40

Looks like morse uses ultra as a plugin in the :dev profile -- but I too am puzzled as to why boot would end up pulling plugins into the mix when they're not mentioned in pom.xml -- maybe @alandipert or @micha can shed some light?

micha16:08:10

@U050TNB9F did you try with -vv to see the debug output? might be an answer in there

micha16:08:25

boot logs a lot of stuff during dependency resolution

seancorfield16:08:45

That didn't show me anything useful but I did realize that boot is not use the pom.xml but the morse-0.2.4.pom file -- which was generated by Leiningen and does contain the venantius/ultra dependency without a <scope> so that seems like a bug in Leiningen to me?

martinklepsch16:08:10

@seancorfield do you consider it more appropriate to use pom.xml or *.pom for dep resolution?

seancorfield17:08:25

I don't know enough about Maven/Aether/Apache Resolver to offer a useful opinion. I don't know whether Leiningen should or should not add plugins to the .pom file but it feels wrong to me (or they should, at least, have a different scope). But maybe those two POMs are for different purposes that I'm just missing?

micha17:08:10

what is a .pom file?

micha17:08:57

pom.xml is the name of the file according to the specifications as far as i know

micha17:08:04

this .pom extension is new to me

seancorfield17:08:51

(! 1183)-> ls ~/.m2/repository/morse/morse/0.2.4/
_maven.repositories	morse-0.2.4.jar.sha1	morse-0.2.4.pom.sha1
morse-0.2.4.jar		morse-0.2.4.pom

seancorfield17:08:07

<!-- This file was autogenerated by Leiningen.
  Please do not edit it directly; instead edit project.clj and regenerate it.
  It should not be considered canonical data. For more information see
  https://github.com/technomancy/leiningen -->

micha17:08:48

ah i remember now

micha17:08:19

that's the pom.xml that was uploaded to clojars with the jar file

seancorfield17:08:36

But it feels like boot is using the .pom for resolution -- since ultra is in the .pom not the pom.xml

micha17:08:02

yeah that's aether

micha17:08:13

seems like the right thing to do

seancorfield17:08:29

I'm beginning to suspect that ultra is in there because of a bad local setup by the author at this point...?

currentoor14:08:35

how does boot do the voice notifications? like when it says “2 Warnings” and stuff like that?

coetry15:08:05

@seancorfield: It works perfectly fine from a standard clj repel as @hkjels mentioned

seancorfield16:08:20

I'd tried it in a clj REPL and saw it worked -- but I thought you were trying it in a cljs REPL because it was supposed to work there (and I'd expect a CSS generating library to work in cljs, to be honest).

coetry21:08:25

Yeah i still haven’t figured out why its not working in the cljs repl, which was my ideal goal, but i figwheel sufficies as visual feedback for autocompiled css sheets for now. I’m trying to get away from the notion of the perfect dev environment and just want to start hacking

coetry21:08:45

hopefully tooling matures, which it definitely seems is in the right direction

coetry15:08:15

I see the strings generated by the (css) function

dominicm15:08:47

Is it possible to control the ordering of the resulting classpath inside a :dependencies vector? I had assumed they'd be ordered by appearance, but they seem to shift if things depend on them.

adamfrey15:08:35

before I file a bug report, has anyone else noticed that in boot 2.7.2, exceptions raised gy boot print a "line: ..." number but do not print a "file: "some/file.clj"" where the exception was thrown? Changing my boot.properties version to 2.7.1 or 2.7.0 print like I'd expect, but it breaks in 2.7.2

seancorfield16:08:40

Looks like morse uses ultra as a plugin in the :dev profile -- but I too am puzzled as to why boot would end up pulling plugins into the mix when they're not mentioned in pom.xml -- maybe @alandipert or @micha can shed some light?

micha16:08:36

@dominicm what's your use case for reordering dependencies?

alandipert16:08:01

currentoor on macs there's a 'say' command on macs that it shells out, iirc it uses espeak on linux (if available)

dominicm16:08:35

Bad jar not vendoring it's dependencies @micha

alandipert16:08:42

drewverlee re: cljs it's not clear that boot pods are fundamentally possible in node, since node doesn't have classloaders, which are the underlying tech on the jvm

dominicm16:08:47

Duplicates on the classpath

micha16:08:18

@dominicm that's a problem that is outside of the dependency resolution scope i think

alandipert16:08:31

drewverlee the fileset and command line parsing stuff is probably ripe for node. another node build tool, broccoli, on which embercli is based, has a fileset-like thing in it

micha16:08:36

one thing you can do is maybe fix the bad jar's pom

micha16:08:44

or something like that

micha16:08:08

@dominicm maybe a good solution is to vendor that jar yourself and add exclusions

micha16:08:52

and finally you could use a pod maybe to segregate it

dominicm16:08:14

I think they want it like this. But it also means I have to figure out maven. I probably will do that :)

alandipert17:08:12

i'm relatively ignorant of maven eccentricities, but to me it seems not good for lein to add plugins as deps

juhoteperi17:08:26

It is probably not lein, but the plugin

seancorfield17:08:30

Looking in more depth, it's only one of the three :dev :plugins so it makes me wonder whether the author has ultra as a non-dev dependency, maybe in their ~/.lein/profiles.clj?

alandipert17:08:27

pom.xml is what you have in your project and maven renames it to *.pom as part of deploy, yes?

seancorfield17:08:48

Why would they be different then? Different dependencies in each.

juhoteperi17:08:57

And in this case, ultra modifies the projects :dependencies and adds dependency there

juhoteperi17:08:11

So that all the other lein tasks see the ultra also

juhoteperi17:08:25

I think I've dealt with this problem somewhere, but can't remember where

juhoteperi17:08:55

Huh, ultra seems to work differently if it is defined on project dev profile, vs. ~/.lein/profiles.clj

juhoteperi17:08:31

If it is in ~/.lein, it is not added to pom.xml

seancorfield18:08:51

Based on comparing pom.xml and morse-0.2.4.pom, it isn't added to the pom.xml if it's in :dev as one of the :plugins either, but it is added to morse-0.2.4.pom... So I guess we just chalk this up to ultra being "badly behaved" and leaking into the artifact's .pom file (but not pom.xml -- so why are those different?)

martinklepsch19:08:38

cc @venantius hey! maybe you can shed some light on the above issue and/or have heard of it before 🙂

martinklepsch19:08:31

@venantius to sum the issue up: it seems that the :dev dependency on ultra somehow leaks into the .pom file of the deployed library [morse “0.2.4”]

venantius19:08:31

I don’t think ultra should be set as a dev dependency

venantius19:08:56

The Ultra README recommends using it in your local ~/.lein/profiles.clj

venantius19:08:19

I would absolutely believe that Ultra is responsible for the issue here as it does modify both :dependencies and :plugins

martinklepsch19:08:05

@venantius did you consider using :scope "test" when adding it to :dependencies? — I guess many people will just not read the note in the README

juhoteperi19:08:12

@venantius morse doesn't have ultra as :dev dependency, but as dev plugin

venantius19:08:22

I was not aware of `:scope “test”

venantius19:08:42

@juhoteperi that is to be expected - ultra is a plugin

juhoteperi19:08:58

Probably something strange going on with lein profiles also, as there was some dfiference between having ultra on ~/.lein and project.clj

venantius19:08:58

though it does inject itself as a dependency

venantius19:08:28

Does the :dev profile leak? Leiningen claims that the :dev profile has ^{:pom-scope :test} set already

juhoteperi19:08:12

If I understand ultra code correctly, the dpendenciy in injected directly to the project, not to project's dev profile?

venantius19:08:40

well at the point at which lein middleware runs I believe the profile has already been resolved

venantius19:08:49

so you can’t modify other profiles

venantius19:08:57

It doesn’t look like plugins in the dev profile get the pom-scope limitation attached. Does that propagate the plugin via the pom? That would seem potentially undesirable.

juhoteperi19:08:41

One test case would be to create project with lein new, add ultra to dev plugins on project.clj and run lein pom, ultra will be included in deps

juhoteperi19:08:15

Not sure if pom task works the same as packaging the lib

juhoteperi19:08:57

when running lein jar, the pom.xml doesn't have ultra dep

venantius19:08:48

To be honest, I’m inclined to push this back to Boot. It doesn’t sound like Ultra leaks to pom.xml, just to pom, which includes a specific note that it’s Leiningen-internal

venantius19:08:49

*Or, this is a Leiningen issue and shouldn’t be leaked to pom

venantius19:08:11

The pom file contains an explicit warning that its data should be considered non-canonical

juhoteperi19:08:17

hmm, now I'm unsure what the original problem even was

micha19:08:33

the .pom file is the one in the maven repo, right?

juhoteperi19:08:40

because looking at the morse jar, it looks fine

venantius19:08:42

The problem is that somehow ultra ends up in pom but not in pom.xml and that Boot seems to rely on pom

juhoteperi19:08:00

Oh now I see it

micha19:08:10

when you say "ends up in pom" do you mean the .pom file in the maven repo?

juhoteperi19:08:36

~/.m2/repository/morse/morse/0.2.4 master*
❯ cat morse-0.2.4.pom | grep ultra
      <artifactId>ultra</artifactId>

micha19:08:37

because that file is the pom.xml file the user uploaded to clojars or maven central when they pushed the jar

micha19:08:07

when you push to a maven repo you upload a jar and the associated pom.xml

micha19:08:13

as two separate artifacts

juhoteperi19:08:29

This is a problem with Leiningen also, which can be checked by adding [morse "0.2.4"] dep to a Lein project and checking lein deps :tree (ultra will be transitive dep of morse)

micha19:08:58

the pom.xml file you upload when you push becomes the morse-0.2.4.pom file we see when we download it from clojars

micha19:08:31

so something added ultra to the pom.xml that was uploaded via the push task in leiningen

micha19:08:12

also the part about "It should not be considered canonical data." is misleading

micha19:08:31

since the pom you share in the maven repo is by definition canonical

micha19:08:35

that's the whole point of it

juhoteperi19:08:47

Yeah, that file is used by Maven/Lein/Boot always

micha19:08:55

by apache aether really

micha19:08:00

boot delegates all of that

juhoteperi19:08:03

maven-resolver nowadays 🙂

micha19:08:12

oh sweet!

juhoteperi19:08:20

or well, I guess we haven't updated yet

micha19:08:58

point being that boot isn't involved with dependency resolution directly

micha19:08:20

deps are resolved by the standard maven tooling

micha19:08:57

so what i think is happening there is this

micha19:08:23

when you do the leiningen equivalent of boot push it generates a pom.xml to upload to the repo with the jar

micha19:08:58

ultra has done some things internally in leiningen that cause it to think that ultra is a dependency without test scope

micha19:08:16

so when leiningen generates that pom.xml it has ultra as a normal dependency

micha19:08:22

and that gets uploaded to clojars

micha19:08:36

the pom.xml file in the jar is generated by a different code path in leiningen probably

micha19:08:20

one that does not see changes made by ultra's injection process or whatever

juhoteperi20:08:01

I'll open Leiningen issue about this, seems quite strange

micha20:08:36

can we not just do like [morse "0.2.4" :exclusions [ultra]] or something similar?

juhoteperi20:08:45

Yes, that should work as a workaround

micha20:08:58

ah ok sorry

juhoteperi20:08:56

I think I found the reason, both Lein and Ultra work correctly 🙂

juhoteperi20:08:05

Morse adds Ultra to :dev profile instead of :user profile

juhoteperi20:08:17

... no this doesn't make any sense, as :user shouldn't be used on project.clj

juhoteperi20:08:49

but :repl profile works

kanwei20:08:20

has anyone else tried boot uberjar with CLJS 1.9.908?

kanwei20:08:26

failing catastrophically for me

kanwei20:08:08

and by that i mean boot-cljs 2.1.2 with advanced optimization

juhoteperi20:08:56

@kanwei Doesn't look like that would be caused by Boot-cljs. It would be best to try to reproduce this with cljs.jar (https://clojurescript.org/guides/quick-start) and if this happens with that also, open issue on Cljs

ag21:08:13

is it possible to list dependencies in separate files? e.g. separated by scope?

ag21:08:10

test-dependencies.edn dev-dependencies.edn prod-dependencies.edn.

ag21:08:46

I think this is stupidest idea. But maybe it's worth blurting it out

micha21:08:17

direct dependencies is straightforward

micha21:08:28

but if you want to include transitive dependencies it's more complex