This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-12
Channels
- # announcements (65)
- # aws (1)
- # babashka (12)
- # beginners (111)
- # bristol-clojurians (1)
- # cider (32)
- # clj-kondo (55)
- # clojars (3)
- # clojure (71)
- # clojure-europe (17)
- # clojure-france (4)
- # clojure-italy (36)
- # clojure-losangeles (8)
- # clojure-nl (6)
- # clojure-uk (115)
- # clojurescript (2)
- # datomic (99)
- # fulcro (32)
- # graalvm (12)
- # graphql (20)
- # hoplon (203)
- # meander (56)
- # mount (3)
- # off-topic (17)
- # pathom (17)
- # reitit (22)
- # shadow-cljs (32)
- # spacemacs (9)
- # tools-deps (19)
- # vim (25)
- # vscode (3)
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 (.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 ..
It’s really my last resort. I gave up this yaml parsing thing
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 😎