Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a flag to allow uberjar mode for libraries #881

Open
rahulmutt opened this issue Sep 14, 2018 · 2 comments
Open

Add a flag to allow uberjar mode for libraries #881

rahulmutt opened this issue Sep 14, 2018 · 2 comments

Comments

@rahulmutt
Copy link
Member

See the discussions here: #396 (comment).

Should be a fairly easy task for a new contributor.

@jneira
Copy link
Collaborator

jneira commented Nov 9, 2018

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.

@rahulmutt
Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants