Fork me on GitHub
#portal
<
2022-03-31
>
Carlo12:03:55

I'm hitting an interesting behavior when I load portal in a clj project from a git hash. If I include in my deps.edn:

djblue/portal {:mvn/version "0.22.1"}
all works as intended, while if I do something like:
com.github.djblue/portal {:sha "2d817e99b819a8692465cfac357e6a2770d80109"}
(note that this is the hash corresponding to the 22.1 release) when I call p/open I get a blank page instead of the usual UI. What could be going on here?

Carlo12:03:25

In the case in which portal doesn't work, in the browser console I get errors like:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)

seancorfield15:03:10

This is due to the git source missing the compiled js artifact for the cljs code

😍 1
☝️ 1
seancorfield15:03:30

Projects that use ClojureScript are hard to use directly as git deps.

☝️ 1
Carlo18:03:13

thank you @U04V70XH6! Is there something that I could do to workaround this? I mean, in general?

seancorfield18:03:52

In theory, @U1G869VNV could add a "prep" step that could run the build (locally) and produce the artifacts needed. See https://clojure.org/reference/deps_and_cli#prep Although, given that there's no build.clj in the project, I don't know that could be automated yet -- and it would rely on you as a git deps user having all the necessary tooling installed locally in order to run that build step (node, npm, shadow, etc I believe).

🙌 1
seancorfield18:03:39

But for some projects, yes, the deps prep approach is relatively straightforward -- where they just need Java code compiled, or some Clojure code AOT'd.

djblue16:04:12

Portal does https://github.com/djblue/portal/blob/master/dev/tasks/build.clj#L13-L27, but it needs a little tweaking to making it clj/prep-able :thinking_face:

djblue01:04:40

Might need to do clj -X:deps prep :aliases '[:dev]' if portal is brought in via :extra-deps

Carlo13:04:05

This is what happens now if I try to start a repl in a project in which I included a git dependency on portal:

error in process sentinel: Could not start nREPL server: 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$full_sha_QMARK_.invokeStatic(git.clj:36)
	at clojure.tools.deps.alpha.extensions.git$fn__1403.invokeStatic(git.clj:72)
	at clojure.tools.deps.alpha.extensions.git$fn__1403.invoke(git.clj:55)
	at clojure.lang.MultiFn.invoke(MultiFn.java:239)
	at clojure.tools.deps.alpha$canonicalize_deps$fn__746.invoke(alpha.clj:365)
	at clojure.core.protocols$iter_reduce.invokeStatic(protocols.clj:49)
	at clojure.core.protocols$fn__8162.invokeStatic(protocols.clj:75)
	at clojure.core.protocols$fn__8162.invoke(protocols.clj:75)
	at clojure.core.protocols$fn__8110$G__8105__8123.invoke(protocols.clj:13)
	at clojure.core$reduce.invokeStatic(core.clj:6830)
	at clojure.tools.deps.alpha$canonicalize_deps.invokeStatic(alpha.clj:362)
	at clojure.tools.deps.alpha$resolve_deps.invokeStatic(alpha.clj:494)
	at clojure.tools.deps.alpha$calc_basis.invokeStatic(alpha.clj:742)
	at clojure.tools.deps.alpha.script.make_classpath2$run_core.invokeStatic(make_classpath2.clj:132)
	at clojure.tools.deps.alpha.script.make_classpath2$run.invokeStatic(make_classpath2.clj:174)
	at clojure.tools.deps.alpha.script.make_classpath2$_main.invokeStatic(make_classpath2.clj:228)
	at clojure.tools.deps.alpha.script.make_classpath2$_main.doInvoke(make_classpath2.clj:195)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:705)
	at clojure.core$apply.invokeStatic(core.clj:667)
	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)

Carlo19:04:02

That was entirely because I didn't understand how it was supposed to work 😂 . Now that I know, I'll post in the main thread