depstar

Discussion around https://github.com/seancorfield/depstar
danielneal 2021-02-01T10:02:28.050800Z

Heya, I'm new to depstar. I'm trying to make an uberjar for a project that uses malli. To allow use of a custom registry in malli I need to set the following jvm opts ["-Dmalli.registry/type=custom"]. Where should this go when building an uberjar with depstar?

dharrigan 2021-02-01T10:03:51.051Z

Here's an example...

dharrigan 2021-02-01T10:04:10.051400Z

:uberjar {:replace-deps {seancorfield/depstar {:mvn/version "2.0.171"}}
                     :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
                     :exec-fn hf.depstar/uberjar
                     :exec-args {:jar foo.jar
                                 :group-id foo
                                 :artifact-id bar
                                 :version "0.0.0"
                                 :main-class foo.bar.main
                                 :aot true
                                 :sync-pom true}}}

danielneal 2021-02-01T10:05:21.051600Z

ah interesting, that's what I have

danielneal 2021-02-01T10:05:45.051900Z

this is how it failed:

[main] INFO hf.depstar.uberjar - Compiling sqa.main ...
Execution error (ExceptionInfo) at malli.registry/set-default-registry! (registry.cljc:30).
can't set default registry

Full report at:
/var/folders/38/bhb_3y9d70dd6vzvnf9tdbm80000gn/T/clojure-7407818078122203090.edn

[main] ERROR hf.depstar.uberjar - Compilation of sqa.main failed!
[main] ERROR hf.depstar.uberjar - AOT FAILED

danielneal 2021-02-01T10:06:10.052400Z

where set-default-registry! is the command that requires the system property set

dharrigan 2021-02-01T10:06:45.052800Z

Don't know why AOT failed 😞

dharrigan 2021-02-01T10:06:52.053Z

That's probably a side effect

dharrigan 2021-02-01T10:07:52.053300Z

Maybe the / is confusing the java opts?

dharrigan 2021-02-01T10:09:01.053800Z

Seems okay on their documentationp age

danielneal 2021-02-01T10:12:03.054100Z

yeah the jvm opt works fine normally

dharrigan 2021-02-01T10:13:42.054400Z

what does the full report say?

dharrigan 2021-02-01T10:14:01.055Z

It should give a reason

danielneal 2021-02-01T10:15:03.055200Z

{:clojure.main/message
 "Execution error (ExceptionInfo) at malli.registry/set-default-registry! (registry.cljc:30).\ncan't set default registry\n",
 :clojure.main/triage
 {:clojure.error/class clojure.lang.ExceptionInfo,
  :clojure.error/line 30,
  :clojure.error/cause "can't set default registry",
  :clojure.error/symbol malli.registry/set-default-registry!,
  :clojure.error/source "registry.cljc",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type clojure.lang.Compiler$CompilerException,
    :message "Syntax error macroexpanding at (schema.clj:35:1).",
    :data
    {:clojure.error/phase :execution,
     :clojure.error/line 35,
     :clojure.error/column 1,
     :clojure.error/source "schema.clj"},
    :at [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3707]}
   {:type clojure.lang.ExceptionInfo,
    :message "can't set default registry",
    :data {:type "default"},
    :at
    [malli.registry$set_default_registry_BANG_
     invokeStatic
     "registry.cljc"
     30]}],
  :trace
  [[malli.registry$set_default_registry_BANG_
    invokeStatic
    "registry.cljc"
    30]
   [malli.registry$set_default_registry_BANG_
    invoke
    "registry.cljc"
    27]
   [sqa.schema$init_schema_registries invokeStatic "schema.clj" 31]
   [sqa.schema$init_schema_registries invoke "schema.clj" 28]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 3204]
   [sqa.leo$loading__6721__auto____31503 invoke "leo.clj" 1]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile1 "Compiler.java" 7721]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 619]
   [sqa.user$loading__6721__auto____31501 invoke "user.clj" 1]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile1 "Compiler.java" 7721]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 3894]
   [sqa.bl$loading__6721__auto____15102 invoke "bl.clj" 1]
   [clojure.lang.AFn applyToHelper "AFn.java" 152]
   [clojure.lang.AFn applyTo "AFn.java" 144]
   [clojure.lang.Compiler$InvokeExpr eval "Compiler.java" 3702]
   [clojure.lang.Compiler compile1 "Compiler.java" 7731]
   [clojure.lang.Compiler compile1 "Compiler.java" 7721]
   [clojure.lang.Compiler compile "Compiler.java" 7798]
   [clojure.lang.RT compile "RT.java" 411]
   [clojure.lang.RT load "RT.java" 457]
   [clojure.lang.RT load "RT.java" 424]
   [clojure.core$load$fn__6839 invoke "core.clj" 6126]
   [clojure.core$load invokeStatic "core.clj" 6125]
   [clojure.core$load doInvoke "core.clj" 6109]
   [clojure.lang.RestFn invoke "RestFn.java" 408]
   [clojure.core$load_one invokeStatic "core.clj" 5908]
   [clojure.core$load_one invoke "core.clj" 5903]
   [clojure.core$load_lib$fn__6780 invoke "core.clj" 5948]
   [clojure.core$load_lib invokeStatic "core.clj" 5947]
   [clojure.core$load_lib doInvoke "core.clj" 5928]
   [clojure.lang.RestFn applyTo "RestFn.java" 142]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$load_libs invokeStatic "core.clj" 5985]
   [clojure.core$load_libs doInvoke "core.clj" 5969]
   [clojure.lang.RestFn applyTo "RestFn.java" 137]
   [clojure.core$apply invokeStatic "core.clj" 667]
   [clojure.core$require invokeStatic "core.clj" 6007]
   [clojure.core$require doInvoke "core.clj" 6007]
   [clojure.lang.RestFn invoke "RestFn.java" 3894]
   [sqa.api_common$loading__6721__auto____13934
    invoke
    "api_common.clj"
    1]

danielneal 2021-02-01T10:15:15.055500Z

(sorry it's massive 😄 )

danielneal 2021-02-01T10:18:03.056400Z

interestingly, tonskys uberdeps seems to work. I do have to pass the jvm opt to the finished jar, but putting the jar together succeeds.

dharrigan 2021-02-01T10:20:27.056800Z

try the same with depstar? Build without the -D, but pass it in when run?

seancorfield 2021-02-01T17:47:37.057700Z

@danieleneal Currently, there's no way to tell depstar about JVM options for compilation but I plan to address that in the next release: https://github.com/seancorfield/depstar/issues/64

danielneal 2021-02-01T17:48:29.058200Z

ah, thanks @seancorfield 🙂