sattvik / leinjacker

A library for Leiningen plug-in authors.
42 stars 11 forks source link

Additional cross lein version functions; multiple lein version testing #1

Closed tobias closed 12 years ago

tobias commented 12 years ago

I finally found some time today to work on this. This patch includes the following changes:

Running the tests currently is slow, since the mechanism for running the tests in the sub-project does the following:

  1. calls lein install to install leinjacker
  2. invokes lein, lein1, and lein2 in an effort to find the proper executable name for each version (this is cached to a file upon success to avoid paying for this every time)
  3. calls lein deps in test-project/ for lein1 to get the leinjacker jar in the proper location
  4. calls lein{2} midje in test-project/ for each version

Steps 1 and 3 could be avoided if I could come up with a better way to get leinjacker onto the sub-project's classpath, but I haven't yet found a way to do that that also gets leinjacker's own dependencies loaded properly.

Any feedback is welcome!

sattvik commented 12 years ago

Thanks! I haven't finished looking through all of it, but it looks good. I'll let you know if I have any questions.

tobias commented 12 years ago

@sattvik - have you had a chance to look at this further?

sattvik commented 12 years ago

I apologise for taking so long to take a review this. From what i have seen of the code it looks good. I will take some time later today to see that all the tests run. If so, then I'll pull it in.

sattvik commented 12 years ago

An update to let you know what's going on. I started trying to run the tests, and I run into a few problems:

  1. For some reason, the lein1 finder is failing. It is executing the 'lein' command, but for some reason it's not finding the magic string.
  2. The test project probably needs to have lein-midje added as a dependency, without it, the tests fail. I guess that I don't have lein-midje installed as part of my user profile.
  3. I seem to be getting some sort of weird java.lang.NoSuchMethodError: clojure.lang.RT.keyword(Ljava/lang/String;Ljava/lang/String;)Lclojure/lang/Keyword; when running the lein1 tests.

It's gotten pretty late for me, so I'll have to look into this third issue deeper tomorrow.

tobias commented 12 years ago

Sorry you are having issues with the tests - I just checked again and they pass for me here. I went ahead and pushed a change that adds lein-midje as a dev dependency for the test project. What OS are you running the tests on? I've only tested on MacOS, and I wonder if that makes a difference for the first issue?

I have seen the third issue before on another project - I believe it was caused by having code on the classpath that was aot compiled with a different version of clojure than is currently being used. But that shouldn't be the case here, since there is no aot compilation.

I'm happy to take a further look at this next week, and can try to recreate your issues then if you don't have a chance to chase them down over the weekend.

sattvik commented 12 years ago

Well, I figured out what the problem was. The 'LEIN_JAVA_CMD' environment variable from Lein 2 was messing up the Lein1 runtime. Removing it from the environment fixed both issues 1 and 3 above.

Thanks for all your help. Again, I apologise for not getting to this sooner.