bensu / doo

doo is a library and lein plugin to run cljs.test on different js environments.
Eclipse Public License 1.0
324 stars 63 forks source link

lein doo only adds and downloads dependencies at test time #33

Closed danielcompton closed 8 years ago

danielcompton commented 8 years ago

CI environments like CircleCI cache m2 dependencies to speed up build time and decrease load on third party Maven repos (like Clojars). They will typically do the following:

  1. Fetch all dependencies
  2. Cache the dependencies
  3. Run the tests

When using doo, it adds more dependencies to the project at test time, after the dependencies have been cached. There are a few possible options here to avoid this:

  1. Create some kind of command like lein doo deps which would run the project with the doo deps added, triggering leiningen to download the missing dependencies
  2. Add [doo "0.1.5-SNAPSHOT"] to the project dependencies to make sure the deps are included. I'm not familiar enough with doo to know if that is going to cause other problems
  3. Make lein deps download the doo dynamic dependencies as well. I really don't know if this is possible or not.

2 seems like the good short term option. It would also be good to document this limitation so others know how to work around it.

bensu commented 8 years ago

I'm not sure I understand correctly. If I am, this is not up to doo, it completely depends on your project.clj. Can you provide an example project.clj that has this problem?

If you clean .m2/doo/ and then run lein clean (or any lein command) in the /example from this repo, it will fetch the dependencies and by the time you run lein doo slimer test there is nothing left to fetch. I feel like I'm misunderstanding something from your issue :)

crisptrutski commented 8 years ago

@bensu This sounds like it's related dynamically add dependencies to the "subproject". This approach is so boot-like that linking to this disccusion seems appropriate: https://github.com/boot-clj/boot/issues/282

I'm a bit confused, as doo is an explicit dependency of lein-doo, so I would expect it already to be downloaded and cached in that initial step that @danielcompton describes

Adding doo to your application's dependencies should be fine @danielcompton, there's nothing sinister in, and it's a tiny JAR. Worst of it would be checking lein deps :tree for Maven Madness

bensu commented 8 years ago

@crisptrutski if there is an issue it probably comes from that line but I don't know how to reproduce the issue since I've never seen it.

crisptrutski commented 8 years ago

Not seeing this problem at all myself either.. Testing with the example app in this repo:

> lein deps
Retrieving doo/doo/0.1.5-SNAPSHOT/doo-0.1.5-20150816.222342-1.pom from clojars
Retrieving doo/doo/0.1.5-SNAPSHOT/doo-0.1.5-20150816.222342-1.jar from clojars

> lein doo phantom none-test
Building ...
... done. Elapsed 0.808755 seconds
;; ======================================================================
;; Testing with Phantom:
...
danielcompton commented 8 years ago

I'm a little confused by this, as I'm only seeing this behaviour in my repo, not in the doo example project. I'll investigate further and report back.

bensu commented 8 years ago

Hey @danielcompton please reopen the issue if you cand find any further problems.