Fork me on GitHub
#tools-deps
<
2018-04-17
>
cfleming02:04:46

Am I correct in thinking that deps.edn provides no way to build an artifact?

cfleming02:04:29

Or even to specify co-ordinates for one?

richiardiandrea02:04:46

I think you understand correctly. Or put in a better way I understand the same.

dpsutton02:04:00

Have you seen ghadi's depstar?

cfleming02:04:27

I have, but that just creates a jar

cfleming03:04:42

Also, is Clojure itself an implicit dependency? The examples don’t add it like lein does.

dpsutton03:04:47

That does an Uber jar so I think it gets the deps of the clj runner I think

dpsutton03:04:07

It removes itself though

dpsutton03:04:18

Depstar itself I mean

cfleming03:04:18

Oh, I meant in general - if I run a REPL, the Clojure dep comes from the runner?

dpsutton03:04:20

As far as I can tell yes. I've never seen deps.edn specify a clojure version

cfleming03:04:02

Interesting. A lot of this is going to be really weird for Cursive support 😐

dpsutton03:04:18

It's been rough in CIDER so far as well. It feels a bit like boot. It's not super obvious how to best approach it

cfleming03:04:42

Yeah, the loose approach to project identity is tricky.

dpsutton03:04:45

I think @dominicm has done some work towards that end but it's still a little brittle

dpsutton03:04:20

Kinda like boot you need to know what aliases or tasks to invoke

cfleming03:04:41

Yeah, boot is tricky for Cursive too 🙂

seancorfield03:04:43

@cfleming clj -Sdescribe lists the deps.edn files that are read in.

seancorfield03:04:02

You can also get that from tools.deps.alpha as clojure-environment (I think).

seancorfield03:04:31

My bad: clojure.tools.deps.alpha.reader/clojure-env

cfleming03:04:38

The difficulty is there’s no consistent identifier for a module

seancorfield03:04:40

(it shells out to clj -Sdescribe tho')

dpsutton03:04:36

Do you inject your dependencies like cider or do you run another process? I know cursive is big on static analysis

dpsutton03:04:53

I think we're gonna have to merge edn files from emacs lisp

dominicm05:04:27

Nope. -Sdeps. I already have this working in viml, elisp will be a doddle

cfleming03:04:05

@dpsutton I don’t inject any dependencies.

cfleming03:04:18

Most of Cursive’s functionality is static in the editor.

seancorfield03:04:13

For clj-new I ended up having to ask clj what deps.edn files it would load, reading them, resolving them, making a classpath, and loading those files...

environment   (clojure-env)
        all-deps      (read-deps (:config-files environment))
...
  (-> (deps/resolve-deps all-deps resolve-args)
      (deps/make-classpath (:paths all-deps) {})
      (str/split (re-pattern java.io.File/pathSeparator))
      (->> (run! pom/add-classpath))))

cfleming03:04:41

Where are git deps cloned to?

cfleming03:04:00

Is there a local .deps directory or something?

cfleming03:04:05

Ah, ~/.gitlibs

cfleming03:04:59

Is it possible to use file:/// URLs with :git/url?

seancorfield03:04:08

You can use :local/root

cfleming03:04:12

I can’t get it to work.

cfleming03:04:44

Right, but then I can’t pin a version.

cfleming03:04:03

(although I’m mostly trying to avoid having to publish to github just to play around 🙂 )

seancorfield03:04:24

So :local/root deps just stay where they are on disk, with no version. :git/url is cached to ~/.gitlibs per :sha. :mvn/version is cached to ~/.m2 with a real version.

Alex Miller (Clojure team)03:04:21

@cfleming re prior question, the default Clojure version is specified in the install-level deps.edn (which is merged with ~/.clojure/deps.edn and local deps.edn). You can specify it in local deps.edn too if you like.

cfleming03:04:57

I’m thinking about the case when a Cursive user imports a deps project and maybe doesn’t even have the CLI installed.

cfleming03:04:27

Where is the install-level stuff put? I guess that’s OS/packager dependent?

Alex Miller (Clojure team)03:04:12

yeah, but clj -Sdescribe will tell you that

cfleming03:04:48

The problem is that IntelliJ, at least on OSX, doesn’t typically know what the users’s shell path is.

cfleming04:04:32

Will any of this work at all if the user doesn’t have the clj CLI stuff installed?

cfleming04:04:17

That’s a bummer.

Alex Miller (Clojure team)04:04:18

I mean, some of it can be used directly via the lib but the lib really works in tandem with the scripts

Alex Miller (Clojure team)04:04:27

the scripts are the bridge from the user’s environment and config files into the lib

cfleming04:04:29

I’ll have to see if I can detect the install, and consider what to do if it’s not there or I can’t find it.

