lein-cljsbuild
lein-cljsbuild copied to clipboard
Checkouts projects without :cljsbuild causes warnings
When you have a ClojureScript project with a non-ClojureScript checkouts project these warnings:
WARNING: no :cljsbuild entry found in project definition.
--------------------------------------------------------------------------------
WARNING: your :cljsbuild configuration is in a deprecated format. It has been
automatically converted it to the new format, which will be printed below.
It is recommended that you update your :cljsbuild configuration ASAP.
--------------------------------------------------------------------------------
:cljsbuild
{:builds []}
--------------------------------------------------------------------------------
See https://github.com/emezeske/lein-cljsbuild/blob/master/README.md
for details on the new format.
--------------------------------------------------------------------------------
Happens in lein-cljsbuild 1.1.0, but not 1.0.6.
@henriklundahl Could you provide a minimal setup where this issue can be reproduced?
Yes, see https://github.com/henriklundahl/lein-cljsbuild-issue-413. This is the steps I took:
- lein new reagent cljs-project
- lein new clj-project
- cd clj-project
- lein install
- mkdir ../cljs-project/checkouts
- cd ../cljs-project/checkouts
- ln -s ../../clj-project
- Change version of lein-cljsbuild to 1.1.0 in cljs-project/project.clj.
- Add clj-project as a dependency in cljs-project/project.clj.
- cd ..
- lein cljsbuild once
I should point out that everything seems to work despite of these warnings, so I don't think this is especially important to fix.
Thanks!
The problem is that project.clj
of some project in checkouts directory does not contain proper :cljsbuild
configuration.
Thoughts:
- It would be nice if lein-cljsbuild could print also relevant notice that warnings/errors are related to a specific checkouts directory project not to the root project.clj. In this case it leads to a great confusion.
- In my case problematic library is
https://github.com/suprematic/khroma/blob/10bb18f848be2cb25c53a6ea0b404b1b5ce9e5e7/project.clj. This library does not configure cljsbuild for some reason (I'm unaware how they produce jar for clojars), but it can be consumed from checkouts directory just fine. I just have to include path/to/checkouts/khroma/src into my
:source-paths
in my active cljsbuild profile in root project.clj.
Regarding 1), I agree, changing the warning to include the relevant project would be helpful. Additionally, the warning should not be shown when the project is Clojure only.
Regarding 2), currently, we use the cljsbuild config of checkouts to get the :source-paths
from. I guess what we could do is to check if the project is a ClojureScript project (has *.cljs or *.cljc files only) and then either take the path from the general :source-paths
config entry if it exists or use src
as a default.
PRs are welcome :wink:
I have a project which experiences this error, but neither it nor any of its checkouts are not using the new format. It is the case that some of the projects only specify a :cljsbuild
section in a profile rather than having one at the top level, and that profile may not be active for all leiningen tasks. It would be useful if the error message could explain which project is missing the :cljsbuild
config, and what profiles are being applied to it.
Here are actually three separate problems:
- When cljsbuild is run on project that lacks :cljsbuild section both "missing configuration" and conversion notice are issued. This is bug. Should not show conversion warning if no configuration found. And, BTW, vector in conversion sample config is misleading, since map is required.
- Probably there's good solution that could be implemented in Leiningen itself but there should be a message or hint that tells that these issues are found in checkouts/sub-pojects, not current one.
- I think that cljsbuild should probably ignore checkout projects that do not have cljsbuild plugin configured.
Note that double warning issue is easily reproducible on a project without :cljsbuild
section. No checkouts actually required to reproduce it (however we'll have one such message per project/checkout with missing config). To reproduce, use e.g. project.clj
(defproject cljsproj "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/clojurescript "1.8.51"]]
:plugins [[lein-cljsbuild "1.1.3"]])
then run
lein cljsbuild once
Does anyone have a patch to fix this?