hashobject/perun

Move to babaska?

Opened this issue · 6 comments

I have been flirting with the idea of moving away from boot for my blog but not from perun.

The main advantage that I see there is startup time and possibly, but not sure about that, rendering time.

I am thinking some code could be created to handle the tasks and use the same Java libraries for it.

Mainly asking feedback on this, not sure it is worth it also but boot's maintainance could also be a factor here.

Thanks!

Ciao, @arichiardi!
Thanks for bringing this up!

Please read my answer in #241 (comment)_

Best,
Leandro

After closer inspection I am not sure it is possible to run arbitrary Java libs in babashka but I might be wrong.

Let me ask directly to @borkdude.

We have dependencies in here like:

perun/src/io/perun.clj

Lines 403 to 404 in 7d48f73

[com.vladsch.flexmark/flexmark "0.40.16"]
[com.vladsch.flexmark/flexmark-profile-pegdown "0.40.16"]])

or [org.asciidoctor/asciidoctorj "2.0.0"] and even [org.apache.lucene/lucene-analyzers-common "8.4.1"]

If we built a classpath with those in it, would babashka be able to use them all?

It's a long shot and sorry about a bit of newbie-ness here 😄

@arichiardi Babashka is only able to use Java classes that have been explicitly added into the native image. If you want to create something like babashka, but for static site generation, you will probably have to make your own GraalVM native-image project. Bootleg has done something similar: https://github.com/retrogradeorbit/bootleg

At work we are currently migration away from boot and running some tasks in a separate JVM, while also still using boot in another one. We use this babashka script for it:

#!/usr/bin/env bb

(ns dev (:require [clojure.string :as str]))

(require '[babashka.process :refer [$ destroy-tree *defaults*]])

(alter-var-root #'*defaults* assoc
                :out :inherit
                :err :inherit
                :shutdown destroy-tree)

(defn cljs []
  ($ "./clojure" "-A:frontend:cljs/dev"))

(defn less []
  ($ "./clojure" "-A:frontend:less/dev"))

(defn clojure []
  ^{:inherit true} ($ "./boot" "dev"))

(cljs)
(less)
(-> @(clojure) :exit (System/exit))

If you want to create something like babashka, but for static site generation, you will probably have to make your own GraalVM native-image project.

Thank you for confirming that's what I was thinking too.

Bootleg has done something similar

Thanks for the heads up, however perun here does a lot more nice things than just rendering (atom, lessc, ...). That's why IMHO is worth keeping it going 😄