pallet / alembic

A library for distilling (resolving and adding to the classpath) dependencies
255 stars 13 forks source link

add proxy support #8

Closed behrica closed 10 years ago

behrica commented 10 years ago

I am behind a corporate proxy, so the "distill" method does not manage to download dependencies.

I looked at the code, the aether/resolve-dependencies you use allows to specify a proxy. So it just need to be passds through.

If I find some time I will fix it and send you a pull request

hugoduncan commented 10 years ago

Maybe we should default the proxy information, in the same way leiningen does

behrica commented 10 years ago

I thought about it already. I'll try

behrica commented 10 years ago

As I had the proxy values passing already working, I left it in. But if no proxy parameter is specified, then it reads it via the method from leiningen.core.classpath path as you suggested.

So the function where the proxy config is the really used looks like this:

(defn resolve-dependencies
  [still dependencies repositories proxy]
  (classlojure/eval-in
   (:alembic-classloader @still)
   `(do
      (require '[leiningen.core.classpath :as ~'cp])
      (mapv
       (fn [dep#]
         (letfn [(apath# [^java.io.File f#] (.getAbsolutePath f#))]
           {:coords dep#
            :jar (-> dep# meta :file apath#)}))
       (keys
        (aether/resolve-dependencies
         :coordinates '~(vec dependencies)
         :repositories ~repositories
         :proxy '~(or proxy (cp/get-proxy-settings)  )))))))

What do you think ?

behrica commented 10 years ago

I made as well a version which always uses the environment variables without a way to override the proxy configuration via function parameters. It's less code changes, so simpler.

Let me know, which version you prefer and I send a new pull request.

hugoduncan commented 10 years ago

I think I would favour having the default picked up from the environment, and still being able to explicitly overide.

behrica commented 10 years ago

OK. The pull request is updated.

hugoduncan commented 10 years ago

Fixed in 8ced4ed