tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
yuhan 2021-05-04T07:45:16.121400Z

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

2021-05-04T07:53:49.121600Z

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

šŸ‘ 1
flowthing 2021-05-04T08:36:03.123700Z

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?

borkdude 2021-05-04T08:37:41.124Z

How does leiningen implement this feature?

2021-05-04T08:39:11.124600Z

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

flowthing 2021-05-04T09:19:07.125Z

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

borkdude 2021-05-04T09:20:22.125400Z

@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

thheller 2021-05-04T09:22:11.125600Z

clj -Stree?

flowthing 2021-05-04T09:29:54.126200Z

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

borkdude 2021-05-04T09:30:58.126400Z

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

flowthing 2021-05-04T09:31:47.126600Z

Yeah, not sure.

flowthing 2021-05-04T09:31:48.126800Z

https://ask.clojure.org/index.php/1529/debug-builds

flowthing 2021-05-04T09:35:07.127100Z

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

flowthing 2021-05-04T09:35:38.127400Z

(Or fdef.)

borkdude 2021-05-04T09:36:07.127600Z

or wait for spec2 ;)

flowthing 2021-05-04T09:36:34.127800Z

I'm afraid I'll need to deliver before that. šŸ˜›

2021-05-04T09:47:59.128Z

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

borkdude 2021-05-04T11:11:05.128200Z

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

souenzzo 2021-05-04T14:10:06.128500Z

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

šŸ‘ 1
seancorfield 2021-05-04T16:14:07.128800Z

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.

seancorfield 2021-05-04T16:14:26.129Z

Iā€™ve never understood why folks want to disable assertions in productionā€¦

borkdude 2021-05-04T16:15:16.129200Z

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

flowthing 2021-05-04T16:19:44.129400Z

@seancorfield 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.

seancorfield 2021-05-04T16:24:37.129600Z

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

flowthing 2021-05-04T16:25:00.129800Z

100% agreed.