graalvm

wombawomba 2022-07-07T09:31:24.124999Z

Is there a way to have compile-time-only dependencies and code when building native images? I'd like to precompute some stuff that requires dependencies and code that I then don't use in the final build.

borkdude 2022-07-07T09:44:10.500989Z

Can you give an example?

wombawomba 2022-07-07T09:46:18.378019Z

Sure. I'm extracting and precomputing some data from the commits in my repository using https://www.eclipse.org/jgit/

wombawomba 2022-07-07T09:46:53.017019Z

I need the data in the executable, but not the code to produce it

borkdude 2022-07-07T09:48:19.704839Z

Maybe just spit that out as an .edn file and then include the .edn file as a resource?

wombawomba 2022-07-07T09:48:39.887519Z

though about it, but I'd rather not

wombawomba 2022-07-07T09:49:00.627429Z

when developing I want to be able to run the computation continuously

wombawomba 2022-07-07T09:49:15.769099Z

I mean, whenever I need it

wombawomba 2022-07-07T09:49:36.842099Z

and sticking it in a resource means I'd have to recompute/reload it manually

borkdude 2022-07-07T09:54:06.084419Z

you could do it in a macro which runs at compile time and the compiled bytecode would contain the result

wombawomba 2022-07-07T09:54:21.275849Z

yeah that'd be ideal

borkdude 2022-07-07T09:54:46.618379Z

but since eclipse git stuff probably uses security stuff, I'd expect that you would not be allowed to do this at build time, but worth a try

wombawomba 2022-07-07T09:54:54.118659Z

I'm wondering how I would actually structure my code so that the dependencies don't get pulled in

borkdude 2022-07-07T09:54:59.646169Z

I would probably not use eclipse git stuff at all, just shell out to git instead

wombawomba 2022-07-07T09:55:10.046969Z

yeah, can't do that

wombawomba 2022-07-07T09:55:41.083789Z

if I make my macro call a function, will that function get compiled in?

wombawomba 2022-07-07T09:55:55.281909Z

i.e. would I have to stick all the code in the macro?

wombawomba 2022-07-07T09:57:13.356909Z

...and if I do that, would graalvm still build the jgit classes I (:include) into the native image?