boot-clj / boot

Build tooling for Clojure.
https://boot-clj.github.io/
Eclipse Public License 1.0
1.75k stars 181 forks source link

boot call is broken in 2.8.1 #707

Closed alexander-yakushev closed 6 years ago

alexander-yakushev commented 6 years ago

Works in 2.7.2:

$ boot call -e '(+ 2 2)' -p
4

Broken in 2.8.1:

$ boot call -e '(+ 1 2)' -p
  clojure.lang.ExceptionInfo: java.lang.Character cannot be cast to java.lang.String
    line: 65
java.lang.ClassCastException: java.lang.Character cannot be cast to java.lang.String
                          clojure.core/read-string                 core.clj: 3771
                              clojure.core/fnil/fn                 core.clj: 6486
                               boot.cli/parse-type                  cli.clj:   72
                               clojure.core/map/fn                 core.clj: 2752
                                               ...
                                  clojure.core/seq                 core.clj:  137
                 clojure.core.protocols/seq-reduce            protocols.clj:   24
                         clojure.core.protocols/fn            protocols.clj:   75

boot call -f throws the same error too which seems to relate to parsing symbol and form arguments.

alexander-yakushev commented 6 years ago

Found the culprit: https://github.com/boot-clj/boot/commit/197f991324d9207f5d4b7b1828dd54ff61aadd09

Not sure if this was intended, but [sym] notation does not mean multiple arguments anymore. We can still use #{sym} for that but a) The order is lost then and it might be important b) There are still plenty of tasks that use [] notation.

seancorfield commented 6 years ago

That commit breaks Multi-Options per the documentation (set or vectors are documented to be supported but vectors no longer work). This breaks the run task in all boot/new application projects:

(deftask run
  "Run the project."
  [a args ARG [str] "the arguments for the application."]
  (with-pass-thru fs
    (require '[taskarg.core :as app])
    (apply (resolve 'app/-main) args)))

Order must be preserved here.

This has also broken a number of tasks in our build pipeline at work where we use [str] because order is important.

Raffinate commented 6 years ago

I faced with an error when I tried to use boot new tenzing template to create new app project. I got interested why it doesn't work and find the commit and changes which caused that. After that I search open issues here and find this one, which happens to be exact same issue why tenzing template doesn't work.

I tried to understand how this should be fixed, but wiki https://github.com/boot-clj/boot/wiki/Task-Options-DSL explicitly mentions that for sequential [...] optarg "if multiple arguments are supplied only there last is taken and no conjoining happens". So right now it's completely unclear for me how this issue should be fixed because there are contradictions in how complex optargs should behave. It looks like "complex optargs" feature was not designed or documented properly.

Is there a plan to overcome this situation already?

arichiardi commented 6 years ago

Started to look into this, solution is feasible keeping both behaviours it seems. Stay tuned!