babashka / pods

Pods support for JVM and babashka

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JVM incompatibility

borkdude opened this issue · comments

When using this library on the JVM, there appears to be a problem with the bootleg pod that does not manifest with babashka native.

(ns html  (:require [babashka.curl :as curl]
                    #_[pl.danieljanus.tagsoup :as html]
                    [babashka.pods :as pods]
                    ))
;;; use pods to load bootleg for html parsing: https://github.com/retrogradeorbit/bootleg#babashka-pod-usage
;;; Note that you have to install bht pod on the system first!
(pods/load-pod "bootleg")
(require '[pod.retrogradeorbit.bootleg.utils :as utils])
(utils/html->hiccup "<html><body><p>ahoj</p></body></html>")
{:aliases {:clj {:extra-deps {;; Additional libs for clojure to match babashka includes
                              org.clojure/tools.cli {:mvn/version "1.0.194"}
                              org.clojure/data.csv {:mvn/version "1.0.0"}
                              org.clojure/data.xml {:mvn/version "0.2.0-alpha6"}
                              babashka/babashka.curl {:mvn/version "0.0.1"}
                              ;; used pods to load bootleg for HTML parsing: https://github.com/retrogradeorbit/bootleg#babashka-pod-usage
                              babashka/babashka.pods {:git/url "https://github.com/babashka/pods.git"
                                                      ;; https://github.com/babashka/pods/commit/1417f30fc4001cc9490b5f83c68630ea877d92d6
                                                      :sha "9d363c7d3c740b2f333a58eafb9afaa25b09aaca"}
                              cheshire/cheshire {:mvn/version "5.10.0"}}
                 :extra-paths ["dev"]}}
 :paths ["src"]
 :deps {clj-tagsoup/clj-tagsoup {:mvn/version "0.3.0"}}}
$ clojure -M:clj bootleg.clj
Checking out: https://github.com/babashka/pods.git at 9d363c7d3c740b2f333a58eafb9afaa25b09aaca
Syntax error (ClassNotFoundException) compiling at (REPL:1:102).
clojure.zip

Full report at:
/var/folders/2m/h3cvrr1x4296p315vbk7m32c0000gp/T/clojure-5852486966441112648.edn

This seems to be solved by adding a (require '[clojure.zip]):

(ns html  (:require [babashka.pods :as pods]))
(require '[clojure.zip])
(def pod (pods/load-pod "bootleg"))
(require '[pod.retrogradeorbit.bootleg.utils :as utils])
(prn (utils/html->hiccup "<html><body><p>ahoj</p></body></html>"))

(pods/unload-pod pod)
(shutdown-agents)

@retrogradeorbit Do you think the require could be added to the bootleg pod somehow to make it compatible with the JVM?

PS: note that I also have to unload the pod and call shutdown-agents to exit the JVM normally.

I missed this at the time. I wish github had webpush notifications for this stuff.
I will have a look at this.