depstar

Discussion around https://github.com/seancorfield/depstar
2020-11-24T19:46:16.160800Z

I already use depstar to generate an uberjar for an application. I would like to aot the uberjar and added the :aot true and :main-class project.core but got an error:

2020-11-24T19:46:19.161Z

Syntax error macroexpanding at (type.cljc:1:1).
Caused by: Can't embed object in code, maybe print-dup not defined: clojure.lang.MultiFn@54a98358

2020-11-24T19:47:23.161700Z

Any pointer about what should I look for to fix this?

seancorfield 2020-11-24T20:13:05.162300Z

@mynomoto That sounds like a syntax error in your code.

seancorfield 2020-11-24T20:13:22.162600Z

What is that type.cljc file?

2020-11-24T20:20:37.163400Z

Lots of plumatic schema definitions, that depends on several other namespaces.

2020-11-24T20:23:41.164100Z

The only other noticeable thing is that we add some cheshire encoders for some classes on this namespace.

2020-11-24T20:23:59.164300Z

I will try to comment those

2020-11-24T20:29:22.165Z

Comment the encoders makes no difference. Loading the file over a repl causes no errors.

ghadi 2020-11-24T20:36:25.165500Z

you should try to compile your application with (compile 'your-main-namespace)

ghadi 2020-11-24T20:37:11.166100Z

while ensuring that *compile-path* exists and is on your classpath

seancorfield 2020-11-24T20:38:25.167100Z

i.e., manually make an empty classes folder in your project, and then in a REPL run (compile 'project.core)

2020-11-24T20:38:57.167400Z

Ok, trying that. Thanks!

2020-11-24T20:46:36.167700Z

user=> (compile 'project-x.core)
  Execution error at project-core.schema.type/loading (type.cljc:1).
  Can't embed object in code, maybe print-dup not defined: clojure.lang.MultiFn@3705a85c
  

2020-11-24T20:47:23.168300Z

Looks almost the same, but maybe someone will understand something that I don't.

seancorfield 2020-11-24T21:13:01.169300Z

That means the problem is in your code, most likely some sort of syntax error (and nothing to do with depstar). So you'll have to start commenting out parts of that file to figure out where the error is.

seancorfield 2020-11-24T21:13:22.169800Z

If it's up on GitHub where we can take a look at it, we'll probably be able to pinpoint the problem faster.

2020-11-24T21:15:25.171400Z

It's a big private repository. I will follow your recommendation of commenting code until narrowing it, thanks. I suspected that it was not related to depstar but there is #aot 😉 Thanks!

seancorfield 2020-11-24T21:36:44.172400Z

Compiling each namespace is a good way to check for syntax errors if your editor isn't running a linter 🙂

2020-11-24T21:56:01.174900Z

After 2 namespaces of indirection and one rabbit hole I found the problem on one of our macros that is a def that keeps the metadata of the original var. Compiling each suspect namespace helped a lot. The jar is not working but this is another problem. Thanks!

1
seancorfield 2020-11-24T22:11:09.175400Z

Thanks for reporting back @mynomoto!