clj-on-windows 2020-02-16

Anyone know the best way to get a heroku deploy using this: https://www.gertgoet.com/2019/02/06/deploying-a-tools-deps-clojure-project-to-heroku.html working on windows? I think I just need to make the bin/build script executable. Is there a way to do that without WSL?

you mean setting a file to executable in general in Windows?

I believe it says it is executable in windows already

so setting posix permission

Basically when I push to heroku I want it to use the bin/build script but it seems to be being ignored

Ah, that sounds promising

@jjttjj Can you try this?

$ clj -Sdeps '{:deps {nate/fs {:git/url "", :sha "e016dc87d8304cf14f5777e9d04992c86d13fd86"}}}'
Clojure 1.10.1
user=> (require '[nate.fs])
nil
user=> (nate.fs/set-posix-file-permissions "foo" "rwxr-xr-x")
#object[sun.nio.fs.UnixPath 0x48eb9836 "foo"]
where "foo" is the path of your file

clj -Sdeps '{:deps {nate/fs {:git/url "", :sha "e016dc87d8304cf14f5777e9d04992c86d13fd86"}}}'                                                                                           Error building classpath. count not supported on this type: Symbol
java.lang.UnsupportedOperationException: count not supported on this type: Symbol
        at clojure.lang.RT.countFrom(RT.java:671)
        at clojure.lang.RT.count(RT.java:643)
        at clojure.tools.deps.alpha.extensions.git$eval982$fn__984.invoke(git.clj:21)
        at clojure.lang.MultiFn.invoke(MultiFn.java:239)
        at clojure.tools.deps.alpha$canonicalize_deps$fn__1136.invoke(alpha.clj:69)
        at clojure.core.protocols$iter_reduce.invokeStatic(protocols.clj:49)
        at clojure.core.protocols$fn__8140.invokeStatic(protocols.clj:75)
        at clojure.core.protocols$fn__8140.invoke(protocols.clj:75)
        at clojure.core.protocols$fn__8088$G__8083__8101.invoke(protocols.clj:13)
        at clojure.core$reduce.invokeStatic(core.clj:6828)
        at clojure.core$reduce.invoke(core.clj:6810)
        at clojure.tools.deps.alpha$canonicalize_deps.invokeStatic(alpha.clj:68)
        at clojure.tools.deps.alpha$canonicalize_deps.invoke(alpha.clj:66)
        at clojure.tools.deps.alpha$resolve_deps.invokeStatic(alpha.clj:236)
        at clojure.tools.deps.alpha$resolve_deps.invoke(alpha.clj:217)
        at clojure.tools.deps.alpha.script.make_classpath2$create_classpath.invokeStatic(make_classpath2.clj:55)
        at clojure.tools.deps.alpha.script.make_classpath2$create_classpath.invoke(make_classpath2.clj:47)
        at clojure.tools.deps.alpha.script.make_classpath2$run_core.invokeStatic(make_classpath2.clj:81)
        at clojure.tools.deps.alpha.script.make_classpath2$run_core.invoke(make_classpath2.clj:72)
        at clojure.tools.deps.alpha.script.make_classpath2$run.invokeStatic(make_classpath2.clj:101)
        at clojure.tools.deps.alpha.script.make_classpath2$run.invoke(make_classpath2.clj:95)
        at clojure.tools.deps.alpha.script.make_classpath2$_main.invokeStatic(make_classpath2.clj:146)
        at clojure.tools.deps.alpha.script.make_classpath2$_main.doInvoke(make_classpath2.clj:118)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:705)
        at clojure.core$apply.invokeStatic(core.clj:665)
        at clojure.main$main_opt.invokeStatic(main.clj:514)
        at clojure.main$main_opt.invoke(main.clj:510)
        at clojure.main$main.invokeStatic(main.clj:664)
        at clojure.main$main.doInvoke(main.clj:616)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:705)
        at clojure.main.main(main.java:40)

@jjttjj please try the -Sdeps argument in a deps.edn file. The quoting on Windows is a bit surprising.

Ahh, getting

(fs/set-posix-file-permissions "bin/build" "rwxr-xr-x")
Execution error (UnsupportedOperationException) at sun.nio.fs.AbstractFileSystemProvider/setAttribute (AbstractFileSystemProvider.java:80).
View 'posix' not available

I can run bash on windows and use chmod

but that doesn't seem to be working either, maybe I just need to run git push from linux?

I'm not sure what the path should be on Windows, but can you try instead of "bin/build" "bin\\build"?

@deleted-user ^ I guess that function doesn't work on Windows? might be good to document in the lib

sorry, I give up from here on 🙂

in the heroku build pack

Nate: ok, thanks for confirming

hey, no problem 😃

maybe this works in git bash or something in Windows

fwiw, changing

   if [ -x $BUILD_DIR/bin/build ]; then
Line in the heroku buildpack to just use -f instead of -x, and then chmod +x the file there works for me