Hi Phil,

On 26 Apr 2011, at 06:22, Phil Hagelberg wrote:

> On Apr 25, 12:12 pm, Sam Aaron <samaa...@gmail.com> wrote:
> 
> I'm curious, what are your requirements for native dependencies?
> 
> I have never needed them, so I've relied on contributors and external
> plugins because I don't know what's needed. But if it's a blocker for
> some it could get merged into Leiningen itself. I've looked at the
> plugin and it seems pretty simple. What's missing?

I was originally using lein and the native-deps plugin for my projects, but 
it's much more cumbersome than cake's approach.

On the periphery it doesn't seem too bad, in your project.clj you need to 
include native-deps in your :dev-dependencies, and then specify the actual 
native deps in :native-dependencies as follows:

(defproject org.clojars.samaaron/monome-serial "0.1.3"
  :description "An interface to the monome (http://monome.org)"
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]]
  :dev-dependencies [[native-deps "1.0.5"]]
  :native-dependencies [[org.clojars.samaaron/rxtx "2.2.0"]])

Pulling all the deps is a two step process:

* lein deps
* lein native-deps

However, things get more tricky when some of your standard deps have native 
deps themselves. I had to resort to some hackery to get round this issue: 
https://github.com/improcess/beatbox/blob/c6e082019e5dad8c7cf37917461339670a38d65f/merge-checkout-deps.rb

With cake things are far, far simpler. There's no need for an extra plugin 
step, or for you to manually download the native deps of other deps. It is able 
to determine if a dep contains native deps and does the right thing. So now, 
the same project's project.clj looks as follows:

(defproject monome-serial "0.2.0"
  :description "An interface to the monome (http://monome.org)"
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [org.clojure/clojure-contrib "1.2.0"]
                 [serial-port "1.0.7"]])


serial-port depends on the rxtx native libs:

(defproject serial-port "1.0.7"
  :description "Simple serial port comms library. Wraps RxTx."
  :dependencies [[org.clojure/clojure "1.2.0"]
                 [rxtx22 "1.0.5"]])

and cake deals with it all gracefully. All I need to do is:

cake deps

And cake pulls the correct native libs from all the dependencies and places 
them in lib/native. It's also smart and only pulls out the correct libs for my 
architecture. 

I hope that this makes sense. It would be awesome if lein followed cake's lead 
here and did the same thing.

Sam

---
http://sam.aaron.name

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to