perun icon indicating copy to clipboard operation
perun copied to clipboard

Move to babaska?

Open arichiardi opened this issue 4 years ago • 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!

arichiardi avatar May 24 '20 18:05 arichiardi

Ciao, @arichiardi! Thanks for bringing this up!

Please read my answer in https://github.com/hashobject/perun/issues/241#issuecomment-633280532_

Best, Leandro

allentiak avatar May 24 '20 19:05 allentiak

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

arichiardi avatar Dec 22 '20 02:12 arichiardi

Let me ask directly to @borkdude.

We have dependencies in here like:

https://github.com/hashobject/perun/blob/7d48f735e2bd66a4d93187900889ca617c5db92d/src/io/perun.clj#L403-L404

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 :smile:

arichiardi avatar Dec 22 '20 02:12 arichiardi

@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))

borkdude avatar Dec 22 '20 08:12 borkdude

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.

arichiardi avatar Dec 23 '20 00:12 arichiardi

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 :smile:

arichiardi avatar Dec 23 '20 00:12 arichiardi