Copyright | (c) Ivan Lazar Miljenovic |
---|---|
License | MIT |
Maintainer | Ivan.Miljenovic@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
- class Tool bt => BuildTool bt where
- class BuildTool bt => NamedTool bt where
- data ToolInformation bt = ToolInformation {
- tool :: !String
- information :: !(Maybe (BuildUsage bt))
- commandToolInformation :: NamedTool bt => GlobalEnv -> proxy bt -> IO (ToolInformation bt)
- data BuildUsage bt = BuildUsage {
- installation :: !(Installed bt)
- usable :: !Bool
- project :: !(Maybe (BuildProject bt))
- data BuildProject bt = BuildProject {
- projectRoot :: !(Tagged bt ProjectRoot)
- artifactsPresent :: !Bool
- commandBuildUsage :: BuildTool bt => GlobalEnv -> IO (Maybe (BuildUsage bt))
- commandBuildProject :: BuildTool bt => Tagged bt CommandPath -> IO (Maybe (BuildProject bt))
- canUseBuildTool :: Maybe (BuildUsage bt) -> Bool
- newtype ProjectRoot = ProjectRoot {}
- newtype ProjectTarget = ProjectTarget {}
- componentName :: Tagged bt ProjectTarget -> String
- safeLast :: [[a]] -> [a]
- splitOn :: Eq a => a -> [a] -> [[a]]
- tryIO :: IO (Maybe a) -> IO (Maybe a)
- recurseUpFindFile :: (FilePath -> Bool) -> IO (Maybe FilePath)
Documentation
class Tool bt => BuildTool bt where Source #
commandProjectRoot, hasBuildArtifacts, commandPrepare, commandTargets, commandBuild, commandRepl, commandClean, commandTest, commandBench, commandExec, commandRun, commandUpdate
canUseCommand :: GlobalEnv -> Installed bt -> IO Bool Source #
Make sure there's nothing in the environment preventing us from using this tool.
For example, a minimum version, need another tool installed, etc.
commandProjectRoot :: Tagged bt CommandPath -> IO (Maybe (Tagged bt ProjectRoot)) Source #
Try and determine the root directory for this project.
hasBuildArtifacts :: Tagged bt ProjectRoot -> IO Bool Source #
commandPrepare :: GlobalEnv -> Tagged bt CommandPath -> IO ExitCode Source #
Ensure's that hasBuildArtifacts
is True
afterwards;
i.e. forces this build tool.
The intent for this is "No build tool is currently being used
(i.e. hasBuildArtifacts
is False
for all) so start using
the one chosen." This will not do the equivalent of stack
init
and create project configuration.
Some manual fiddling is allowed after this.
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandTargets :: Tagged bt CommandPath -> IO [Tagged bt ProjectTarget] Source #
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandBuild :: GlobalEnv -> Tagged bt CommandPath -> Maybe (Tagged bt ProjectTarget) -> IO ExitCode Source #
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandRepl :: GlobalEnv -> Tagged bt CommandPath -> Maybe (Tagged bt ProjectTarget) -> IO ExitCode Source #
Launch a ghci
session within the current project. Should
pass through the -ferror-spans
argument to the underlying
ghci process.
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandClean :: GlobalEnv -> Tagged bt CommandPath -> IO ExitCode Source #
Remove all build artifacts of using this build tool (that is,
afterwards hasBuildArtifacts
should return False
).
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandTest :: GlobalEnv -> Tagged bt CommandPath -> IO ExitCode Source #
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandBench :: GlobalEnv -> Tagged bt CommandPath -> IO ExitCode Source #
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandExec :: GlobalEnv -> Tagged bt CommandPath -> String -> Args -> IO ExitCode Source #
Run an external command within this environment.
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandRun :: GlobalEnv -> Tagged bt CommandPath -> Tagged bt ProjectTarget -> Args -> IO ExitCode Source #
Run an executable component within this environment (building it first if required).
Assumes canUseBuildTool
. Should be run within ProjectRoot
.
commandUpdate :: GlobalEnv -> Tagged bt CommandPath -> IO ExitCode Source #
Update index of available packages.
class BuildTool bt => NamedTool bt where Source #
This class exists because of:
a) Distinguish the different Cabal variants
b) Be able to use a wrapper GADT that takes a proxy bt
and can
be an instance of BuildTool
but not this.
prettyName :: proxy bt -> String Source #
data ToolInformation bt Source #
ToolInformation | |
|
Eq (ToolInformation bt) Source # | |
Read (ToolInformation bt) Source # | |
Show (ToolInformation bt) Source # | |
Show (WrappedTool ToolInformation) # | |
Generic (ToolInformation bt) Source # | |
ToJSON (ToolInformation bt) Source # | |
ToJSON (WrappedTool ToolInformation) # | |
type Rep (ToolInformation bt) Source # | |
commandToolInformation :: NamedTool bt => GlobalEnv -> proxy bt -> IO (ToolInformation bt) Source #
data BuildUsage bt Source #
BuildUsage | |
|
Eq (BuildUsage bt) Source # | |
Read (BuildUsage bt) Source # | |
Show (BuildUsage bt) Source # | |
Generic (BuildUsage bt) Source # | |
ToJSON (BuildUsage bt) Source # | |
type Rep (BuildUsage bt) Source # | |
data BuildProject bt Source #
BuildProject | |
|
Eq (BuildProject bt) Source # | |
Read (BuildProject bt) Source # | |
Show (BuildProject bt) Source # | |
Generic (BuildProject bt) Source # | |
ToJSON (BuildProject bt) Source # | |
type Rep (BuildProject bt) Source # | |
commandBuildUsage :: BuildTool bt => GlobalEnv -> IO (Maybe (BuildUsage bt)) Source #
A Nothing
indicates that this tool cannot be used for this
project (i.e. needs configuration).
commandBuildProject :: BuildTool bt => Tagged bt CommandPath -> IO (Maybe (BuildProject bt)) Source #
canUseBuildTool :: Maybe (BuildUsage bt) -> Bool Source #
newtype ProjectRoot Source #
newtype ProjectTarget Source #
TODO: determine if this is a library, executable, test or benchmark component.
componentName :: Tagged bt ProjectTarget -> String Source #