Fork me on GitHub
#shadow-cljs
<
2018-01-13
>
Alex H12:01:03

I'm somehwat confused by this:

Alex H12:01:05

circular dependency: [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/core.cljs"] -> [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/fx.cljs"] -> [:shadow.build.classpath/resource "dlt/graphql/core.cljs"] {:resource-id [:shadow.build.classpath/resource "dlt/events.cljs"], :stack ([:shadow.build.classpath/resource "dlt/core.cljs"] [:shadow.build.classpath/resource "dlt/events.cljs"] [:shadow.build.classpath/resource "dlt/fx.cljs"] [:shadow.build.classpath/resource "dlt/graphql/core.cljs"])} ExceptionInfo: circular dependency: [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/core.cljs"] -> [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/fx.cljs"] -> [:shadow.build.classpath/resource "dlt/graphql/core.cljs"]

Alex H12:01:18

nothing, and by that I really mean nothing, requires dlt.core

Alex H12:01:30

yet, somehow, it seems to say that dlt.events requires dlt.core

Alex H12:01:15

the only thing that requires dlt.core, if anything, is that it's :modules {:main {:entries [dlt.core]}} in the shadow-cljs.edn

Alex H12:01:21

(and the after-load)

thheller15:01:41

"dlt/events.cljs" is the circle

thheller15:01:58

it requires core?

thheller15:01:31

the message indeed seems incorrect and confusing

Alex H16:01:53

no, it doesn't require core

Alex H16:01:05

(ns dlt.events (:require-macros [cljs.core.async.macros :refer [go]] [dlt.util.macros :refer [p<! jsp<!]]) (:require [clojure.string :as s] [re-frame.core :as re-frame] [dlt.db :as db] [dlt.fx :as fx] [dlt.util.core :as u]))

Alex H16:01:36

I mean, as I said, the only mention of dlt.core anywhere is in the shadow-cljs.edn for the :entries thing

thheller16:01:20

what does dlt.fx look like?

thheller16:01:25

and dtl.graphql.core?

Alex H16:01:43

(ns dlt.fx (:require-macros [cljs.core.async.macros :refer [go]] [dlt.util.macros :refer [p<! jsp<!]]) (:require [clojure.string :as s] [re-frame.core :as re-frame] [dlt.graphql.core :as gql] [dlt.util.core :as u]))

Alex H16:01:59

(ns dlt.graphql.core (:require [clojure.string :as s] [graphql-builder.parser :refer-macros [defgraphql]] [graphql-builder.core :as gql-builder] [reagent.core :as r] [re-frame.core :as re-frame] [apollo-client :refer [ApolloClient createNetworkInterface]] [graphql-tag :as gql] [dlt.util.core :as u]))

Alex H16:01:11

(ns dlt.util.core (:require [cljs.core.async :as async] [clojure.string :as s]))

Alex H16:01:20

(ns dlt.db)

Alex H16:01:28

and that's all the namespaces involved

thheller16:01:33

strange indeed

thheller16:01:17

do you maybe have a duplicate file somewhere that could cause a conflict?

thheller16:01:29

src/main and src/test both having a dlt.core or so?

Alex H16:01:53

