-
Notifications
You must be signed in to change notification settings - Fork 846
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a shim to invoke initialBuildSteps for ghci #1364
- Loading branch information
Showing
9 changed files
with
118 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module SetupShim where | ||
import Main | ||
import Distribution.PackageDescription (PackageDescription, emptyHookedBuildInfo) | ||
import Distribution.Simple | ||
import Distribution.Simple.Build | ||
import Distribution.Simple.Setup (ReplFlags, fromFlag, replDistPref, replVerbosity) | ||
import Distribution.Simple.LocalBuildInfo (LocalBuildInfo) | ||
import System.Environment (getArgs) | ||
|
||
mainOverride :: IO () | ||
mainOverride = do | ||
args <- getArgs | ||
if "repl" `elem` args && "stack-initial-build-steps" `elem` args | ||
then do | ||
defaultMainWithHooks simpleUserHooks | ||
{ preRepl = \_ _ -> return emptyHookedBuildInfo | ||
, replHook = stackReplHook | ||
, postRepl = \_ _ _ _ -> return () | ||
} | ||
else main | ||
|
||
stackReplHook :: PackageDescription -> LocalBuildInfo -> UserHooks -> ReplFlags -> [String] -> IO () | ||
stackReplHook pkg_descr lbi hooks flags args = do | ||
let distPref = fromFlag (replDistPref flags) | ||
verbosity = fromFlag (replVerbosity flags) | ||
case args of | ||
("stack-initial-build-steps":rest) | ||
| null rest -> initialBuildSteps distPref pkg_descr lbi verbosity | ||
| otherwise -> | ||
fail "Misuse of running Setup.hs with stack-initial-build-steps, expected no arguments" | ||
_ -> replHook simpleUserHooks pkg_descr lbi hooks flags args |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters