clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
2020-02-16T21:31:30.046900Z

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?

borkdude 2020-02-16T21:44:08.047300Z

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

2020-02-16T21:46:54.047700Z

I believe it says it is executable in windows already

borkdude 2020-02-16T21:47:39.048600Z

so setting posix permission

2020-02-16T21:47:49.048800Z

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

2020-02-16T21:48:10.049Z

Ah, that sounds promising

borkdude 2020-02-16T21:56:28.049500Z

@jjttjj Can you try this?

$ clj -Sdeps '{:deps {nate/fs {:git/url "<https://github.com/nate/fs>", :sha "e016dc87d8304cf14f5777e9d04992c86d13fd86"}}}'
Clojure 1.10.1
user=&gt; (require '[nate.fs])
nil
user=&gt; (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

2020-02-16T21:57:47.049800Z

clj -Sdeps '{:deps {nate/fs {:git/url "<https://github.com/nate/fs>", :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)

borkdude 2020-02-16T21:58:27.050300Z

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

2020-02-16T21:58:37.050500Z

sure

2020-02-16T22:00:36.050700Z

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

2020-02-16T22:01:49.051800Z

I can run bash on windows and use chmod

2020-02-16T22:02:13.052600Z

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

borkdude 2020-02-16T22:02:36.052900Z

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

borkdude 2020-02-16T22:03:32.053500Z

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

borkdude 2020-02-16T22:04:00.053700Z

sorry, I give up from here on 🙂

2020-02-16T22:04:32.054800Z

no prob, I suppose another route might be change this line here: to https://github.com/heroku/heroku-buildpack-clojure/blob/e43bfbe37859e84ca482176029521e5d0481bd3a/bin/compile#L139

Cora (she/her) 2020-02-16T22:04:41.055100Z

yep, definitely doesn't work on windows

2020-02-16T22:04:43.055200Z

in the heroku build pack

borkdude 2020-02-16T22:05:34.055800Z

Nate: ok, thanks for confirming

Cora (she/her) 2020-02-16T22:08:46.056700Z

it's a little tricky to make it general enough while also providing conveniences for the various platforms. I'm interested in adding some windows-only conveniences but I don't have a windows system to develop on

Cora (she/her) 2020-02-16T22:09:10.057200Z

also: really any documentation would be preferable to the total lack of docs right now 😅

borkdude 2020-02-16T22:12:24.058100Z

hey, no problem 😃

Cora (she/her) 2020-02-16T22:12:37.058500Z

hmmm, there's nothing in the BasicFileAttributeView or DosFileAttributeView about setting things to be executable

Cora (she/her) 2020-02-16T22:12:43.058800Z

I'll have to research that later

borkdude 2020-02-16T22:12:43.058900Z

maybe this works in git bash or something in Windows

Cora (she/her) 2020-02-16T22:12:54.059200Z

oh, maybe

Cora (she/her) 2020-02-16T22:13:02.059400Z

WSL or whatever

2020-02-16T22:45:32.060400Z

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