Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.1.4 causes cljsbuild to sometimes compile sources in other build configs #451

Closed
cap10morgan opened this issue Aug 31, 2016 · 8 comments
Closed
Milestone

Comments

@cap10morgan
Copy link

I can't consistently reproduce this (in the best way: in my dev environment I can't get it to happen ever, in my CI environment it always happens), but lein with-profile production cljsbuild once min the project.clj below sometimes tries to compile code under test/cljs and fails because its dependencies aren't available (specifically the ones in the :dev leiningen profile).

1.1.3 and below do not exhibit this behavior in any environment.

(defproject turbovote-web "0.1.0-SNAPSHOT"
  :description "TurboVote front-end"
  :url "https://github.com/democracyworks/turbovote-web"
  :license {:name "Eclipse Public License"
            :url "http://www.eclipse.org/legal/epl-v10.html"}

  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.9.227"]
                 [org.clojure/core.async "0.2.385"]
                 [sablono "0.3.6"] ; 0.3.6 seems to be the last version that works with Om 0.9.0
                 [org.omcljs/om "0.9.0"]
                 [secretary "1.2.3"]
                 [prismatic/schema "1.1.3"]
                 [environ "1.1.0"]
                 [com.cognitect/transit-cljs "0.8.239"]
                 [org.clojure/tools.logging "0.3.1"]
                 [turbovote.resource-config "0.2.0"]
                 [com.novemberain/langohr "3.6.1"]
                 [ch.qos.logback/logback-classic "1.1.7"]
                 [democracyworks/kehaar "0.6.0"]
                 [io.pedestal/pedestal.service "0.4.1"]
                 [io.pedestal/pedestal.service-tools "0.4.1"]
                 [democracyworks/pedestal-toolbox "0.7.0"]
                 [org.immutant/web "2.1.5"]
                 [io.pedestal/pedestal.immutant "0.4.1"]
                 [org.immutant/core "2.1.5"]
                 [hiccup "1.0.5"]
                 [com.cemerick/url "0.1.1"]
                 [clj-http "3.2.0"]
                 [cheshire "5.6.3"]]

  :plugins [[lein-cljsbuild "1.1.3"]
            [lein-figwheel "0.5.6"]
            [lein-doo "0.1.7"]
            [lein-environ "1.1.0"]
            [lein-immutant "2.1.0"]]

  :main ^:skip-aot turbovote-web.server

  :profiles {:dev {:dependencies [[doo "0.1.7"]
                                  [com.cemerick/piggieback "0.2.1"]
                                  [org.clojure/tools.nrepl "0.2.12"]
                                  [figwheel-sidecar "0.5.6"]
                                  [prismatic/dommy "1.1.0"]]
                   :source-paths ["dev-src/clj"]
                   :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
                   ;; env values *MUST* be strings
                   :env {:notification-delay "1" ; minute(s)
                         :voter-reg-url "http://localdocker:58080/voter-registration-http-api"
                         :election-notification-url "http://localdocker:58080/election-notification-http-api"
                         :election-api-url "http://localdocker:58080/election-http-api"
                         :user-url "http://localdocker:58080/user-http-api"
                         :voting-method-api-url "http://localdocker:58080/voting-method-http-api"
                         :vote-by-mail-api-url "http://localdocker:58080/vote-by-mail-http-api"
                         :election-mail-api-url "http://localdocker:58080/election-mail-http-api"}}}

  :hooks [leiningen.cljsbuild]

  :doo {:build "test"}

  :aliases {"test" ["doo" "phantom" "once"]}

  :source-paths ["src/clj"]

  :clean-targets ^{:protect false} ["resources/public/deploy/js/compiled" "target"
                                    "resources/test" "out"]

  :cljsbuild {
              :builds [{:id "dev"
                        :source-paths ["src/cljs"]
                        :figwheel {:on-jsload "turbovote-web.core/on-js-reload"}
                        :compiler {:main "turbovote-web.core"
                                   :asset-path "deploy/js/compiled/out"
                                   :output-to "resources/public/deploy/js/compiled/turbovote_web.js"
                                   :output-dir "resources/public/deploy/js/compiled/out"
                                   :source-map-timestamp true}}
                       {:id "min"
                        :source-paths ["src/cljs"]
                        :compiler {:output-to "resources/public/deploy/js/compiled/turbovote_web.js"
                                   :main "turbovote-web.core"
                                   :optimizations :advanced
                                   :pretty-print false
                                   :externs ["externs/browser.js"]}}
                       {:id "test"
                        :source-paths ["src/cljs" "test/cljs"]
                        :compiler {:output-to "resources/test/compiled.js"
                                   :main "turbovote-web.test-runner"
                                   :optimizations :none
                                   :pretty-print true}}]}

  :figwheel {
             :css-dirs ["resources/public/deploy/css"] ;; watch and update CSS
             :nrepl-port 7889
             :ring-handler turbovote-web.service/index-html-handler})
@darwin
Copy link

darwin commented Sep 18, 2016

I have the same issue. Current workaround is to split individual build-ids into separate lein :profiles and not expose cljsbuild to other build-ids.

@mneise
Copy link
Collaborator

mneise commented Sep 19, 2016

@cap10morgan @darwin I think I know which code change is responsible for this, but I don't understand yet why it's causing the mentioned behaviour. Sorry for this. Does this happen for any project.clj or just for some?

@darwin Would you mind sharing your build config or project for which this happens?

@darwin
Copy link

darwin commented Sep 19, 2016

@mneise I tried to prepare a branch with reproducible build, but I'm unable to reproduce it here anymore. Even going back and hard-resetting my master branch to previously failing commit does not reproduce the issue anymore.

@keeds
Copy link

keeds commented Sep 19, 2016

I have this issue also with a work repo so not something I can share without making a minimal example. I'll try. It is not consistent. Dev machines show issue with but CI server builds are fine? In our case it was pulling in a ns from "test" src folder not defined in the "release" config we were building. Even if the "test" build config was commented out.

@mneise
Copy link
Collaborator

mneise commented Sep 21, 2016

I've tried reproducing this but so far wasn't able to. If any of you has a project where this issue can be reproduced, please let me know 😉

@p-himik
Copy link

p-himik commented Oct 17, 2016

This is enough to reproduce, just add some source to src/cljs:

(defproject test "1.0.0-SNAPSHOT"
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.9.229"]]

  :min-lein-version "2.0.0"

  :plugins [[lein-cljsbuild "1.1.4"]]

  :cljsbuild {:builds [{:source-paths ["src/cljs"]
                        :compiler     {:output-to "resources/main_dev.js"}}
                       {:id           "production"
                        :source-paths ["src/cljs"]
                        :compiler     {:output-to "resources/main_prod.js"}}]}

  :hooks [leiningen.cljsbuild])

I can reproduce it 99% of the time.

@p-himik
Copy link

p-himik commented Oct 17, 2016

I don't see any relevant difference between 1.1.3 and 1.1.4. Also, given that different people have problems reproducing it - maybe it's caused by some [transitive] dependency and version range?

@gered
Copy link

gered commented Dec 2, 2016

Figured I'd mention that I also ran into this issue very recently and as soon as I removed the

:hooks [leiningen.cljsbuild]

line the problem went away (luckily I didn't really need that in my project.clj anyway).

Before I found out that that fixed the problem for me, I did try downgrading to 1.1.3 and the problem also went away then too. However now I have no problem with 1.1.4 and without the hooks line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants