Does it mean we could target C++ using Clojure haha?
Graalvm protip: you can always shell out to the jar you are trying to run π
(defn from-yaml-via-jar [jar-path s]
(let [{:keys [exit out err]} (sh "java" "-jar" jar-path "generate" "--input-format" "yaml" :in (<http://java.io|java.io>.StringReader. s))]
(if (zero? exit)
(cheshire/parse-string out)
(throw (ex-info "" {:type :exit
:exit/code exit
:exit/message (str out err)})))))
(defn from-yaml [fallback-jar input]
(let [s (slurp input)]
(try
(cfn/parse s)
(catch org.yaml.snakeyaml.error.YAMLException e
(if fallback-jar
(from-yaml-via-jar fallback-jar s)
(do
(println "Did you consider using the --fallback-jar option to be able to read custom AWS tags?")
(throw e)))))))
shelling out to java: that's also what the GraalVM compiled deps.clj does π. it's kind of the entire of point of the tool, to create a classpath and then launch a JVM π
yeah nice π Iβm not doing the same though if thatβs what you mean. Iβm shelling out to the uberjar Iβm trying to run via Graalvm in the first place. The yaml parsing fails in Graal, but succeeds in the jar ..
haha yeah, that's a nice fallback π
Itβs really my last resort. I gave up this yaml parsing thing
it really is a rabbit hole, isn't it.
yeah and I only really wanted to use it for importing cloudformation templates. So it started as nice to have this yaml file importing part. Now time for some real features with Sci π
can you use core.spec within something graalvm-compiled with clojure 1.9.0?
you can also use it again now with 1.10.2-alpha1
oh, awesome!