سؤال

Is there a typical workflow for hacking on Clojure libraries?

Say I have my application "Foo" which relies on a third-party library "Bar", which was obtained from a repository, and included in project Foo via lein deps.

Then, say I want to hack on library "Bar", so I clone it from github.

Now, I would like to hack on my local clone "Bar" while at the same time working on application "Foo" that depends on it. I would like all of the source files for "Bar" to open in Emacs along with all the source files in "Foo", using one instance of swank.

Is there an easy way to do this?

I want to alter my environment and not the project. Therefore I do not want to edit project.clj for "Foo" in order to accomplish this.

Does this require setting the classpath before starting up lein swank, or is there a better way?

هل كانت مفيدة؟

المحلول

Create a checkouts directory in your Foo project and create a symlink to your clone of the Bar project inside this directory.

To quote the Leiningen FAQ:

Q: I want to hack two projects in parallel, but it's annoying to switch between them.
A: If you create a directory called checkouts in your project root and symlink some other project roots into it, Leiningen will allow you to hack on them in parallel. That means changes in the dependency will be visible in the main project without having to go through the whole install/switch-projects/deps/restart-repl cycle, and the copy in checkouts will take precedence over the dependency declared in project.clj. Note that this is not a replacement for listing the project in :dependencies; it simply supplements that for convenience.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top