reagent-project / reagent-template

A Leiningen template for projects using Reagent.
MIT License
394 stars 55 forks source link

circular dependency detected #52

Closed ilazarte closed 9 years ago

ilazarte commented 9 years ago

sorry for the characters, thats just how it shows up in windows. project.clj below

Focusing on build ids: app
?[0mCompiling "resources/public/js/app.js" from ["src/cljs" "env/dev/cljs"]...
?[31mCompiling "resources/public/js/app.js" failed.?[0m
clojure.lang.ExceptionInfo: failed compiling file:src\cljs\reagent\core.cljs
 at clojure.core$ex_info.invoke (core.clj:4403)
Caused by: clojure.lang.ExceptionInfo: Assert failed: Circular dependency detected [reagent.core]
(every? (fn* [p1__1802#] (not (contains? *cljs-dep-set* p1__1802#))) deps) at line 2 src\cljs\reagent\core.cljs
 at clojure.core$ex_info.invoke (core.clj:4403)
Caused by: java.lang.AssertionError: Assert failed: Circular dependency detected [reagent.core]
(every? (fn* [p1__1802#] (not (contains? *cljs-dep-set* p1__1802#))) deps)
 at cljs.analyzer$analyze_deps.invoke (analyzer.clj:1254)
?[0m

(defproject reagent "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url "http://example.com/FIXME"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}

  :source-paths ["src/clj" "src/cljs"]

  :dependencies [[org.clojure/clojure "1.6.0"]
                 [ring-server "0.4.0"]
                 [cljsjs/react "0.13.1-0"]
                 [reagent "0.5.0"]
                 [reagent-forms "0.5.0"]
                 [reagent-utils "0.1.4"]
                 [org.clojure/clojurescript "0.0-3196" :scope "provided"]
                 [ring "1.3.2"]
                 [ring/ring-defaults "0.1.4"]
                 [prone "0.8.1"]
                 [compojure "1.3.3"]
                 [selmer "0.8.2"]
                 [environ "1.0.0"]
                 [secretary "1.2.3"]]

  :plugins [[cider/cider-nrepl "0.9.0-SNAPSHOT"]
            [lein-cljsbuild "1.0.4"]
            [lein-environ "1.0.0"]
            [lein-ring "0.9.1"]
            [lein-asset-minifier "0.2.2"]]

  :ring {:handler reagent.handler/app
         :uberwar-name "reagent.war"}

  :min-lein-version "2.5.0"

  :uberjar-name "reagent.jar"

  :main reagent.server

  :clean-targets ^{:protect false} ["resources/public/js"]

  :minify-assets
  {:assets
    {"resources/public/css/site.min.css" "resources/public/css/site.css"}}

  :cljsbuild {:builds {:app {:source-paths ["src/cljs"]
                             :compiler {:output-to     "resources/public/js/app.js"
                                        :output-dir    "resources/public/js/out"
                                        :asset-path   "js/out"
                                        :optimizations :none
                                        :pretty-print  true}}}}

  :profiles {:dev {:repl-options {:init-ns reagent.repl
                                  :nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}

                   :dependencies [[ring-mock "0.1.5"]
                                  [ring/ring-devel "1.3.2"]
                                  [leiningen "2.5.1"]
                                  [figwheel "0.2.6"]
                                  [weasel "0.6.0"]
                                  [com.cemerick/piggieback "0.2.0"]
                                  [org.clojure/tools.nrepl "0.2.10"]
                                  [pjstadig/humane-test-output "0.7.0"]]

                   :source-paths ["env/dev/clj"]
                   :plugins [[lein-figwheel "0.2.5"]]

                   :injections [(require 'pjstadig.humane-test-output)
                                (pjstadig.humane-test-output/activate!)]

                   :figwheel {:http-server-root "public"
                              :server-port 3449
                              :css-dirs ["resources/public/css"]
                              :ring-handler reagent.handler/app}

                   :env {:dev? true}

                   :cljsbuild {:builds {:app {:source-paths ["env/dev/cljs"]
                                              :compiler {:main "reagent.dev"
                                                         :source-map true}}
}
}}

             :uberjar {:hooks [leiningen.cljsbuild minify-assets.plugin/hooks]
                       :env {:production true}
                       :aot :all
                       :omit-source true
                       :cljsbuild {:jar true
                                   :builds {:app
                                             {:source-paths ["env/prod/cljs"]
                                              :compiler
                                              {:optimizations :advanced
                                               :pretty-print false}}}}}})
yogthos commented 9 years ago

I don't have a windows machine handy, but I'm not able to reproduce the issue on OS X. Some things to check would be your version of Leiningen, and if you might have any conflicting plugins in you ~/.lein/profiles.clj

mdaley commented 9 years ago

I have a circular dependency problem on OS X. I wonder if you will be able to replicate the problem? The most interesting point is that in one case with a recently created project I get the problem, in the other case I don't. I've got the latest leiningen (2.5.1 on Java 1.7.0_71 Java HotSpot(TM) 64-Bit Server VM) and I've turned off all the plugins in my profile.

This works fine:

$ lein new reagent reagent +test
$ cd reagent
$ lein cljsbuild
Compiling ClojureScript.
Compiling "target/test.js" from ["src/cljs" "test/cljs"]...
Successfully compiled "target/test.js" in 9.659 seconds.
Compiling "resources/public/js/app.js" from ("src/cljs" "env/dev/cljs")...
Successfully compiled "resources/public/js/app.js" in 5.453 seconds.

However, if I do the same thing but don't specify +test, the cljs compilation fails:

$ lein new reagent reagent2
$ cd reagent2
$ lein cljsbuild
Compiling ClojureScript.
Compiling "resources/public/js/app.js" from ("src/cljs" "env/dev/cljs")...
Compiling "resources/public/js/app.js" failed.
clojure.lang.ExceptionInfo: failed compiling file:src/cljs/reagent/core.cljs {:file #object[java.io.File 0x3840e396 "src/cljs/reagent/core.cljs"]}
    at clojure.core$ex_info.invoke(core.clj:4591)
    at cljs.compiler$compile_file$fn__3099.invoke(compiler.cljc:1146)
    at cljs.compiler$compile_file.invoke(compiler.cljc:1109)
    at cljs.compiler$compile_root.invoke(compiler.cljc:1181)
    at cljs.closure$compile_dir.invoke(closure.clj:385)
    at cljs.closure$eval3465$fn__3466.invoke(closure.clj:425)
    at cljs.closure$eval3418$fn__3419$G__3409__3426.invoke(closure.clj:331)
    at cljs.closure$eval3478$fn__3479.invoke(closure.clj:439)
    at cljs.closure$eval3418$fn__3419$G__3409__3426.invoke(closure.clj:331)
    at cljsbuild.compiler.SourcePaths$fn__3873.invoke(compiler.clj:67)
    at clojure.core$map$fn__4551.invoke(core.clj:2622)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.RT.seq(RT.java:507)
    at clojure.core$seq__4126.invoke(core.clj:135)
    at clojure.core$apply.invoke(core.clj:628)
    at clojure.core$mapcat.doInvoke(core.clj:2658)
    at clojure.lang.RestFn.invoke(RestFn.java:423)
    at cljsbuild.compiler.SourcePaths._compile(compiler.clj:67)
    at cljs.closure$build.invoke(closure.clj:1475)
    at cljs.closure$build.invoke(closure.clj:1430)
    at cljsbuild.compiler$compile_cljs$fn__3884.invoke(compiler.clj:81)
    at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:80)
    at cljsbuild.compiler$run_compiler.invoke(compiler.clj:187)
    at user$eval4018$iter__4054__4058$fn__4059$fn__4077.invoke(form-init6806387650211269272.clj:1)
    at user$eval4018$iter__4054__4058$fn__4059.invoke(form-init6806387650211269272.clj:1)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.RT.seq(RT.java:507)
    at clojure.core$seq__4126.invoke(core.clj:135)
    at clojure.core$dorun.invoke(core.clj:3007)
    at clojure.core$doall.invoke(core.clj:3023)
    at user$eval4018.invoke(form-init6806387650211269272.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6792)
    at clojure.lang.Compiler.eval(Compiler.java:6782)
    at clojure.lang.Compiler.load(Compiler.java:7237)
    at clojure.lang.Compiler.loadFile(Compiler.java:7175)
    at clojure.main$load_script.invoke(main.clj:275)
    at clojure.main$init_opt.invoke(main.clj:280)
    at clojure.main$initialize.invoke(main.clj:308)
    at clojure.main$null_opt.invoke(main.clj:343)
    at clojure.main$main.doInvoke(main.clj:421)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:383)
    at clojure.lang.AFn.applyToHelper(AFn.java:156)
    at clojure.lang.Var.applyTo(Var.java:700)
    at clojure.main.main(main.java:37)
Caused by: clojure.lang.ExceptionInfo: Assert failed: Circular dependency detected [reagent.core]
(every? (fn* [p1__1601#] (not (contains? *cljs-dep-set* p1__1601#))) deps) at line 1 src/cljs/reagent/core.cljs {:file "src/cljs/reagent/core.cljs", :line 1, :column 1, :tag :cljs/analysis-error}
    at clojure.core$ex_info.invoke(core.clj:4591)
    at cljs.analyzer$error.invoke(analyzer.cljc:384)
    at cljs.analyzer$analyze_seq.invoke(analyzer.cljc:1898)
    at cljs.analyzer$analyze$fn__1971.invoke(analyzer.cljc:1992)
    at cljs.analyzer$analyze.invoke(analyzer.cljc:1985)
    at cljs.compiler$compile_file_STAR_$fn__3067.invoke(compiler.cljc:1027)
    at cljs.compiler$with_core_cljs.invoke(compiler.cljc:968)
    at cljs.compiler$compile_file_STAR_.invoke(compiler.cljc:988)
    at cljs.compiler$compile_file$fn__3099.invoke(compiler.cljc:1129)
    ... 45 more
Caused by: java.lang.AssertionError: Assert failed: Circular dependency detected [reagent.core]
(every? (fn* [p1__1601#] (not (contains? *cljs-dep-set* p1__1601#))) deps)
    at cljs.analyzer$analyze_deps.invoke(analyzer.cljc:1284)
    at cljs.analyzer$eval1721$fn__1723.invoke(analyzer.cljc:1545)
    at clojure.lang.MultiFn.invoke(MultiFn.java:251)
    at cljs.analyzer$analyze_seq.invoke(analyzer.cljc:1900)
    ... 51 more
Subprocess failed
mdaley commented 9 years ago

Oops, is it that I used the project name 'reagent'? It is fine if I use a sensible project name. Sorry for the confusion.

yogthos commented 9 years ago

Yeah, the template will create a namespace with the <project-name>.core, so if you name the project reagent then it will have a reagent.core that's the same name as the actual reagent.core that it references. :)

Frozenlock commented 9 years ago

Can we close this issue?