lein-cljsbuild icon indicating copy to clipboard operation
lein-cljsbuild copied to clipboard

Checkouts projects without :cljsbuild causes warnings

Open henriklundahl opened this issue 9 years ago • 8 comments

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 avatar Sep 07 '15 09:09 henriklundahl

@henriklundahl Could you provide a minimal setup where this issue can be reproduced?

mneise avatar Sep 10 '15 05:09 mneise

Yes, see https://github.com/henriklundahl/lein-cljsbuild-issue-413. This is the steps I took:

  1. lein new reagent cljs-project
  2. lein new clj-project
  3. cd clj-project
  4. lein install
  5. mkdir ../cljs-project/checkouts
  6. cd ../cljs-project/checkouts
  7. ln -s ../../clj-project
  8. Change version of lein-cljsbuild to 1.1.0 in cljs-project/project.clj.
  9. Add clj-project as a dependency in cljs-project/project.clj.
  10. cd ..
  11. 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!

henriklundahl avatar Sep 10 '15 08:09 henriklundahl

The problem is that project.clj of some project in checkouts directory does not contain proper :cljsbuild configuration.

Thoughts:

  1. 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.
  2. 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.

darwin avatar Nov 06 '15 14:11 darwin

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:

mneise avatar Nov 07 '15 03:11 mneise

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.

conan avatar Feb 18 '16 13:02 conan

Here are actually three separate problems:

  1. 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.
  2. 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.
  3. I think that cljsbuild should probably ignore checkout projects that do not have cljsbuild plugin configured.

PetrGlad avatar May 19 '16 03:05 PetrGlad

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

PetrGlad avatar May 19 '16 03:05 PetrGlad

Does anyone have a patch to fix this?

ghost avatar Mar 28 '17 12:03 ghost