tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
borkdude 2020-06-28T10:32:46.050500Z

What does this mean?

Exception in thread "main" clojure.lang.ExceptionInfo: Manifest type not detected when finding deps for babashka.curl/babashka.curl in coordinate {:git/url "<https://github.com/borkdude/babashka.curl>", :sha "2dc7f53271de3c2edc3e1474a000b9dfa7324eaf"} {:lib babashka.curl/babashka.curl, :coord {:git/url "<https://github.com/borkdude/babashka.curl>", :sha "2dc7f53271de3c2edc3e1474a000b9dfa7324eaf"}}, compiling:(/tmp/prog.clj:3:1)

borkdude 2020-06-28T10:32:57.050700Z

as a result of:

(require '[clojure.tools.deps.alpha :as deps])

(-&gt; {:deps '{babashka.curl
             {:git/url "<https://github.com/borkdude/babashka.curl>"
              :sha "2dc7f53271de3c2edc3e1474a000b9dfa7324eaf"}}
     :mvn/repos {"central" {:url "<https://repo1.maven.org/maven2/>"}
                 "clojars" {:url "<https://repo.clojars.org/>"}}}
    (deps/resolve-deps nil)
    (deps/make-classpath nil nil))

borkdude 2020-06-28T10:40:44.051100Z

I get the same result when using this coordinate with -Sdeps from the command line

borkdude 2020-06-28T11:02:44.052500Z

That appears to be it. Weird.

borkdude 2020-06-28T11:03:06.052700Z

Thanks!

lread 2020-06-28T11:05:06.053700Z

You are most welcome, by chance I hit that one yesterday.

borkdude 2020-06-28T11:07:07.053900Z

https://clojure.atlassian.net/browse/TDEPS-156

borkdude 2020-06-28T11:26:38.054400Z

@lee Hmm, now it's coming back:

