Support backpack builds#2467
Conversation
| ''} | ||
| '' + lib.optionalString (instantiations != {}) '' | ||
| # An instantiated package will always depend on its indefinite counterpart, and the --dependency= flag added by exactDep/configure-flags is invalid for package IDs with a + | ||
| rm -fR $out/exactDep |
There was a problem hiding this comment.
I am not sure I follow here. By deleting exactDep you effectively disable it? if the --dependency flag is invalid, can that be fixed instead?
There was a problem hiding this comment.
No, you don't disable it, and you already have the needed flag that you would fix it to. The --dependency flag from the uninstantiated variant is the one we want to pass to Setup.hs, and the instantiated variant has the uninstantiated one in its propagated build inputs. The instantiated one is enabled because it's in the package db and Setup knows which package db entry because it's a function of the uninstantiated unit ID (passed via --dependency) and the unit IDs of the hole fillings specified in the cabal file.
Relevant cabal file subset:
library sig
build-depends: base
signatures: Module
library impl
build-depends: base
exposed-modules: Mod
library consumer
build-depends: base, backpack:sig
signatures: Module
executable backpack
build-depends: base, backpack:consumer, backpack:impl
mixins: backpack:consumer requires (Module as Mod)Relevant buildInputs of ig12a19g4mdgrcxcf7f7jwk155xya42a-backpack-exe-backpack-0.1.0.0.drv:
/nix/store/caas5rc8ahs5mbq4p38vgr9wjznkjkgb-backpack-lib-consumer-0.1.0.0
caas5rc8ahs5mbq4p38vgr9wjznkjkgb-backpack-lib-consumer-0.1.0.0 is a backpack instantiation. Relevant propagatedBuildInputs:
/nix/store/hmiprpqxp8mzyvl6mqz24gqrkzlq7wy7-backpack-lib-consumer-0.1.0.0
Which is the version of consumer without any of its holes filled.
So for caa*consumer*, we get these configure flags:
--dependency=backpack:consumer=backpack-0.1.0.0-F4eEDqjvUdHGGjwvlSTTdF-consumer # comes from hmipr*consumer* being in buildInputs--instantiate-with=Module=backpack-0.1.0.0-A0nxY63swED6kmHNYgsA4d-impl:Mod # comes from the fact that we're instantiating one of hmipr*consumer*'s holes with some concrete module
And we do not have exactDeps in $out.
And for ig12*exe-backpack*, we have these configure flags:
--dependency=backpack:consumer=backpack-0.1.0.0-F4eEDqjvUdHGGjwvlSTTdF-consumer # comes from hmipr*consumer* being /propagated/ by caa*consumer*
But Setup.hs looks at the cabal file and sees we don't want the uninstantiated version of consumer, we want a particular instantiation, and it calculates the expected hash, and it finds the relevant dependency in the package db because caa*consumer* is in buildInputs.
# Conflicts: # test/cabal.project.local
…ures GHC's JavaScript backend doesn't produce .o files for backpack signature module instantiations, causing ar to fail when creating library archives. Fix this by replacing the ar command in GHC's settings with a wrapper that filters out missing .o files from both command-line arguments and response files. The fix only applies to GHCJS instantiated backpack builds, leaving all other builds unchanged.
# Conflicts: # test/cabal.project.local
7d78d16
into
input-output-hk:master
Fixes #244