tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
borkdude 2021-03-03T13:43:32.106900Z

Just fyi, I think moving to shell git instead of jsch will probably alleviate this issue as well: https://github.com/oracle/graal/issues/3251

borkdude 2021-03-03T13:43:58.107600Z

Unless the maven stuff also depends on jsch. If not, then an all native dependency resolution/download might be near.

borkdude 2021-03-03T13:52:35.108200Z

If you are curious about this, I talk about tools-deps-native here: https://youtu.be/P09GZVqiDdM?t=2240 (start from m37s20)

alexmiller 2021-03-03T14:06:34.108500Z

maven does not depend on jsch

alexmiller 2021-03-03T14:07:00.109100Z

moving to git shell will actually drop about 1/4 of the transitive lib weight for clj

🙌 4
borkdude 2021-03-03T15:55:06.110Z

fyi, updated to git shell branch of gitlibs project: https://github.com/borkdude/tools-deps-native-experiment/tree/shell#shell-branch

dnolen 2021-03-03T17:14:40.110300Z

anybody figured out workarounds for git deps and Apple M1?

borkdude 2021-03-03T17:38:31.110500Z

What's the problem on m1?

borkdude 2021-03-03T17:39:21.111Z

Maybe the git shell branch is a workaround :) But maybe running under Rosetta is also one?

2021-03-03T17:53:26.111800Z

Upgrading from 1.10.2.774 to 1.10.2.790 broke this for us:

GRAALVM_HOME=/path/graalvm-ce-19.2.0.1/Contents/Home clojure -A:native-image
our deps.edn
:aliases {:native-image
           {:main-opts ["-m clj.native-image monorepo.core"
                        "--initialize-at-build-time"
                        "--no-fallback"
                        "--report-unsupported-elements-at-runtime"
                        "-H:+PrintClassInitialization"]
            :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
            :extra-deps
            {clj.native-image/clj.native-image
             {:git/url    "<https://github.com/taylorwood/clj.native-image.git>"
              :sha        "f3e40672d5c543b80a2019c1f07b2d3fe785962c"
              :exclusions [org.slf4j/slf4j-nop]}}}}
error:
{:clojure.main/message
 "Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).\n-m clj.native-image monorepo.core (No such file or directory)\n",
 :clojure.main/triage
 {:clojure.error/class java.io.FileNotFoundException,
  :clojure.error/line -2,
  :clojure.error/cause
  "-m clj.native-image monorepo.core (No such file or directory)",
  :clojure.error/symbol java.io.FileInputStream/open0,
  :clojure.error/source "FileInputStream.java",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.io.FileNotFoundException,
    :message
    "-m clj.native-image monorepo.core (No such file or directory)",
    :at [java.io.FileInputStream open0 "FileInputStream.java" -2]}],
  :trace
  [[java.io.FileInputStream open0 "FileInputStream.java" -2]
   [java.io.FileInputStream open "FileInputStream.java" 219]
   [java.io.FileInputStream &lt;init&gt; "FileInputStream.java" 157]
   [java.io.FileInputStream &lt;init&gt; "FileInputStream.java" 112]
   [clojure.lang.Compiler loadFile "Compiler.java" 7571]
   [clojure.main$load_script invokeStatic "main.clj" 475]
   [clojure.main$script_opt invokeStatic "main.clj" 535]
   [clojure.main$script_opt invoke "main.clj" 530]
   [clojure.main$main invokeStatic "main.clj" 664]
   [clojure.main$main doInvoke "main.clj" 616]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.lang.Var applyTo "Var.java" 705]
   [clojure.main main "main.java" 40]],
  :cause
  "-m clj.native-image monorepo.core (No such file or directory)"}}

seancorfield 2021-03-03T17:56:45.113600Z

@splayemu "-m clj.native-image monorepo.core" should be three separate strings: "-m" "clj.native-image" "monorepo.core"

seancorfield 2021-03-03T17:57:12.114100Z

I'm a bit surprised it used to work in earlier versions, to be honest.

2021-03-03T18:00:29.114500Z

Wow thanks! I swear I had tried that but it appears to be working.

alexmiller 2021-03-03T18:33:39.114700Z

I'm not surprised :)

😄 1
seancorfield 2021-03-03T18:41:31.116100Z

I had never tried :main-opts strings with multiple command-line arguments in because it just never occurred to me that it would work -- all the examples show a separate string for each argument, I believe -- but I'm not surprised it no longer works 🙂

borkdude 2021-03-03T18:50:44.116600Z

I made a parser for command line strings, in case anyone needs it ;) https://github.com/babashka/pod-babashka-aws/blob/e119d08f738ed4fc6bb533a99288ccbd7794c18f/src/pod/babashka/aws/impl/aws/credentials.clj#L70

borkdude 2021-03-03T18:51:40.117300Z

e.g. it splits echo 'foo bar' in "echo" and "foobar"

alexmiller 2021-03-03T22:15:07.124400Z

I have done a prerelease of the Clojure CLI (1.10.2.801) that switches git/ssh to shell out rather than using jgit/jsch. this potentially fixes many existing git/ssh issues in that it is just shelling out to git, so if it works there, it should work through clj. I would love to see any and all tire-kicking on this: • public https repos • https repos with user/pw auth (not previously supported, subject to whatever credentials you have set up through git) • private ssh git repos • newer key exchange methods like ecdsa-sha2-nistp256 • .ssh/config options that didn't work before • ed25519 identity keys • concurrency issues in parallel downloads (I think this is improved but I never had a working repro for it) • doesn't work on M1 macs • Windows • CI systems like Travis/Circle/etc when you're testing, don't forget that a) git dirs and working trees are cached in ~/.gitlibs - consider selectively clearing/moving that while testing), and b) classpaths are cached in .cpcache dirs - use clj -Sforce to force that to override

🎉 12
alexmiller 2021-03-03T22:21:55.126300Z

there are still a couple more things I need to do here. currently, tools.gitlibs defaults to non-interactive behavior so it will not prompt you if, for example, http://github.com hosts are not in known_hosts, it will just fail. there is a flag in the API to support that, but I have not pulled that through the whole stack yet - it can be selectively interactive (and should be if you're just sitting at the terminal I think)

borkdude 2021-03-03T22:55:33.127500Z

Exciting! Bumped at https://github.com/borkdude/tools-deps-native-experiment. Native compilation only takes 1m40s on CI which is really good: an indication that this project is now much more light weight.

alexmiller 2021-03-03T23:00:09.128500Z

yeah, the brew tarball went from like 19M to 15M

👍 1