~/code/dlt-frontend-shadowcljs master [1+] ❯ ag dlt.core src/clj/dlt/core.clj 1:(ns dlt.core) src/cljs/dlt/core.cljs 1:(ns dlt.core public/index.html 29: <script>dlt.core.init();</script> shadow-cljs.edn 26: :modules {:main {:entries [dlt.core]}} 33: :after-load dlt.core/on-js-reload assets/index.html 29: <script>dlt.core.init();</script>

thheller17:01:19

any of the othrs?

Alex H17:01:46

not really, no

Alex H17:01:00

would it help trying to blow away the output js dir?

Alex H17:01:39

I had a version with a circular dependency at some point, but I fixed that by factoring the circular bits out into that fx namespace

thheller17:01:27

hmm not aware of any caching bugs currently but maybe you found one

thheller17:01:38

just delete the target/shadow-cljs/builds directory

thheller17:01:45

and restart the compile

Alex H17:01:31

circular dependency: [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/core.cljs"] -> [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/fx.cljs"] -> [:shadow.build.classpath/resource "dlt/graphql/core.cljs"] {:resource-id [:shadow.build.classpath/resource "dlt/events.cljs"], :stack ([:shadow.build.classpath/resource "dlt/core.cljs"] [:shadow.build.classpath/resource "dlt/events.cljs"] [:shadow.build.classpath/resource "dlt/fx.cljs"] [:shadow.build.classpath/resource "dlt/graphql/core.cljs"])} ExceptionInfo: circular dependency: [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/core.cljs"] -> [:shadow.build.classpath/resource "dlt/events.cljs"] -> [:shadow.build.classpath/resource "dlt/fx.cljs"] -> [:shadow.build.classpath/resource "dlt/graphql/core.cljs"]

Alex H17:01:49

I guess I can push the repo somewhere

Alex H17:01:59

(if you want to have a look)

thheller17:01:03

that would help

Alex H17:01:02

it's a mess, including the commit messages, but there it is 🙂

thheller17:01:23

looking into it

thheller17:01:08

one quick note: the :exlusions are incorrect, just one vector with symbols, no nested vectors

Alex H17:01:33

changed, thanks

Alex H17:01:02

(somehow did work well enough to get rid of my issues though - a warning with cuerdas and the fact that I wanted to use react 16 instead of 15.something)

Alex H17:01:28

maybe someone thought of useless users like me and added a flatten in there 😛

thheller17:01:28

ah found it

thheller17:01:40

events -> fx -> graphql.core -> events

thheller17:01:54

dunno why the error message contains the others

Alex H17:01:33

doh. sorry

thheller17:01:56

cljsjs is all ignored anyways so it doesn’t matter much which version you have on the classpath

thheller17:01:05

only their externs are used

Alex H17:01:23

@thheller thanks for looking into it for me

thheller17:01:52

np, now I have a good example to use to tweak the error message

thheller17:01:01

that error definitely didn’t help at all 🙂

thheller17:01:36

you also don’t need clojure,clojurescript in the deps

thheller17:01:40

shadow-cljs provides those

thheller17:01:34

and thats just my preference but do you really like putting everything into separate source paths?

Alex H17:01:07

well, as I warned you a few days ago, I've only started looking into clojurescript ~2 weeks ago

Alex H17:01:20

so my opinions are, well, based on random bits and pieces that I've seen

Alex H17:01:40

some of the lein-fighweel boiler plates for reagent or re-frame did that structure of src/clj/foo, src/cljs/foo

thheller17:01:42

hehe ok. it is totally fine to put .clj files next to .cljs files

thheller17:01:51

yeah no idea why they do that

Alex H17:01:10

it did feel a bit awkward for example for my dlt.styled thing

Alex H17:01:18

where macros live in one directory, and the rest in another entirely

thheller17:01:54

yeah. I typically have a src/main where all sources live clj,cljs,cljc

thheller17:01:02

src/test for tests etc

Alex H17:01:18

yea, sounds like a plan. I might reorganize it like that

thheller17:01:03

the one .js include you have might get you in trouble at some point

thheller17:01:28

I would also put that directly into the folder of the .cljs if possible

thheller17:01:49

going “outside” the classpath is not actually safe

thheller17:01:48

reason is if you want to put things in a .jar and publish that, the relative path will be invalid since it wouldn’t be in the jar

Alex H17:01:03

yea, makes sense

thheller17:01:09

(relative paths aren’t supported in jars anyways yet)

thheller17:01:20

fixed the error, next release will show the error properly. (eg Circular dependency detected: circular.foo -> circular.util.lib -> circular.foo)