$ clj -Sdeps "{:deps {babashka.curl
              {:git/url \"<https://github.com/borkdude/babashka.curl>\"
               :sha \"cbf8429addac1d2f71ac8ddfb847657223fdf0f7\"}}}" -Spath
Error building classpath. Manifest type not detected when finding deps for babashka.curl/babashka.curl in coordinate {:git/url "<https://github.com/borkdude/babashka.curl>", :sha "cbf8429addac1d2f71ac8ddfb847657223fdf0f7"}

borkdude 2020-06-28T11:28:23.054800Z

it did work for:

$ clj -Sdeps "{:deps {babashka.curl
              {:git/url \"<https://github.com/borkdude/babashka.curl>\"
               :sha \"1dc0f61d7baabee1f009543d60bfb79ee4a7101c\"}}}" -Spath

borkdude 2020-06-28T11:29:30.055700Z

while the commit cbf8 didn't do anything relevant compared to 1dc0with the deps.edn file....

borkdude 2020-06-28T11:31:15.055900Z

Adding :deps/manifest :deps seems to fix it.

borkdude 2020-06-28T11:33:18.056100Z

Added this to the issue

borkdude 2020-06-28T11:53:18.056400Z

I'm also getting this for a local/root dep:

$ clj -Sdeps "{:deps {org.clojure/tda {:local/root \"/Users/borkdude/Dropbox/dev/temp/tools.deps.alpha\" }}}" -Spath
Error building classpath. Manifest type not detected when finding deps for org.clojure/tda in coordinate #:local{:root "/Users/borkdude/Dropbox/dev/temp/tools.deps.alpha"}

alexmiller 2020-06-28T12:03:41.056900Z

Are they reproducible with -Sforce

borkdude 2020-06-28T12:04:47.057100Z

same result

borkdude 2020-06-28T12:05:20.057300Z

/tmp $ clj -Sdeps "{:deps {babashka.curl
              {:git/url \"<https://github.com/borkdude/babashka.curl>\"
               :sha \"cbf8429addac1d2f71ac8ddfb847657223fdf0f7\"}}}" -Spath -Sforce -Srepro
Error building classpath. Manifest type not detected when finding deps for babashka.curl/babashka.curl in coordinate {:git/url "<https://github.com/borkdude/babashka.curl>", :sha "cbf8429addac1d2f71ac8ddfb847657223fdf0f7"}

alexmiller 2020-06-28T12:38:05.057900Z

@borkdude I can't repro any of your failing cases

borkdude 2020-06-28T12:39:34.058300Z

Hah. Worked after a rm -rf ~/.gitlibs

borkdude 2020-06-28T12:39:44.058600Z

Not for

clj -Sdeps "{:deps {org.clojure/tda {:local/root \"/Users/borkdude/Dropbox/dev/temp/tools.deps.alpha\" }}}" -Spath
though

borkdude 2020-06-28T12:41:04.059100Z

That's probably another problem. It does work with a vanilla checkout of tools.deps:

clj -Sdeps "{:deps {org.clojure/tda {:local/root \"tools.deps.alpha\" }}}" -Spath

borkdude 2020-06-28T12:41:36.059300Z

I'll close the issue.

alexmiller 2020-06-28T12:42:46.059400Z

this should not affect anything

alexmiller 2020-06-28T12:43:02.059600Z

do you have a repro of that?

alexmiller 2020-06-28T12:44:12.060500Z

tools.deps.alpha has a couple build steps (java compilation, resource replacement) so it's not a good example lib for use as local/git dep

alexmiller 2020-06-28T12:50:44.061400Z

btw, in the near future, using unqualified lib symbols is going to be deprecated and will complain, so "babashka.curl" should be changed to "babashka.curl/babashka.curl" etc

alexmiller 2020-06-28T12:51:48.061900Z

(and this is a step towards actually removing support for that)

borkdude 2020-06-28T13:24:09.063100Z

@alexmiller I know. I had already compiled the java and added target/classes to the paths

borkdude 2020-06-28T13:24:20.063400Z

But still didn’t work probably due to the resource replacement

borkdude 2020-06-28T13:26:18.065100Z

I’m trying to get the native tools deps working using Ghadi’s git shell branch of the git libs library, but this stuff got me distracted for now

borkdude 2020-06-28T13:30:06.066400Z

Should probably push the compiled assets to Clojars and work with that instead of tools deps deps

borkdude 2020-06-28T13:36:33.068Z

Btw, the url of a git dep is already a unique identifier. Why should a user have to make up some fully symbol keyword in the first place?

alexmiller 2020-06-28T13:41:17.068800Z

well you can just mvn clean install and use that local snapshot artifact too - sometimes that's eaesiest for maven built things

lread 2020-06-28T13:47:05.072700Z

oh, looks like I misdiagnosed! thanks for the info!

alexmiller 2020-06-28T13:47:57.073300Z

re unique id, for the exact same reasons namespaces are useful for global differentiation, group-ids are a good idea for qualified names. using same symbol group+artifact was always a limited idea. lein/clojars made it too easy and common. we're not going to perpetuate making it implicit.

alexmiller 2020-06-28T13:48:55.073500Z

it's just map merges and stuff in the code, so I would not expect it to violate any Clojure-ish expectations here

borkdude 2020-06-28T13:52:46.074500Z

But why have a name for a git dep at all?

alexmiller 2020-06-28T13:54:45.076Z

because names are the identity of the lib, which may exist at different coordinates and you want to avoid putting the "same" lib on the classpath from multiple locations

alexmiller 2020-06-28T13:55:55.077900Z

(admittedly still some work to do on cross-coordinate type version selection, but the hooks are there)

borkdude 2020-06-28T13:57:17.080100Z

Good point. The only use case for doing that would be when you would mount different dirs from the same git dep at different SHAs, which seems far fetched. Still if you would use the URL as the identifier you would be able to detect conflicts more easily since different people are going to use different qualified syms for the same lib?

2020-06-29T08:07:50.104100Z

Not that far fetched as we actually do this in one or two places. One of our apps supports different customer configurations via t.d.a aliases, and there is essentially a :customer/all alias that pulls together a combined classpath for all customers, for working at the REPL (which lets you switch between customers). One of the deps in that alias contains fixture data for all customers with a :deps/root for each customer, and it’s possible for the sha’s for customers to drift slightly from each other (even though they’re all in the same repo). So this t.d.a feature is very handy, as otherwise we’d need a fixture data repo per customer, which would make updating fixture harder across customers harder. Essentially it just means the artifact id in this becomes git url + deps-root. It makes a lot of sense when you use :deps/root. Normally they all reference the same SHA, but sometimes it’s pragmatic to apply changes to one customer first, before rolling out wider. This can also happen when you want a branch to built repeatably by C.I. (before you’ve applied the change across all customers).

2020-06-29T08:17:24.104300Z

We then coin a local dep-id of something like: swirrl/fixtures.customer-name

borkdude 2020-06-29T08:19:53.104800Z

Yeah, that does make sense.

2020-06-29T08:21:25.105Z

It’s essentially just a lighter weight way to manage separate dependencies that you often make cross-cutting changes over.

2020-06-29T08:24:11.105200Z

Though I do suspect t.d.a might have some bugs resolving these sometimes — I’ve seen a few cases where when fetching these deps it seems to either blow up or mix up the commits, e.g. it would resolve customer-b to customer-a’s sha. I suspect it might be related to the parallel resolution stuff. cc @alexmiller

2020-06-29T08:24:28.105400Z

It’s quite hard to reproduce though

alexmiller 2020-06-29T13:09:11.116600Z

yes, I am almost certain that it's parallel resolution of git deps

👍 1
alexmiller 2020-06-28T13:58:39.080600Z

we do not currently do that level of detection but it is something I would like to do

alexmiller 2020-06-28T13:59:06.081100Z

ultimately the library has to determine the identifier by which it should be known

alexmiller 2020-06-28T14:01:19.083500Z

the organization should be something you own or register, like domain name, trademark. third party sites like github can also confer identity - we recommend in https://clojure.org/guides/deps_and_cli to combine them by creating a group-id like github-borkdude

borkdude 2020-06-28T14:01:19.083600Z

Which the URL is already an instance of

alexmiller 2020-06-28T14:04:15.085700Z

url is really a combination of site (github), org, and repo. github-org/repo combines those

alexmiller 2020-06-28T14:04:21.085900Z

but it does not account for forks

borkdude 2020-06-28T14:04:51.086700Z

Interesting :thinking_face:

alexmiller 2020-06-28T14:05:02.086900Z

to use a fork, you need to use the same lib, but different url, and then they diverge

alexmiller 2020-06-28T14:05:50.088100Z

your goal with using a fork really is to replace (identity) the lib

alexmiller 2020-06-28T14:06:12.089200Z

but then you have interesting questions of ownership over the lib identity

borkdude 2020-06-28T14:06:13.089300Z

If I want to maintain a fork as a real fork, and not just for PRs, I would not use the original identifier anyway?

alexmiller 2020-06-28T14:06:33.089900Z

well that's the question

borkdude 2020-06-28T14:06:45.090500Z

So then the URL still is the most identifying thing for it

alexmiller 2020-06-28T14:07:09.091Z

if you didn't use the original, then dep resolution will give you both libs if you have a transitive dep using the original

alexmiller 2020-06-28T14:07:38.091700Z

and in that case, it would be good to have deps tell you that you've done this

borkdude 2020-06-28T14:07:43.091900Z

It’s the same in maven world right now

alexmiller 2020-06-28T14:07:47.092100Z

true

alexmiller 2020-06-28T14:08:13.092500Z

although probably much harder to automatically detect

alexmiller 2020-06-28T14:09:11.093500Z

(note that git urls are also not unique - there are multiple url formats to refer to the same repo, but I think that's a solvable problem)

borkdude 2020-06-28T16:27:14.095700Z

I have got something compiling now with tda + tools.gitlibs@shell-git branch One issue I stumbled upon:

Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.apache.maven.project.ReactorModelPool. To diagnose the issue you can use the --allow-incomplete-classpath option. The missing type is then reported at run time when it is accessed the first time.
Detailed message:
Trace:
	at parsing clojure.tools.deps.alpha.extensions.pom$model_resolver.invokeStatic(pom.clj:51)
Call path from entry point to clojure.tools.deps.alpha.extensions.pom$model_resolver.invokeStatic(Object):
	at clojure.tools.deps.alpha.extensions.pom$model_resolver.invokeStatic(pom.clj:41)
	at clojure.tools.deps.alpha.extensions.pom$model_resolver.invoke(pom.clj:41)
	at clojure.core.proxy$clojure.lang.APersistentMap$ff19274a.hashCode(Unknown Source)
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
	at java.util.Properties.getProperty(Properties.java:1125)
	at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:144)
	at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:345)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VA_LIST:Ljava_lang_System_2_0002egetProperty_00028Ljava_lang_String_2_00029Ljava_lang_String_2(generated:0)
I now use --allow-incomplete-classpath just to see how far it gets. I now get a NPE in util/maven.clj on the line local-repo-mgr (.newLocalRepositoryManager system session local-repo) where system appears to be null. Might be related to the --allow-incomplete-classpath but I'll keep digging.

alexmiller 2020-06-28T16:29:39.096100Z

It is almost certainly related

alexmiller 2020-06-28T16:30:36.097400Z

There is a similar thing like this logged where an error occurs while setting up the service locator

borkdude 2020-06-28T16:38:58.098Z

So ditching jgit for shell git works. When are you going to ditch org.apache.maven libs? 😉

borkdude 2020-06-28T16:47:19.098200Z

I wonder what's the issue with this class

borkdude 2020-06-28T17:19:09.098700Z

Posted current findings + code here: https://github.com/borkdude/tools-deps-native-experiment

ghadi 2020-06-28T18:49:01.099900Z

before using a solution like shelling out to git, I think it’s wise to re-examine the problem

ghadi 2020-06-28T18:49:28.100300Z

I know I sound like a broken record

borkdude 2020-06-28T18:56:04.101200Z

Alex pointed me at that shell-git branch when I told him jgit didn't work with GraalVM. Just examining + listing all the problems. Shelling out to git allows me to explore the next problem without being stuck on it. There might not be only one "the problem", there might be many.

ghadi 2020-06-28T19:07:11.102100Z

what part of jgit didn't work?

borkdude 2020-06-28T19:08:09.102300Z

I think the output I got was similar to this one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=546175

borkdude 2020-06-28T19:09:14.102700Z

I think that problem should be solvable using the approach quarkus takes: https://quarkus.io/guides/jgit

borkdude 2020-06-28T19:09:27.103200Z

so if there's need, it can be made to work, I'm pretty sure

borkdude 2020-06-28T19:11:59.103600Z

I added this as a note to the README here now https://github.com/borkdude/tools-deps-native-experiment/blob/master/README.md