Closed FieryCod closed 3 years ago
Look good to me. Perhaps also add "resources" to
:paths` in deps.edn.
@borkdude do you see everything I do on Github? :eyes: :laughing:
Actually, I can update deps.edn
to match the dependencies, resources of project.clj
if necessary. Should I @ikitommi?
I am subscribed to jsonista issues ;).
Updating the dependencies in two places is no fun, it would be better to lift this as deps-project. PR most welcome on that. (jmh-test too)
Huh. That was fast. Could we please release the new version of jsonista
with just this change? :pray:
https://clojars.org/metosin/jsonista/versions/0.3.4
let me know if that works for you
Works perfectly fine:
...
-imagecp \
/opt/graalvm-ce-java8-21.2.0/jre/lib/boot/graaljs-scriptengine.jar:/opt/graalvm-ce-java8-21.2.0/jre/lib/boot/graal-sdk.jar:/project/.holy-lambda/build/output.jar:/opt/graalvm-ce-java8-21.2.0/jre/lib/svm/library-support.jar \
-H:Path=/project/.holy-lambda/build \
'-H:Class@manifest from file:///project/.holy-lambda/build/output.jar=com.compan
y.example_lambda.core' \
'-H:Name@manifest from file:///project/.holy-lambda/build/output.jar=output' \
'-H:ClassInitialization@jar:file:///project/.holy-lambda/build/output.jar!/META-
INF/native-image/metosin/jsonista/native-image.properties=com.fasterxml.jackson:
build_time' \ <-- SEE HERE
'-H:ClassInitialization@jar:file:///project/.holy-lambda/build/output.jar!/META-
INF/native-image/metosin/jsonista/native-image.properties=jsonista:build_time' \ <-- SEE HERE
-H:ConfigurationFileDirectories=native-configuration \
-H:FallbackThreshold=0 \
-H:EnableURLProtocols=http,https \
-H:+ReportUnsupportedElementsAtRuntime \
-H:+AllowIncompleteClasspath \
-H:CLibraryPath=/opt/graalvm-ce-java8-21.2.0/jre/lib/svm/clibraries/linux-amd64
]
Thank you so much @ohpauleez @ikitommi @borkdude :)
Just as a FYI:
This is due to the fact, that some of the com.fasterxml.jackson classes are initialized unconditionally in core.clj.
This can usually be prevented by wrapping those top-level-ns instances in delays. If that's possible, this is the preferred solution, but this would perhaps break users of those top-level vars.
As
clj-easy/graal-build-time
states:Without now discouraged
--initialize-at-build-time
with no arguments passed thenative-image
tool fails to build the project that depends onmetosin/jsonista
. This is due to the fact, that some of thecom.fasterxml.jackson
classes are initialized unconditionally incore.clj
.The following changes auto provides the necessary
jsonista
configurations to GraalVMnative-image
, are backward compatible for all GraalVMjsonista
users, and should not introduce any breakage.