Add a flag to allow uberjar mode for libraries
See the discussions here: https://github.com/typelead/eta/issues/396#issuecomment-421266345.
Should be a fairly easy task for a new contributor.
I wonder if we could use the existing --staticlib ghc flag to trigger the uberjar, the description is somewhat applicable:
Generate a standalone static library (as opposed to an executable). This is useful when cross compiling. The library together with all its dependencies ends up in in a single static library that can be linked against.
Hmm if that is the description, our current implementation violates it! The main semantics of the flags are here:
https://github.com/typelead/eta/blob/master/compiler/Eta/Main/DriverPipeline.hs#L1362-L1370
getLinkFlags :: DynFlags -> LinkFlags
getLinkFlags dflags = uncurry LinkFlags $
case ghcLink dflags of
LinkBinary -> (True, True)
LinkStaticLib -> (False, False)
LinkDynLib -> (True, False)
other ->
panic ("link: GHC not built to link this way: " ++
show other)
The first Bool says whether to generate a MANIFEST as well as a main class and the second Bool says whether to link in all the dependencies. As you can see, we're missing the (False, True) combination, and that's really what this issue amounts to - creating a new link flag that returns that pair and making sure that etlas will send that flag when the --enable-uberjar-mode flag is enabled on a library component.