{-# LANGUAGE CPP, BangPatterns, RecordWildCards, RankNTypes, ViewPatterns,
TupleSections #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
#ifdef MIN_VERSION_Cabal
#undef CH_MIN_VERSION_Cabal
#define CH_MIN_VERSION_Cabal MIN_VERSION_Cabal
#endif
module CabalHelper.Runtime.HelperMain (helper_main) where
import Distribution.Simple.Utils (cabalVersion)
import Distribution.Simple.Configure
import Distribution.Package
( PackageIdentifier
, PackageId
, packageName
, packageVersion
)
import Distribution.PackageDescription
( PackageDescription
, GenericPackageDescription(..)
, Flag(..)
, FlagName
, FlagAssignment
, Executable(..)
, Library(..)
, TestSuite(..)
, Benchmark(..)
, BuildInfo(..)
, TestSuiteInterface(..)
, BenchmarkInterface(..)
, withLib
)
import Distribution.PackageDescription.Configuration
( flattenPackageDescription
)
import Distribution.Simple.Program
( requireProgram
, ghcProgram
)
import Distribution.Simple.Program.Types
( ConfiguredProgram(..)
)
import Distribution.Simple.Configure
( getPersistBuildConfig
)
import Distribution.Simple.LocalBuildInfo
( LocalBuildInfo(..)
, Component(..)
, ComponentName(..)
, ComponentLocalBuildInfo(..)
, componentBuildInfo
, withAllComponentsInBuildOrder
, withLibLBI
, withExeLBI
)
import Distribution.Simple.GHC
( componentGhcOptions
)
import Distribution.Simple.Program.GHC
( GhcOptions(..)
, renderGhcOptions
)
import Distribution.Simple.Setup
( ConfigFlags(..)
, Flag(..)
, fromFlagOrDefault
)
import Distribution.Simple.Build
( initialBuildSteps
)
import Distribution.Simple.BuildPaths
( cppHeaderName
)
import Distribution.Simple.Compiler
( PackageDB(..)
, compilerId
)
import Distribution.Compiler
( CompilerId(..)
)
import Distribution.ModuleName
( components
)
import qualified Distribution.ModuleName as C
( ModuleName
)
import Distribution.Text
( display
)
import Distribution.Verbosity
( Verbosity
, silent
, deafening
, normal
)
import Distribution.Version
( Version
)
#if CH_MIN_VERSION_Cabal(1,22,0)
import Distribution.Utils.NubList
#endif
#if CH_MIN_VERSION_Cabal(1,23,0)
import Distribution.Simple.LocalBuildInfo
( localUnitId
)
#else
import Distribution.Simple.LocalBuildInfo
( inplacePackageId
)
#endif
#if CH_MIN_VERSION_Cabal(1,25,0)
import Distribution.PackageDescription
( unFlagName
)
import Distribution.Types.ForeignLib
( ForeignLib(..)
)
import Distribution.Types.UnqualComponentName
( UnqualComponentName
, unUnqualComponentName
)
#else
import Distribution.PackageDescription
( FlagName(FlagName)
)
#endif
#if CH_MIN_VERSION_Cabal(2,0,0)
import Distribution.Simple.LocalBuildInfo
( allLibModules
, componentBuildDir
)
import Distribution.Backpack
( OpenUnitId(..),
OpenModule(..)
)
import Distribution.ModuleName
( ModuleName
)
import Distribution.Types.ComponentId
( unComponentId
)
import Distribution.Types.ComponentLocalBuildInfo
( maybeComponentInstantiatedWith
)
import Distribution.Types.ModuleRenaming
( ModuleRenaming(..),
isDefaultRenaming
)
import Distribution.Types.MungedPackageId
( MungedPackageId
)
import Distribution.Types.UnitId
( UnitId
, unDefUnitId
, unUnitId
)
import Distribution.Types.UnitId
( DefUnitId
)
import Distribution.Utils.NubList
( toNubListR
)
import Distribution.Version
( versionNumbers
, mkVersion
)
import qualified Distribution.InstalledPackageInfo as Installed
#endif
import Control.Applicative ((<$>), (<*>), ZipList(..))
import Control.Arrow (first, second, (&&&))
import Control.Monad
import Control.Exception (catch, PatternMatchFail(..))
import Data.List
import qualified Data.Map.Strict as Map
import Data.Maybe
import Data.Monoid
import Data.IORef
import qualified Data.Version as DataVersion
import System.Environment
import System.Directory
import System.FilePath
import System.Exit
import System.IO
import System.IO.Unsafe (unsafeInterleaveIO, unsafePerformIO)
import Text.Printf
import CabalHelper.Shared.Common
import CabalHelper.Shared.InterfaceTypes
import CabalHelper.Runtime.Compat
usage :: IO ()
usage :: IO ()
usage = do
String
prog <- IO String
getProgName
Handle -> String -> IO ()
hPutStr Handle
stderr (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ "Usage: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
prog String -> String -> String
forall a. [a] -> [a] -> [a]
++ " " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
usageMsg
where
usageMsg :: String
usageMsg = ""
String -> String -> String
forall a. [a] -> [a] -> [a]
++"CABAL_FILE DIST_DIR (v1|v2)\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" ( version\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" | flags\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" | config-flags\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" | non-default-config-flags\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" | write-autogen-files\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" | compiler-id\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" | component-info\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" | print-lbi [--human]\n"
String -> String -> String
forall a. [a] -> [a] -> [a]
++" ) ...\n"
commands :: [String]
commands :: [String]
commands = [ "flags"
, "config-flags"
, "non-default-config-flags"
, "write-autogen-files"
, "compiler-id"
, "package-db-stack"
, "component-info"
, "print-lbi"
]
helper_main :: [String] -> IO [Maybe ChResponse]
helper_main :: [String] -> IO [Maybe ChResponse]
helper_main args :: [String]
args = do
cfile :: String
cfile : distdir :: String
distdir : pt :: String
pt : args' :: [String]
args'
<- case [String]
args of
[] -> IO ()
usage IO () -> IO [String] -> IO [String]
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO [String]
forall a. IO a
exitFailure
_ -> [String] -> IO [String]
forall (m :: * -> *) a. Monad m => a -> m a
return [String]
args
Bool
ddexists <- String -> IO Bool
doesDirectoryExist String
distdir
Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (Bool -> Bool
not Bool
ddexists) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
String -> IO ()
errMsg (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ "distdir '"String -> String -> String
forall a. [a] -> [a] -> [a]
++String
distdirString -> String -> String
forall a. [a] -> [a] -> [a]
++"' does not exist"
IO ()
forall a. IO a
exitFailure
Verbosity
v <- Verbosity -> (String -> Verbosity) -> Maybe String -> Verbosity
forall b a. b -> (a -> b) -> Maybe a -> b
maybe Verbosity
silent (Verbosity -> String -> Verbosity
forall a b. a -> b -> a
const Verbosity
deafening) (Maybe String -> Verbosity)
-> ([(String, String)] -> Maybe String)
-> [(String, String)]
-> Verbosity
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [(String, String)] -> Maybe String
forall a b. Eq a => a -> [(a, b)] -> Maybe b
lookup "CABAL_HELPER_DEBUG" ([(String, String)] -> Verbosity)
-> IO [(String, String)] -> IO Verbosity
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO [(String, String)]
getEnvironment
LocalBuildInfo
lbi <- IO LocalBuildInfo -> IO LocalBuildInfo
forall a. IO a -> IO a
unsafeInterleaveIO (IO LocalBuildInfo -> IO LocalBuildInfo)
-> IO LocalBuildInfo -> IO LocalBuildInfo
forall a b. (a -> b) -> a -> b
$ String -> IO LocalBuildInfo
getPersistBuildConfig String
distdir
GenericPackageDescription
gpd <- IO GenericPackageDescription -> IO GenericPackageDescription
forall a. IO a -> IO a
unsafeInterleaveIO (IO GenericPackageDescription -> IO GenericPackageDescription)
-> IO GenericPackageDescription -> IO GenericPackageDescription
forall a b. (a -> b) -> a -> b
$ Verbosity -> String -> IO GenericPackageDescription
readPackageDescription Verbosity
v String
cfile
let pd :: PackageDescription
pd = LocalBuildInfo -> PackageDescription
localPkgDescr LocalBuildInfo
lbi
let lvd :: (LocalBuildInfo, Verbosity, String)
lvd = (LocalBuildInfo
lbi, Verbosity
v, String
distdir)
let
infixr 2 $$
$$ :: (a -> b) -> a -> b
($$) = (a -> b) -> a -> b
forall a b. (a -> b) -> a -> b
($)
collectCmdOptions :: [String] -> [[String]]
collectCmdOptions :: [String] -> [[String]]
collectCmdOptions =
[[String]] -> [[String]]
forall a. [a] -> [a]
reverse ([[String]] -> [[String]])
-> ([String] -> [[String]]) -> [String] -> [[String]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([String] -> [String]) -> [[String]] -> [[String]]
forall a b. (a -> b) -> [a] -> [b]
map [String] -> [String]
forall a. [a] -> [a]
reverse ([[String]] -> [[String]])
-> ([String] -> [[String]]) -> [String] -> [[String]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ([[String]] -> String -> [[String]])
-> [[String]] -> [String] -> [[String]]
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl [[String]] -> String -> [[String]]
f [] ([String] -> [[String]])
-> ([String] -> [String]) -> [String] -> [[String]]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
dropWhile String -> Bool
isOpt
where
isOpt :: String -> Bool
isOpt = ("--" String -> String -> Bool
forall a. Eq a => [a] -> [a] -> Bool
`isPrefixOf`)
f :: [[String]] -> String -> [[String]]
f [] x :: String
x = [[String
x]]
f (a :: [String]
a:as :: [[String]]
as) x :: String
x
| String -> Bool
isOpt String
x = (String
xString -> [String] -> [String]
forall a. a -> [a] -> [a]
:[String]
a)[String] -> [[String]] -> [[String]]
forall a. a -> [a] -> [a]
:[[String]]
as
| Bool
otherwise = [String
x][String] -> [[String]] -> [[String]]
forall a. a -> [a] -> [a]
:([String]
a[String] -> [[String]] -> [[String]]
forall a. a -> [a] -> [a]
:[[String]]
as)
let cmds :: [[String]]
cmds = [String] -> [[String]]
collectCmdOptions [String]
args'
(([String] -> IO (Maybe ChResponse))
-> [[String]] -> IO [Maybe ChResponse])
-> [[String]]
-> ([String] -> IO (Maybe ChResponse))
-> IO [Maybe ChResponse]
forall a b c. (a -> b -> c) -> b -> a -> c
flip ([String] -> IO (Maybe ChResponse))
-> [[String]] -> IO [Maybe ChResponse]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM [[String]]
cmds (([String] -> IO (Maybe ChResponse)) -> IO [Maybe ChResponse])
-> ([String] -> IO (Maybe ChResponse)) -> IO [Maybe ChResponse]
forall a b. (a -> b) -> a -> b
$$ \x :: [String]
x -> do
case [String]
x of
"version":[] ->
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ (String, Version) -> ChResponse
ChResponseVersion ("Cabal", Version -> Version
toDataVersion Version
cabalVersion)
"package-id":[] ->
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ (String, Version) -> ChResponse
ChResponseVersion ((String, Version) -> ChResponse)
-> (String, Version) -> ChResponse
forall a b. (a -> b) -> a -> b
$ (,)
(PackageName -> String
forall a. Pretty a => a -> String
display (GenericPackageDescription -> PackageName
forall pkg. Package pkg => pkg -> PackageName
packageName GenericPackageDescription
gpd))
(Version -> Version
toDataVersion (GenericPackageDescription -> Version
forall pkg. Package pkg => pkg -> Version
packageVersion GenericPackageDescription
gpd))
"flags":[] -> do
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ [(String, Bool)] -> ChResponse
ChResponseFlags ([(String, Bool)] -> ChResponse) -> [(String, Bool)] -> ChResponse
forall a b. (a -> b) -> a -> b
$ [(String, Bool)] -> [(String, Bool)]
forall a. Ord a => [a] -> [a]
sort ([(String, Bool)] -> [(String, Bool)])
-> [(String, Bool)] -> [(String, Bool)]
forall a b. (a -> b) -> a -> b
$
(Flag -> (String, Bool)) -> [Flag] -> [(String, Bool)]
forall a b. (a -> b) -> [a] -> [b]
map (Flag -> String
flagName' (Flag -> String) -> (Flag -> Bool) -> Flag -> (String, Bool)
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& Flag -> Bool
flagDefault) ([Flag] -> [(String, Bool)]) -> [Flag] -> [(String, Bool)]
forall a b. (a -> b) -> a -> b
$ GenericPackageDescription -> [Flag]
genPackageFlags GenericPackageDescription
gpd
"config-flags":[] -> do
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ [(String, Bool)] -> ChResponse
ChResponseFlags ([(String, Bool)] -> ChResponse) -> [(String, Bool)] -> ChResponse
forall a b. (a -> b) -> a -> b
$ [(String, Bool)] -> [(String, Bool)]
forall a. Ord a => [a] -> [a]
sort ([(String, Bool)] -> [(String, Bool)])
-> [(String, Bool)] -> [(String, Bool)]
forall a b. (a -> b) -> a -> b
$
((FlagName, Bool) -> (String, Bool))
-> [(FlagName, Bool)] -> [(String, Bool)]
forall a b. (a -> b) -> [a] -> [b]
map ((FlagName -> String) -> (FlagName, Bool) -> (String, Bool)
forall (a :: * -> * -> *) b c d.
Arrow a =>
a b c -> a (b, d) (c, d)
first FlagName -> String
unFlagName)
([(FlagName, Bool)] -> [(String, Bool)])
-> [(FlagName, Bool)] -> [(String, Bool)]
forall a b. (a -> b) -> a -> b
$ FlagAssignment -> [(FlagName, Bool)]
unFlagAssignment
(FlagAssignment -> [(FlagName, Bool)])
-> FlagAssignment -> [(FlagName, Bool)]
forall a b. (a -> b) -> a -> b
$ ConfigFlags -> FlagAssignment
configConfigurationsFlags
(ConfigFlags -> FlagAssignment) -> ConfigFlags -> FlagAssignment
forall a b. (a -> b) -> a -> b
$ LocalBuildInfo -> ConfigFlags
configFlags LocalBuildInfo
lbi
"non-default-config-flags":[] -> do
let flagDefinitons :: [Flag]
flagDefinitons = GenericPackageDescription -> [Flag]
genPackageFlags GenericPackageDescription
gpd
flagAssgnments :: [(FlagName, Bool)]
flagAssgnments =
#if CH_MIN_VERSION_Cabal(2,2,0)
FlagAssignment -> [(FlagName, Bool)]
unFlagAssignment (FlagAssignment -> [(FlagName, Bool)])
-> FlagAssignment -> [(FlagName, Bool)]
forall a b. (a -> b) -> a -> b
$ ConfigFlags -> FlagAssignment
configConfigurationsFlags
#else
configConfigurationsFlags
#endif
(ConfigFlags -> FlagAssignment) -> ConfigFlags -> FlagAssignment
forall a b. (a -> b) -> a -> b
$ LocalBuildInfo -> ConfigFlags
configFlags LocalBuildInfo
lbi
nonDefaultFlags :: [(String, Bool)]
nonDefaultFlags =
[ (String
flag_name, Bool
val)
| MkFlag {flagName :: Flag -> FlagName
flagName=(FlagName -> String
unFlagName -> String
flag_name'), flagDefault :: Flag -> Bool
flagDefault=Bool
def_val} <- [Flag]
flagDefinitons
, (FlagName -> String
unFlagName -> String
flag_name, val :: Bool
val) <- [(FlagName, Bool)]
flagAssgnments
, String
flag_name String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== String
flag_name'
, Bool
val Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
/= Bool
def_val
]
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ [(String, Bool)] -> ChResponse
ChResponseFlags ([(String, Bool)] -> ChResponse) -> [(String, Bool)] -> ChResponse
forall a b. (a -> b) -> a -> b
$ [(String, Bool)] -> [(String, Bool)]
forall a. Ord a => [a] -> [a]
sort [(String, Bool)]
nonDefaultFlags
"write-autogen-files":[] -> do
String
-> PackageDescription -> LocalBuildInfo -> Verbosity -> IO ()
initialBuildStepsForAllComponents String
distdir PackageDescription
pd LocalBuildInfo
lbi Verbosity
v
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ChResponse
forall a. Maybe a
Nothing
"compiler-id":[] -> do
let CompilerId comp :: CompilerFlavor
comp ver :: Version
ver = Compiler -> CompilerId
compilerId (Compiler -> CompilerId) -> Compiler -> CompilerId
forall a b. (a -> b) -> a -> b
$ LocalBuildInfo -> Compiler
compiler LocalBuildInfo
lbi
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ (String, Version) -> ChResponse
ChResponseVersion ((String, Version) -> ChResponse)
-> (String, Version) -> ChResponse
forall a b. (a -> b) -> a -> b
$ (,) (CompilerFlavor -> String
forall a. Show a => a -> String
show CompilerFlavor
comp) (Version -> Version
toDataVersion Version
ver)
"component-info":[] -> do
Map ChComponentName ChComponentInfo
res <- (LocalBuildInfo, Verbosity, String)
-> String -> IO (Map ChComponentName ChComponentInfo)
componentsInfo (LocalBuildInfo, Verbosity, String)
lvd String
pt
Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ Map ChComponentName ChComponentInfo -> ChResponse
ChResponseComponentsInfo Map ChComponentName ChComponentInfo
res
"print-lbi":flags :: [String]
flags ->
case [String]
flags of
["--human"] -> LocalBuildInfo -> IO ()
forall a. Show a => a -> IO ()
print LocalBuildInfo
lbi IO () -> IO (Maybe ChResponse) -> IO (Maybe ChResponse)
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ChResponse
forall a. Maybe a
Nothing
_ -> Maybe ChResponse -> IO (Maybe ChResponse)
forall (m :: * -> *) a. Monad m => a -> m a
return (Maybe ChResponse -> IO (Maybe ChResponse))
-> Maybe ChResponse -> IO (Maybe ChResponse)
forall a b. (a -> b) -> a -> b
$ ChResponse -> Maybe ChResponse
forall a. a -> Maybe a
Just (ChResponse -> Maybe ChResponse) -> ChResponse -> Maybe ChResponse
forall a b. (a -> b) -> a -> b
$ String -> ChResponse
ChResponseLbi (String -> ChResponse) -> String -> ChResponse
forall a b. (a -> b) -> a -> b
$ LocalBuildInfo -> String
forall a. Show a => a -> String
show LocalBuildInfo
lbi
cmd :: String
cmd:_ | Bool -> Bool
not (String
cmd String -> [String] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [String]
commands) ->
String -> IO ()
errMsg ("Unknown command: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
cmd) IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO ()
usage IO () -> IO (Maybe ChResponse) -> IO (Maybe ChResponse)
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO (Maybe ChResponse)
forall a. IO a
exitFailure
_ ->
String -> IO ()
errMsg "Invalid usage!" IO () -> IO () -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO ()
usage IO () -> IO (Maybe ChResponse) -> IO (Maybe ChResponse)
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> IO (Maybe ChResponse)
forall a. IO a
exitFailure
type ProjectType = String
componentsInfo
:: (LocalBuildInfo, Verbosity, FilePath)
-> ProjectType
-> IO (Map.Map ChComponentName ChComponentInfo)
componentsInfo :: (LocalBuildInfo, Verbosity, String)
-> String -> IO (Map ChComponentName ChComponentInfo)
componentsInfo lvd :: (LocalBuildInfo, Verbosity, String)
lvd@(lbi :: LocalBuildInfo
lbi, v :: Verbosity
v, distdir :: String
distdir) pt :: String
pt = do
let mod_ghc_opts :: GhcOptions -> GhcOptions
mod_ghc_opts opts :: GhcOptions
opts
| String
pt String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "v1" = GhcOptions
opts {
ghcOptPackageDBs :: PackageDBStack
ghcOptPackageDBs =
GhcOptions -> PackageDBStack
ghcOptPackageDBs GhcOptions
opts PackageDBStack -> PackageDBStack -> PackageDBStack
forall a. [a] -> [a] -> [a]
++
[String -> PackageDB
SpecificPackageDB (String -> PackageDB) -> String -> PackageDB
forall a b. (a -> b) -> a -> b
$ LocalBuildInfo -> String -> String
internalPackageDBPath LocalBuildInfo
lbi String
distdir]
}
| String
pt String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== "v2" = GhcOptions
opts
| Bool
otherwise = String -> GhcOptions
forall a. HasCallStack => String -> a
error (String -> GhcOptions) -> String -> GhcOptions
forall a b. (a -> b) -> a -> b
$ "Unknown project-type '"String -> String -> String
forall a. [a] -> [a] -> [a]
++String
ptString -> String -> String
forall a. [a] -> [a] -> [a]
++"'!"
[(ChComponentName, [String])]
ciGhcOptions <- (LocalBuildInfo, Verbosity, String)
-> (GhcOptions -> GhcOptions) -> IO [(ChComponentName, [String])]
componentOptions (LocalBuildInfo, Verbosity, String)
lvd GhcOptions -> GhcOptions
mod_ghc_opts
[(ChComponentName, [String])]
ciSourceDirs <- LocalBuildInfo
-> Verbosity
-> String
-> (Component
-> ComponentLocalBuildInfo -> BuildInfo -> IO [String])
-> IO [(ChComponentName, [String])]
forall a.
LocalBuildInfo
-> Verbosity
-> String
-> (Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a)
-> IO [(ChComponentName, a)]
componentsMap LocalBuildInfo
lbi Verbosity
v String
distdir ((Component -> ComponentLocalBuildInfo -> BuildInfo -> IO [String])
-> IO [(ChComponentName, [String])])
-> (Component
-> ComponentLocalBuildInfo -> BuildInfo -> IO [String])
-> IO [(ChComponentName, [String])]
forall a b. (a -> b) -> a -> b
$ \_ _ bi :: BuildInfo
bi -> [String] -> IO [String]
forall (m :: * -> *) a. Monad m => a -> m a
return ([String] -> IO [String]) -> [String] -> IO [String]
forall a b. (a -> b) -> a -> b
$ BuildInfo -> [String]
hsSourceDirs BuildInfo
bi
[(ChComponentName, ChEntrypoint)]
ciEntrypoints <- LocalBuildInfo
-> Verbosity
-> String
-> (Component
-> ComponentLocalBuildInfo -> BuildInfo -> IO ChEntrypoint)
-> IO [(ChComponentName, ChEntrypoint)]
forall a.
LocalBuildInfo
-> Verbosity
-> String
-> (Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a)
-> IO [(ChComponentName, a)]
componentsMap LocalBuildInfo
lbi Verbosity
v String
distdir ((Component
-> ComponentLocalBuildInfo -> BuildInfo -> IO ChEntrypoint)
-> IO [(ChComponentName, ChEntrypoint)])
-> (Component
-> ComponentLocalBuildInfo -> BuildInfo -> IO ChEntrypoint)
-> IO [(ChComponentName, ChEntrypoint)]
forall a b. (a -> b) -> a -> b
$ \c :: Component
c _clbi :: ComponentLocalBuildInfo
_clbi _bi :: BuildInfo
_bi ->
ChEntrypoint -> IO ChEntrypoint
forall (m :: * -> *) a. Monad m => a -> m a
return (ChEntrypoint -> IO ChEntrypoint)
-> ChEntrypoint -> IO ChEntrypoint
forall a b. (a -> b) -> a -> b
$ Component -> ChEntrypoint
componentEntrypoints Component
c
let comp_name :: [ChComponentName]
comp_name = ((ChComponentName, [String]) -> ChComponentName)
-> [(ChComponentName, [String])] -> [ChComponentName]
forall a b. (a -> b) -> [a] -> [b]
map (ChComponentName, [String]) -> ChComponentName
forall a b. (a, b) -> a
fst [(ChComponentName, [String])]
ciGhcOptions
uiComponents :: Map ChComponentName ChComponentInfo
uiComponents = [(ChComponentName, ChComponentInfo)]
-> Map ChComponentName ChComponentInfo
forall k a. Ord k => [(k, a)] -> Map k a
Map.fromList
([(ChComponentName, ChComponentInfo)]
-> Map ChComponentName ChComponentInfo)
-> [(ChComponentName, ChComponentInfo)]
-> Map ChComponentName ChComponentInfo
forall a b. (a -> b) -> a -> b
$ (ChComponentInfo -> (ChComponentName, ChComponentInfo))
-> [ChComponentInfo] -> [(ChComponentName, ChComponentInfo)]
forall a b. (a -> b) -> [a] -> [b]
map (ChComponentInfo -> ChComponentName
ciComponentName (ChComponentInfo -> ChComponentName)
-> (ChComponentInfo -> ChComponentInfo)
-> ChComponentInfo
-> (ChComponentName, ChComponentInfo)
forall (a :: * -> * -> *) b c c'.
Arrow a =>
a b c -> a b c' -> a b (c, c')
&&& ChComponentInfo -> ChComponentInfo
forall a. a -> a
id)
([ChComponentInfo] -> [(ChComponentName, ChComponentInfo)])
-> [ChComponentInfo] -> [(ChComponentName, ChComponentInfo)]
forall a b. (a -> b) -> a -> b
$ ZipList ChComponentInfo -> [ChComponentInfo]
forall a. ZipList a -> [a]
getZipList
(ZipList ChComponentInfo -> [ChComponentInfo])
-> ZipList ChComponentInfo -> [ChComponentInfo]
forall a b. (a -> b) -> a -> b
$ ChComponentName
-> [String] -> [String] -> ChEntrypoint -> ChComponentInfo
ChComponentInfo
(ChComponentName
-> [String] -> [String] -> ChEntrypoint -> ChComponentInfo)
-> ZipList ChComponentName
-> ZipList
([String] -> [String] -> ChEntrypoint -> ChComponentInfo)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> [ChComponentName] -> ZipList ChComponentName
forall a. [a] -> ZipList a
ZipList [ChComponentName]
comp_name
ZipList ([String] -> [String] -> ChEntrypoint -> ChComponentInfo)
-> ZipList [String]
-> ZipList ([String] -> ChEntrypoint -> ChComponentInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [[String]] -> ZipList [String]
forall a. [a] -> ZipList a
ZipList (((ChComponentName, [String]) -> [String])
-> [(ChComponentName, [String])] -> [[String]]
forall a b. (a -> b) -> [a] -> [b]
map (ChComponentName, [String]) -> [String]
forall a b. (a, b) -> b
snd [(ChComponentName, [String])]
ciGhcOptions)
ZipList ([String] -> ChEntrypoint -> ChComponentInfo)
-> ZipList [String] -> ZipList (ChEntrypoint -> ChComponentInfo)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [[String]] -> ZipList [String]
forall a. [a] -> ZipList a
ZipList (((ChComponentName, [String]) -> [String])
-> [(ChComponentName, [String])] -> [[String]]
forall a b. (a -> b) -> [a] -> [b]
map (ChComponentName, [String]) -> [String]
forall a b. (a, b) -> b
snd [(ChComponentName, [String])]
ciSourceDirs)
ZipList (ChEntrypoint -> ChComponentInfo)
-> ZipList ChEntrypoint -> ZipList ChComponentInfo
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> [ChEntrypoint] -> ZipList ChEntrypoint
forall a. [a] -> ZipList a
ZipList (((ChComponentName, ChEntrypoint) -> ChEntrypoint)
-> [(ChComponentName, ChEntrypoint)] -> [ChEntrypoint]
forall a b. (a -> b) -> [a] -> [b]
map (ChComponentName, ChEntrypoint) -> ChEntrypoint
forall a b. (a, b) -> b
snd [(ChComponentName, ChEntrypoint)]
ciEntrypoints)
Map ChComponentName ChComponentInfo
-> IO (Map ChComponentName ChComponentInfo)
forall (m :: * -> *) a. Monad m => a -> m a
return Map ChComponentName ChComponentInfo
uiComponents
flagName' :: Distribution.PackageDescription.Flag -> String
flagName' :: Flag -> String
flagName' = FlagName -> String
unFlagName (FlagName -> String) -> (Flag -> FlagName) -> Flag -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Flag -> FlagName
flagName
componentsMap :: LocalBuildInfo
-> Verbosity
-> FilePath
-> ( Component
-> ComponentLocalBuildInfo
-> BuildInfo
-> IO a)
-> IO [(ChComponentName, a)]
componentsMap :: LocalBuildInfo
-> Verbosity
-> String
-> (Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a)
-> IO [(ChComponentName, a)]
componentsMap lbi :: LocalBuildInfo
lbi _v :: Verbosity
_v _distdir :: String
_distdir f :: Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a
f = do
let pd :: PackageDescription
pd = LocalBuildInfo -> PackageDescription
localPkgDescr LocalBuildInfo
lbi
IORef [(ChComponentName, a)]
lr <- [(ChComponentName, a)] -> IO (IORef [(ChComponentName, a)])
forall a. a -> IO (IORef a)
newIORef []
PackageDescription
-> LocalBuildInfo
-> (Component -> ComponentLocalBuildInfo -> IO ())
-> IO ()
withAllComponentsInBuildOrder PackageDescription
pd LocalBuildInfo
lbi ((Component -> ComponentLocalBuildInfo -> IO ()) -> IO ())
-> (Component -> ComponentLocalBuildInfo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \c :: Component
c clbi :: ComponentLocalBuildInfo
clbi -> do
let bi :: BuildInfo
bi = Component -> BuildInfo
componentBuildInfo Component
c
name :: ChComponentName
name = ComponentName -> ChComponentName
componentNameToCh (ComponentName -> ChComponentName)
-> ComponentName -> ChComponentName
forall a b. (a -> b) -> a -> b
$ Component -> ComponentName
componentNameFromComponent Component
c
[(ChComponentName, a)]
l' <- IORef [(ChComponentName, a)] -> IO [(ChComponentName, a)]
forall a. IORef a -> IO a
readIORef IORef [(ChComponentName, a)]
lr
a
r <- Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a
f Component
c ComponentLocalBuildInfo
clbi BuildInfo
bi
IORef [(ChComponentName, a)] -> [(ChComponentName, a)] -> IO ()
forall a. IORef a -> a -> IO ()
writeIORef IORef [(ChComponentName, a)]
lr ([(ChComponentName, a)] -> IO ())
-> [(ChComponentName, a)] -> IO ()
forall a b. (a -> b) -> a -> b
$ (ChComponentName
name, a
r) (ChComponentName, a)
-> [(ChComponentName, a)] -> [(ChComponentName, a)]
forall a. a -> [a] -> [a]
: [(ChComponentName, a)]
l'
[(ChComponentName, a)] -> [(ChComponentName, a)]
forall a. [a] -> [a]
reverse ([(ChComponentName, a)] -> [(ChComponentName, a)])
-> IO [(ChComponentName, a)] -> IO [(ChComponentName, a)]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IORef [(ChComponentName, a)] -> IO [(ChComponentName, a)]
forall a. IORef a -> IO a
readIORef IORef [(ChComponentName, a)]
lr
componentOptions'
:: (LocalBuildInfo, Verbosity, FilePath)
-> (LocalBuildInfo -> Verbosity -> GhcOptions -> IO a)
-> (GhcOptions -> GhcOptions)
-> IO [(ChComponentName, a)]
componentOptions' :: (LocalBuildInfo, Verbosity, String)
-> (LocalBuildInfo -> Verbosity -> GhcOptions -> IO a)
-> (GhcOptions -> GhcOptions)
-> IO [(ChComponentName, a)]
componentOptions' (lbi :: LocalBuildInfo
lbi, v :: Verbosity
v, distdir :: String
distdir) rf :: LocalBuildInfo -> Verbosity -> GhcOptions -> IO a
rf f :: GhcOptions -> GhcOptions
f = do
LocalBuildInfo
-> Verbosity
-> String
-> (Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a)
-> IO [(ChComponentName, a)]
forall a.
LocalBuildInfo
-> Verbosity
-> String
-> (Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a)
-> IO [(ChComponentName, a)]
componentsMap LocalBuildInfo
lbi Verbosity
v String
distdir ((Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a)
-> IO [(ChComponentName, a)])
-> (Component -> ComponentLocalBuildInfo -> BuildInfo -> IO a)
-> IO [(ChComponentName, a)]
forall a b. (a -> b) -> a -> b
$ \c :: Component
c clbi :: ComponentLocalBuildInfo
clbi bi :: BuildInfo
bi ->
let
outdir :: String
outdir = LocalBuildInfo -> Component -> String
componentOutDir LocalBuildInfo
lbi Component
c
opts :: GhcOptions
opts = Verbosity
-> LocalBuildInfo
-> BuildInfo
-> ComponentLocalBuildInfo
-> String
-> GhcOptions
componentGhcOptions Verbosity
normal LocalBuildInfo
lbi BuildInfo
bi ComponentLocalBuildInfo
clbi String
outdir
in LocalBuildInfo -> Verbosity -> GhcOptions -> IO a
rf LocalBuildInfo
lbi Verbosity
v (GhcOptions -> IO a) -> GhcOptions -> IO a
forall a b. (a -> b) -> a -> b
$ GhcOptions -> GhcOptions
f GhcOptions
opts
componentOptions :: (LocalBuildInfo, Verbosity, FilePath)
-> (GhcOptions -> GhcOptions)
-> IO [(ChComponentName, [String])]
componentOptions :: (LocalBuildInfo, Verbosity, String)
-> (GhcOptions -> GhcOptions) -> IO [(ChComponentName, [String])]
componentOptions (lbi :: LocalBuildInfo
lbi, v :: Verbosity
v, distdir :: String
distdir) f :: GhcOptions -> GhcOptions
f =
(LocalBuildInfo, Verbosity, String)
-> (LocalBuildInfo -> Verbosity -> GhcOptions -> IO [String])
-> (GhcOptions -> GhcOptions)
-> IO [(ChComponentName, [String])]
forall a.
(LocalBuildInfo, Verbosity, String)
-> (LocalBuildInfo -> Verbosity -> GhcOptions -> IO a)
-> (GhcOptions -> GhcOptions)
-> IO [(ChComponentName, a)]
componentOptions' (LocalBuildInfo
lbi, Verbosity
v, String
distdir) LocalBuildInfo -> Verbosity -> GhcOptions -> IO [String]
renderGhcOptions' GhcOptions -> GhcOptions
f
gmModuleName :: C.ModuleName -> ChModuleName
gmModuleName :: ModuleName -> ChModuleName
gmModuleName = String -> ChModuleName
ChModuleName (String -> ChModuleName)
-> (ModuleName -> String) -> ModuleName -> ChModuleName
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate "." ([String] -> String)
-> (ModuleName -> [String]) -> ModuleName -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ModuleName -> [String]
components
initialBuildStepsForAllComponents
:: FilePath
-> PackageDescription
-> LocalBuildInfo
-> Verbosity
-> IO ()
initialBuildStepsForAllComponents :: String
-> PackageDescription -> LocalBuildInfo -> Verbosity -> IO ()
initialBuildStepsForAllComponents distdir :: String
distdir pd :: PackageDescription
pd lbi :: LocalBuildInfo
lbi v :: Verbosity
v =
String
-> PackageDescription -> LocalBuildInfo -> Verbosity -> IO ()
initialBuildSteps String
distdir PackageDescription
pd LocalBuildInfo
lbi Verbosity
v
#if !CH_MIN_VERSION_Cabal(1,25,0)
unFlagName :: FlagName -> String
unFlagName (FlagName n) = n
#endif
toDataVersion :: Version -> DataVersion.Version
#if CH_MIN_VERSION_Cabal(2,0,0)
toDataVersion :: Version -> Version
toDataVersion v :: Version
v = [Int] -> [String] -> Version
DataVersion.Version (Version -> [Int]
versionNumbers Version
v) []
#else
toDataVersion = id
#endif
componentEntrypoints :: Component -> ChEntrypoint
componentEntrypoints :: Component -> ChEntrypoint
componentEntrypoints (CLib Library {..})
= [ChModuleName] -> [ChModuleName] -> [ChModuleName] -> ChEntrypoint
ChLibEntrypoint
((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName [ModuleName]
exposedModules)
((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName ([ModuleName] -> [ChModuleName]) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> a -> b
$ BuildInfo -> [ModuleName]
otherModules BuildInfo
libBuildInfo)
#if CH_MIN_VERSION_Cabal(2,0,0)
((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName [ModuleName]
signatures)
#else
[]
#endif
#if CH_MIN_VERSION_Cabal(2,0,0)
componentEntrypoints (CFLib (ForeignLib{..}))
= [ChModuleName] -> [ChModuleName] -> [ChModuleName] -> ChEntrypoint
ChLibEntrypoint
[]
((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName ([ModuleName] -> [ChModuleName]) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> a -> b
$ BuildInfo -> [ModuleName]
otherModules BuildInfo
foreignLibBuildInfo)
[]
#endif
componentEntrypoints (CExe Executable {..})
= String -> [ChModuleName] -> ChEntrypoint
ChExeEntrypoint
String
modulePath
((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName ([ModuleName] -> [ChModuleName]) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> a -> b
$ BuildInfo -> [ModuleName]
otherModules BuildInfo
buildInfo)
componentEntrypoints (CTest TestSuite { testInterface :: TestSuite -> TestSuiteInterface
testInterface = TestSuiteExeV10 _ fp :: String
fp, ..})
= String -> [ChModuleName] -> ChEntrypoint
ChExeEntrypoint String
fp ((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName ([ModuleName] -> [ChModuleName]) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> a -> b
$ BuildInfo -> [ModuleName]
otherModules BuildInfo
testBuildInfo)
componentEntrypoints (CTest TestSuite { testInterface :: TestSuite -> TestSuiteInterface
testInterface = TestSuiteLibV09 _ mn :: ModuleName
mn, ..})
= [ChModuleName] -> [ChModuleName] -> [ChModuleName] -> ChEntrypoint
ChLibEntrypoint [ModuleName -> ChModuleName
gmModuleName ModuleName
mn] ((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName ([ModuleName] -> [ChModuleName]) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> a -> b
$ BuildInfo -> [ModuleName]
otherModules BuildInfo
testBuildInfo) []
componentEntrypoints (CTest TestSuite {})
= [ChModuleName] -> [ChModuleName] -> [ChModuleName] -> ChEntrypoint
ChLibEntrypoint [] [] []
componentEntrypoints (CBench Benchmark { benchmarkInterface :: Benchmark -> BenchmarkInterface
benchmarkInterface = BenchmarkExeV10 _ fp :: String
fp, ..})
= String -> [ChModuleName] -> ChEntrypoint
ChExeEntrypoint String
fp ((ModuleName -> ChModuleName) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> [a] -> [b]
map ModuleName -> ChModuleName
gmModuleName ([ModuleName] -> [ChModuleName]) -> [ModuleName] -> [ChModuleName]
forall a b. (a -> b) -> a -> b
$ BuildInfo -> [ModuleName]
otherModules BuildInfo
benchmarkBuildInfo)
componentEntrypoints (CBench Benchmark {})
= [ChModuleName] -> [ChModuleName] -> [ChModuleName] -> ChEntrypoint
ChLibEntrypoint [] [] []
renderGhcOptions' :: LocalBuildInfo
-> Verbosity
-> GhcOptions
-> IO [String]
#if !CH_MIN_VERSION_Cabal(1,20,0)
renderGhcOptions' lbi v opts = do
(ghcProg, _) <- requireProgram v ghcProgram (withPrograms lbi)
let Just ghcVer = programVersion ghcProg
return $ renderGhcOptions ghcVer opts
#elif CH_MIN_VERSION_Cabal(1,20,0) && !CH_MIN_VERSION_Cabal(1,24,0)
renderGhcOptions' lbi _v opts = do
return $ renderGhcOptions (compiler lbi) opts
#else
renderGhcOptions' :: LocalBuildInfo -> Verbosity -> GhcOptions -> IO [String]
renderGhcOptions' lbi :: LocalBuildInfo
lbi _v :: Verbosity
_v opts :: GhcOptions
opts = do
[String] -> IO [String]
forall (m :: * -> *) a. Monad m => a -> m a
return ([String] -> IO [String]) -> [String] -> IO [String]
forall a b. (a -> b) -> a -> b
$ Compiler -> Platform -> GhcOptions -> [String]
renderGhcOptions (LocalBuildInfo -> Compiler
compiler LocalBuildInfo
lbi) (LocalBuildInfo -> Platform
hostPlatform LocalBuildInfo
lbi) GhcOptions
opts
#endif