roomkey / lein-v

Drive leiningen project version from git instead of the other way around
48 stars 11 forks source link

Windows support? #12

Closed nartamonov closed 6 years ago

nartamonov commented 6 years ago

It seems plugin does not work on Windows, because of dependency on bash:

java.io.IOException: Cannot run program "/bin/bash": CreateProcess error=2, ═х єфрхЄё  эрщЄш єърчрээ√щ Їрщы
 at java.lang.ProcessBuilder.start (:-1)
    java.lang.Runtime.exec (:-1)
    clojure.java.shell$sh.invokeStatic (shell.clj:113)
    clojure.java.shell$sh.doInvoke (shell.clj:79)
    clojure.lang.RestFn.applyTo (RestFn.java:137)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$apply.invoke (core.clj:641)
    leiningen.v.git$eval655$git_command__656.invoke (git.clj:15)
    leiningen.v.git$git_describe.invokeStatic (git.clj:28)
    leiningen.v.git$git_describe.invoke (git.clj:27)
    leiningen.v.git$version.invokeStatic (git.clj:44)
    leiningen.v.git$version.doInvoke (git.clj:37)
...

Why can't we run git directly, like it does similar project sbt-git for Scala language?

cch1 commented 6 years ago

TL;DR: my skills at running external executables from the JVM is not strong.

IIRC, running git outside bash means that the environment variables that tune its behavior are not present. I would happily accept a pull request that works for both Windows and *nix shells.

BTW, my long term goal is to query the git repo directly using the JGit library. Unfortunately, the last time I started making the change the JGit library was missing some critical functionality. That problem may now be resolved...

timgilbert commented 6 years ago

About the environment variables, (shell/sh) is implemented via Runtime.exec(), whose default behavior is to have the subprocess inherit all of the parent's environment variables, so the bash process isn't necessary for that purpose.

timgilbert commented 6 years ago

I think this should work now that #23 has been merged.