depstar

Discussion around https://github.com/seancorfield/depstar
sparkofreason 2020-09-21T20:24:04.003Z

I'm trying to compile an uberjar for deployment as a Google could function. Can I AOT using depstar without specifying a Main-Class? The cloud function framework just wants to reflect on the jar and find a particular class implementation. I tried with "-m", but it complains that it can't find clojure core__init.class.

seancorfield 2020-09-21T20:25:24.003700Z

@dave.dixon The -m option specifies the namespace that compile is run against so, no, you can't use -C without -m.

seancorfield 2020-09-21T20:26:07.004500Z

And -m also determines the Main-Class: in the generated MANIFEST.

sparkofreason 2020-09-21T20:26:25.005200Z

Maybe I need to add something to the class constructor to load clojure? Feels like I've had this issue before.

seancorfield 2020-09-21T20:28:08.006500Z

If you don't want to specify a Main-Class:, you can still create an uberjar with AOT'd code but you have to do it more manually...

seancorfield 2020-09-21T20:29:28.008Z

1. create classes folder 2. manually compile the namespace(s) you need for actual classes 3. build an uberjar (without -C and without -m) via an alias that adds :extra-paths ["classes"] so the compiled code is on the classpath and therefore will get added to the JAR

seancorfield 2020-09-21T20:30:05.008800Z

Step 2 can be just clojure -e '(compile 'your.entry.ns)' if that's where your :gen-class is

seancorfield 2020-09-21T20:30:36.009400Z

As for initialization of Clojure for Google Cloud, no idea about that. Never tried to use any Google services.

seancorfield 2020-09-21T20:30:52.009900Z

There's a #google-cloud channel that can probably answer that.

seancorfield 2020-09-21T20:31:22.010500Z

Feel free to @ me into that channel if you get advice that doesn't easily translate to depstar and I'll try to help out...

sparkofreason 2020-09-21T21:11:10.012100Z

Thanks, I got it to build via this route, though it still has to issue not finding core__init.class. I have a recollection that when compiling a library of classes to be reflected, there's something you need to do to get clojure initialized, stuff that otherwise would happen through clojure.main.

sparkofreason 2020-09-21T21:32:24.012400Z

I think it was something like this: https://groups.google.com/g/clojure/c/Aa04E9aJRog