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

Checkouts with explicit opt in, and potentially fixing tests #1

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions plugin/src/leiningen/figwheel.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions plugin/test/leiningen/figwheel_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down