mranderson icon indicating copy to clipboard operation
mranderson copied to clipboard

Prefix repeated multiple times when `:aot :all`

Open marmor7 opened this issue 2 years ago • 3 comments

When lein's :aot flag is set to :all, mr.anderson gets confused and repeats the expected prefix multiple time.

the ns of some files can be something like:

mylib101012.mylib101012.mylib101012.mylib101012.mylib101012.some.ns

When the flag is removed the issue is resolved.

marmor7 avatar Jan 05 '23 11:01 marmor7

Can confirm I saw this too when working with @marmor7 on Slack.

It would be nice to include a minimal reproducible example.

We were working with inlining libs that had aoted from a lib that specified aot. Not sure if one or both cause the symptom.

And probably not a good idea for libs to be aoting and including clojure compiled .class files in the first place?

Options (not mutually exclusive):

  1. add a note to MrAnderson docs about aot.
  2. have MrAnderson somehow deal with libs that have aoted.

lread avatar Jan 05 '23 20:01 lread

As a quick idea, the Lein plugin could hard-fail if :aot is set, because it's very much discouraged to distribute libs as .class files.

Slight differences between .class files emitted by different Clojure versions can quite easily give problems. A few Clojure versions specifically made those sort of incompatible changes.

There probably are other drawbacks - can't list them myself exhaustively but it's definitely a usual suspect when debugging random misteries :)

vemv avatar Jan 05 '23 20:01 vemv

Thanks for chiming in @vemv! Your idea makes good sense to me. I think that's a good strategy for the inlining lib side.

Any ideas from the inlined lib side? When an inlined lib uses aot it will also generate .class files for its deps. An example. This can cause big confusion on the classpath especially when a user brings in different versions of those deps. An inlined lib jar can legitimately contain .class files (from java sources for example or from a non-Clojure lib) but when the .class files are from compiled Clojure it is usually, as I understand it, a recipe for pain. Maybe just docs here?

lread avatar Jan 05 '23 20:01 lread