tools-build

wegi 2023-10-16T12:28:55.550469Z

Hey, I am toying around with tools.build and encountering the following problem: If I def something which depends on env variables, it crashes, because the def is apparently evaluated. I did not encounter this behaviour, when using depstar for the same code. Is there any possiblity to disable evaluation of some global variables? Or am I misunderstanding something fundamentally?

Alex Miller (Clojure team) 2023-10-16T12:55:49.212789Z

If you are compiling, then you are loading, and top level defs get evaluated

Alex Miller (Clojure team) 2023-10-16T12:56:23.428909Z

A common technique is to use delay and then deref when you use the value

wegi 2023-10-16T13:02:04.590189Z

Yeah, you’re right. Its the compile step. I assume there is no way to have certain files included as .clj without compiling them in the uberjar?

Alex Miller (Clojure team) 2023-10-16T13:26:15.898139Z

You choose what gets compiled, but I think would fix the problem.

wegi 2023-10-16T13:26:39.196379Z

Thanks, will try it out 🙂

wegi 2023-10-16T12:43:19.018779Z

I am currently using the uberjar template from the tools.build documentation