Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task edge cases #865

Closed
borkdude opened this issue May 24, 2021 · 0 comments
Closed

Task edge cases #865

borkdude opened this issue May 24, 2021 · 0 comments

Comments

@borkdude
Copy link
Collaborator

Given the following tasks:

{:tasks {:init (do
                 (ns my-ns)
                 (def ^:dynamic *jdk* nil)
                 ;; workaround
                 (alter-meta! (var *jdk*) assoc :dynamic true)
                 (def ^:dynamic *server* nil)
                 (alter-meta! (var *server*) assoc :dynamic true))
         :enter (println "Task:" (:name (babashka.tasks/current-task)))
         jdk (println "JDK:" *jdk*)
         server {:depends [jdk]
                 :task (println "Server:" *server*)}
         run-all (doseq [jdk [8 11 15]
                         server [:foo :bar]]
                   (binding [*jdk* jdk
                             *server* server]
                     (babashka.tasks/run 'server)))}}

we see the following issues:

  • dynamic vars aren't dynamic (due to an issue with how metadata is processed). Workaround: alter-meta!.
  • each run runs in a random namespace, but all tasks should run in the same namespace. Workaround: set namespace manually and use fully qualified symbols for task built-ins.
borkdude added a commit that referenced this issue May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant