Giter Site home page Giter Site logo

Comments (13)

RickMoynihan avatar RickMoynihan commented on July 20, 2024 1

@atroche @mfikes You shouldn't need to do lein install each time. Simply add a .lein-classpath file in to your project and point it to the src directory for `lein-tools-deps. See the example project for a concrete example of this working:

Also the leiningen writing a plugin docs.

I should also say my preferred workflow has been to just run lein repl within the lein-tools-deps project root, and just link directly to deps.edn files, that way you can just evaluate forms like:

(resolve-deps (canonicalise-dep-locs [:system :home "example/deps.edn" "foo"]))

Hope that helps.

from lein-tools-deps.

RickMoynihan avatar RickMoynihan commented on July 20, 2024

... is there a way we could use leiningen's knowledge of the location of the project.clj file?

Sadly not. We're doing this already in PR #21 for other reasons; but the reason we need to shell out is to capture the location of the :system level deps.edn (we also get :home this way though we could easily infer that ourselves if we needed to).

The :system level deps.edn can be installed in different locations depending on the version of tools.deps, your O/S and the package manager. e.g. on macOS my system deps.edn is in:

/usr/local/Cellar/clojure/1.9.0.375/deps.edn

Personally I think on mac with homebrew this should probably be symlinked from /usr/local/etc/deps.edn, in the same way that the latest clj / clojure scripts are by default symlinked into /usr/local/bin but I don't really know enough about brew as to whether this is the done thing or not.

Assuming tools.deps choose to do this, we'd still want to allow some overrides for these aliases for situations where people install these into non-standard locations.

from lein-tools-deps.

atroche avatar atroche commented on July 20, 2024

Oh, couldn't you shell out for :system and :home but get the location of the :project deps file through lein? I guess that'd be a bit of a hack and probably only useful for Cursive users.

If #21 lands then I'll be able to do [:system :home "deps.edn"] and that will achieve the same thing, so I'm happy :)

from lein-tools-deps.

atroche avatar atroche commented on July 20, 2024

Oh, whoops, after reading more carefully I can see that #21 also handles the :project case for Cursive. Awesome!

from lein-tools-deps.

mfikes avatar mfikes commented on July 20, 2024

With Homebrew on a mac, we end up with /usr/local/bin/clojure.

So a hack on macOS would be to see if this file exists and then run

/usr/local/bin/clojure -Sdescribe

and read the edn in :out

{:version "1.9.0.375"
 :config-files ["/usr/local/Cellar/clojure/1.9.0.375/deps.edn" "/Users/mfikes/.clojure/deps.edn" "deps.edn" ]
 :install-dir "/usr/local/Cellar/clojure/1.9.0.375"
 :config-dir "/Users/mfikes/.clojure"
 :cache-dir ".cpcache"
 :force false
 :repro false
 :resolve-aliases ""
 :classpath-aliases ""
 :jvm-aliases ""
 :main-aliases ""
 :all-aliases ""}

getting the :config-files value.

from lein-tools-deps.

atroche avatar atroche commented on July 20, 2024

How about using with-sh-env to add /usr/local/bin/ to the path when we make the call to clojure-env?

from lein-tools-deps.

mfikes avatar mfikes commented on July 20, 2024

I can try that @atroche . I suspect it won't work because the environment is passed to the launched process (it is not used in the current process to launch the launched process).

from lein-tools-deps.

atroche avatar atroche commented on July 20, 2024

I've been messing around with this, and I'm wondering if there's a better workflow than what I'm doing at the moment:

  1. make a change to the source of the plugin.
  2. run lein install
  3. Run “Refresh Leiningen Projects” in Cursive (on a project that uses lein-deps-tools)
  4. Occasionally restart Cursive when I start getting cryptic errors about ZLib or “code lengths”

And the thing that's probably slowing me down the most is not being able to read the printlns I do in the plugin, from within Cursive. The only error messages I can reliably get look like this:

5:50 PM	Error reading /Users/alistair/clj/blah/project.clj
				Cannot run program "clojure": error=2, No such file or directory
				error=2, No such file or directory

5:51 PM	Error reading /Users/alistair/clj/blah/project.clj

Are you faring better, @mfikes ?

from lein-tools-deps.

mfikes avatar mfikes commented on July 20, 2024

@atroche If there is some details I want to know, I've resorted to having the plugin throw a RuntimeException with the text containing what I'd like to see.

from lein-tools-deps.

atroche avatar atroche commented on July 20, 2024

Ah, thanks! And is there a better way of running updated plugin code than doing lein install? Checkouts don't seem to work for plugins.

from lein-tools-deps.

mfikes avatar mfikes commented on July 20, 2024

I don't know. I've been doing lein install as well.

from lein-tools-deps.

atroche avatar atroche commented on July 20, 2024

Awesome, the .lein-classpath solution works great.

from lein-tools-deps.

mfikes avatar mfikes commented on July 20, 2024

The patch in #31 would have lein-tools-deps fall back to trying /usr/local/bin/clojure if it exists and clojure fails.

from lein-tools-deps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.