Fork me on GitHub
#tools-deps
<
2021-05-04
>
yuhan07:05:16

Does anyone know of a worked example of integrating Java sources into a tools.deps project like https://github.com/puredanger/clojure-from-java, ideally with support for iterative development/reloading of the Java files? I understand there's no equivalent of :java-source-paths in deps.edn and we have to do some sort of jar compilation step manually

delaguardo07:05:49

https://github.com/xapix-io/axel-f/tree/master/src/axel_f/buddy/util small example to compile - javac $(find . -name '*.java' -type f)

👍 3
flowthing08:05:03

Not sure whether this is the best channel for this question, but: I've inherited a codebase that makes heavy use of :pre and :post. The project currently uses Leiningen, where it's possible to disable assertions when building an uberjar by adding :global-vars {*assert* false} into project.clj. Is there a way to disable assertions with tools.deps?

borkdude08:05:41

How does leiningen implement this feature?

flowthing09:05:07

No idea. Could look into it. Might be it just does alter-var-root on *assert* at the start.

flowthing09:05:54

It'd be nice if there were a system property to disable assertions.

borkdude09:05:58

I still don't see how leiningen sets the dynamic var for each namespace, or does it establish thread bindings for the entire project, I guess so

flowthing09:05:47

Yeah, not sure.

flowthing09:05:07

Looks like my best bet is to bite the bullet and migrate to spec/assert (most of the pre/post conditions are spec assertions).

borkdude09:05:07

or wait for spec2 ;)

flowthing09:05:34

I'm afraid I'll need to deliver before that. 😛

seancorfield16:05:07

Why do you want to disable the assertions? That would mean that if your code tripped over those conditions in production, it would continue on with bad data and potentially cause all sorts of corruption, instead of failing fast.

seancorfield16:05:26

I’ve never understood why folks want to disable assertions in production…

borkdude16:05:16

It depends if you use those assertions for dev purposes or domain purposes. We use asserts for dev purposes e.g. to verify if our system has the right components in certain function calls

flowthing16:05:44

@U04V70XH6 This codebase is absolutely chock full of pre/post-conditions. Most every function has one. If we enabled them in production, the application would be slow as molasses. It would be a different matter if there were assertions only at the boundaries of the system.

seancorfield16:05:37

Ugh! That’s a poor use of asserts IMO. Doesn’t surprise me though, really. Sorry.

flowthing16:05:00

100% agreed.

pinkfrog08:05:11

How to let deps list all the direct and indirect jar dependencies of a project ?

borkdude09:05:22

@i

$ bb -e '(run! println (babashka.classpath/split-classpath (with-out-str (babashka.deps/clojure ["-Spath"]))))'
src
/Users/borkdude/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar
/Users/borkdude/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
/Users/borkdude/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar

thheller09:05:11

clj -Stree?

pinkfrog09:05:59

Thanks for the -Stree. Didn’t find that in man clojure on mac. But that option exists in clj -h.

borkdude11:05:05

Since you mentioned list I thought you were looking for a flat list instead of -Stree :)

souenzzo14:05:06

clj -Stree | tr ':' '\n'

👍 3