boot-clj / boot

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

Split an argument in three #578

Open arichiardi opened 7 years ago

arichiardi commented 7 years ago

I was trying to have this task option for a task:

a parent SYM:VER=PATH       [sym str str]

And I got:

                              java.lang.Thread.run              Thread.java:  745
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  617
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1142
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
                                               ...                               
               clojure.core/binding-conveyor-fn/fn                 core.clj: 2020
                                 boot.core/boot/fn                 core.clj: 1030
                                               ...                               
                         boot.core/construct-tasks                 core.clj:  986
                                               ...                               
            boot.from.clojure.tools.cli/parse-opts                  cli.clj:  500
   boot.from.clojure.tools.cli/parse-option-tokens                  cli.clj:  350
                               clojure.core/reduce                 core.clj: 6703
                                               ...                               
boot.from.clojure.tools.cli/parse-option-tokens/fn                  cli.clj:  347
                              boot.cli/assoc-fn/fn                  cli.clj:   79
                               boot.cli/parse-type                  cli.clj:   62
                               clojure.core/symbol                 core.clj:  579
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.String
  clojure.lang.ExceptionInfo: clojure.lang.PersistentVector cannot be cast to java.lang.String

What am I doing wrong?

martinklepsch commented 6 years ago

Could you maybe provide a runnable repro snippet @arichiardi?

arichiardi commented 6 years ago

@martinklepsch yes definitely, I can actually probably write a small test but I need more time.

This is what fails (in build.boot):

(deftask split-test
  [a parent SYM:VER=PATH [sym str str]]
  (with-pre-wrap [fs] fs))
$ boot split-test -a abc:efg=2
                              java.lang.Thread.run              Thread.java:  748
java.util.concurrent.ThreadPoolExecutor$Worker.run  ThreadPoolExecutor.java:  624
 java.util.concurrent.ThreadPoolExecutor.runWorker  ThreadPoolExecutor.java: 1149
               java.util.concurrent.FutureTask.run          FutureTask.java:  266
                                               ...                               
               clojure.core/binding-conveyor-fn/fn                 core.clj: 1938
                                 boot.core/boot/fn                 core.clj: 1032
                                               ...                               
                         boot.core/construct-tasks                 core.clj:  988
                                               ...                               
            boot.from.clojure.tools.cli/parse-opts                  cli.clj:  500
   boot.from.clojure.tools.cli/parse-option-tokens                  cli.clj:  350
                               clojure.core/reduce                 core.clj: 6544
                                               ...                               
boot.from.clojure.tools.cli/parse-option-tokens/fn                  cli.clj:  347
                              boot.cli/assoc-fn/fn                  cli.clj:   79
                               boot.cli/parse-type                  cli.clj:   62
                               clojure.core/symbol                 core.clj:  568
java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.String
  clojure.lang.ExceptionInfo: clojure.lang.PersistentVector cannot be cast to java.lang.String
    line: 107
arichiardi commented 6 years ago

This is actually what works:

(deftask split-test
  [a parent SYM:VER=PATH #{[sym str str]}]
  (with-pre-wrap [fs] fs))

Note the surrounding set.