Fork me on GitHub
#leiningen
<
2021-04-13
>
bastilla16:04:54

Hi. :clean-targets isn't really working, is it? I am working on a project generated by template. The sections goes like:

:clean-targets ^{:protect false} ["resources/main.js"
                                    "resources/public/js/ui-core.js"
                                    "resources/public/js/ui-core.js.map"
                                    "resources/public/js/ui-out"]
But lein clean never deletes these folders and files. I fail to find an official documentation, just a master sample: https://raw.githubusercontent.com/technomancy/leiningen/master/sample.project.clj which depicts a completely different structure under :clean-targets . Same as from a poor fellow on stackoverflow: https://stackoverflow.com/questions/38387800/lein-clean-temporary-output-folder So I changed it to:
:clean-targets ^{:protect false} [:target-path
                                    :output-paths ["resources/public/js/ui-out"
                                                   "resources/public/js/ui-release-out"]
                                    "resources/main.js"
                                    "resources/public/js/ui-core.js"
                                    "resources/public/js/ui-core.js.map"]
And lein clean is finally doing... Dickie McGeezack. Nadda. There is no official documetation on stuff like this? I again fail miserably to find docs on Clojure stuff. Any hints would be greatly appreciated!

noisesmith17:04:51

@bastilla the best docs of lein config are in lein help sample - searching the output finds this

;; :clean-targets below lets `lein clean` remove files under "target",
  ;; "classes", "foo", "bar", "qux", and "out".
  ;; By default, will protect paths outside the project root and within standard
  ;; lein source directories ("src", "test", "resources", "doc", "project.clj").
  ;; However, this protection can be overridden with metadata on the :clean-targets
  ;; vector - ^{:protect false}

noisesmith17:04:18

the wiki probably has more detail, but help sample has been my go to starting place

noisesmith17:04:10

oh, you referenced the same document, OK

noisesmith17:04:57

@bastilla regarding you config there, the formatting makes it look like you think that the vector after :output-paths is an argument to it?

bastilla15:04:09

Terribly sorry for my late response. Thanks @U051SS2EU. Your mind reading capabilities are intact. I assumed an association where there is just a vector. Still, lein clean doesn't work, and it should with this seting. I "solved" it by putting everything in a clean.sh, and ./clean.sh is just as easy to handle. Thanks for your eyes, ears and time.

noisesmith17:04:48

my understanding is that each entry is either a string for a specific path, a vector of strings for convenience, or a keyword which looks up the string or vector defined for that keyword

noisesmith17:04:18

so putting :output-paths in the vector tells it to remove everything in :output-paths