Alex Miller (Clojure team)04:04:58

the scripts are the only layer that know about (for example) classpath caching

Alex Miller (Clojure team)04:04:12

but they use the lib to build the cache

cfleming04:04:43

So there’s no way to programmatically determine the classpath from Clojure/Java?

cfleming04:04:04

Without exec’ing, I mean?

cfleming04:04:28

I guess yes, but with no caching.

Alex Miller (Clojure team)04:04:36

there is no simple answer to that

Alex Miller (Clojure team)04:04:58

the lib can compute a classpath given a configuration

Alex Miller (Clojure team)04:04:10

but the configuration is inherently a product of the environment

cfleming04:04:50

The environment will be different when scripts are invoked by IntelliJ

Alex Miller (Clojure team)04:04:17

to some degree, yes. and I think the question is how much you let the user know that :)

Alex Miller (Clojure team)04:04:46

I think the user expectation will be that they get the same effect as running clj in the root of the project

Alex Miller (Clojure team)04:04:28

I’ve tried to provide a lot of tools to replicate some or all of what’s in the script layer from inside the lib (Sean is using many of those in the boot tooling)

cfleming04:04:02

right, but even running clj in the root of the project will be different when run from IntelliJ.

cfleming04:04:45

Well, the environment will be different, I have no idea if the differences will be significant.

Alex Miller (Clojure team)04:04:57

the only things that are critical are current working directory and path

Alex Miller (Clojure team)04:04:18

there are potentially some environment variables that can affect things but none of them are likely to be in use

cfleming04:04:20

path will be the thing that’s different.

Alex Miller (Clojure team)04:04:50

can you explicitly add an option to point to the bin dir for clojure?

cfleming04:04:51

In general OSX doesn’t give apps access to env vars, and doesn’t execute shell init scripts anyway.

cfleming04:04:04

I think I’ll have to.

Alex Miller (Clojure team)04:04:40

on os x, if you install via brew (recommended) clojure will be in /usr/local/bin

Alex Miller (Clojure team)04:04:24

well, on linux too if you follow the script

dominicm05:04:27

Most distro packages won't

Alex Miller (Clojure team)04:04:34

and the install level deps.edn will be at /usr/local/lib/clojure/deps.edn

Alex Miller (Clojure team)04:04:31

that last is linux, mac will vary per brew install

Alex Miller (Clojure team)04:04:06

mac will be at something like /usr/local/Cellar/clojure/1.9.0.375/deps.edn when installed via brew. maybe there’s a symlink that

Alex Miller (Clojure team)04:04:15

’s version independent, not sure

cfleming04:04:40

Ok, thanks.

Alex Miller (Clojure team)04:04:28

I have tried to do what I can to make things discoverable and computable. if there’s things I can do to help more, I’m open to suggestions

seancorfield04:04:43

With boot-tools-deps I actually pull the install-level deps.edn from the Clojure brew-install GitHub repo, into the JAR of the library. Looking back, that was probably a bad idea 🙂

seancorfield04:04:13

I probably ought to change it to use clojure-env instead!

mfikes11:04:35

@cfleming If it helps, I've been using Cursive for deps.edn projects by first doing clj -Spom and then using the resulting pom.xml

mfikes11:04:31

I also imagine Cursive might be able to use the output of clojure -Spath, as it gives you the classpath, including paths for any :local/roots or :git/url / :sha deps

richiardiandrea17:04:14

So...say I have a colleague who does not trust brew install and would like to use the linux script for installing clojure...is it possible to do that?

richiardiandrea17:04:49

(answer is no, we tried and install -D does not unfortunately work on mac)

dominicm17:04:06

The install really only does 5 steps, should be easy enough to do them manually.

richiardiandrea17:04:04

@dominicm yep he probably will do that

Alex Miller (Clojure team)17:04:31

you’ll notice the brew install just runs an install.sh in the tar

Alex Miller (Clojure team)17:04:43

so you can manually do basically the same thing

Alex Miller (Clojure team)17:04:01

with some effort and messiness, install.sh for mac and linux-install.sh could become the same script. I have so far not been able to convince myself that gives me any great value though and there are some useful reasons for them to be different.

richiardiandrea18:04:29

@alexmiller thanks for answering, was wondering about that as well, good to know

richiardiandrea18:04:05

so the difference about install on Macosx is only with -d Create directories. Missing parent directories are created as required. No -D (capital).

dominicm18:04:15

BSD vs GNU install 😔 if we want to work on BSD we should support both really.

dominicm18:04:44

I've seen some applications probe by using --help and grep

richiardiandrea19:04:55

I think for mac is even a bit different from BSD, I did not see -D at all

dominicm20:04:15

Hum, weird, annoying, standards, yay.

😞 4