diff --git a/plugin/src/leiningen/figwheel.clj b/plugin/src/leiningen/figwheel.clj index 5014d1cd..ff9114a6 100644 --- a/plugin/src/leiningen/figwheel.clj +++ b/plugin/src/leiningen/figwheel.clj @@ -291,11 +291,13 @@ "Get source paths for all of the lein projects in the checkouts directory." [project] (let [checkout-project-maps (lproject/read-checkouts project) - checkout-sources (for [co-project checkout-project-maps - source-path (:source-paths co-project)] - ;; Make the checkout source path pretty, e.g. checkouts/utils-lib/src - (str (.relativize (.toPath (io/file (:root project))) ;; Note, root of the parent project, not the checkout project - (.toPath (io/file source-path)))))] + parent-project-root-path (.toPath (io/file (:root project))) + checkout-sources (for [co-project checkout-project-maps + source-path-str (:source-paths co-project) + :let [source-path (.toPath (io/file source-path-str))]] + ;; Make the checkout source path pretty, e.g. ../utils-lib/src + ;; NOTE: this follows the symlink at checkouts/utils-lib + (str (.relativize parent-project-root-path source-path)))] (distinct checkout-sources))) (defn map-vals @@ -439,8 +441,9 @@ (defn build-once [project build-ids] (when-not (report-if-bad-build-ids project build-ids) - (let [checkout-sources (checkout-source-paths project) - project (add-source-paths project checkout-sources)] + (let [project (if (:add-checkout-source-paths (figwheel-options project)) + (add-source-paths project (checkout-source-paths project)) + project)] (run-build-once project (fuzzy-config-from-project project) @@ -450,8 +453,9 @@ (defn figwheel-main [project build-ids] (when-not (report-if-bad-build-ids project build-ids) - (let [checkout-sources (checkout-source-paths project) - project (add-source-paths project checkout-sources)] + (let [project (if (:add-checkout-source-paths (figwheel-options project)) + (add-source-paths project (checkout-source-paths project)) + project)] (run-figwheel project (-> project fuzzy-config-from-project) diff --git a/plugin/test/leiningen/figwheel_test.clj b/plugin/test/leiningen/figwheel_test.clj index 7e7bb439..6d30f1b7 100644 --- a/plugin/test/leiningen/figwheel_test.clj +++ b/plugin/test/leiningen/figwheel_test.clj @@ -184,12 +184,12 @@ {:id "prod" :source-paths ["src/cljs" "src/cljc" "prod"] :resource-paths ["resources"]}]}} - ["checkouts/util-lib/src"]) + ["../util-lib/src"]) {:cljsbuild {:builds [{:id "dev" - :source-paths ["src/cljs" "src/cljc" "dev" "checkouts/util-lib/src"] + :source-paths ["src/cljs" "src/cljc" "dev" "../util-lib/src"] :resource-paths ["resources"]} {:id "prod" - :source-paths ["src/cljs" "src/cljc" "prod" "checkouts/util-lib/src"] + :source-paths ["src/cljs" "src/cljc" "prod" "../util-lib/src"] :resource-paths ["resources"]}]}})))) (deftest checkout-source-paths-test @@ -204,7 +204,7 @@ :output-to "resources/public/js/example.js" :output-dir "resources/public/js/out" :optimizations :none}}}}}) - ["checkouts/utils-lib/src"]))) + ["../utils-lib/src"]))) (testing "test project with no checkouts" (is (= (f/checkout-source-paths {:root (str cwd "/test-resources/test-project-with-no-checkouts")