dib 0.7.0 → 0.7.1
raw patch · 6 files changed
+16/−20 lines, 6 filesdep ~base
Dependency ranges changed: base
Files
- Main.hs +1/−1
- dib.cabal +4/−4
- src/Dib.hs +7/−9
- src/Dib/Builders/C.hs +1/−2
- src/Dib/Builders/Simple.hs +0/−1
- src/Dib/Types.hs +3/−3
Main.hs view
@@ -156,7 +156,7 @@ return "" processExitCode :: ExitCode -> IO ()-processExitCode (ExitSuccess) = return ()+processExitCode ExitSuccess = return () processExitCode (ExitFailure n) = error $ "Error " ++ show n ++ " building dib.hs." rebuild :: Bool -> IO ()
dib.cabal view
@@ -1,5 +1,5 @@ name: dib-version: 0.7.0+version: 0.7.1 cabal-version: >= 1.6 category: Development build-type: Simple@@ -17,17 +17,17 @@ source-repository this type: git location: https://github.com/blajzer/dib.git- tag: 0.7.0+ tag: 0.7.1 library- build-depends: base >= 4.4 && < 4.10, text, containers, mtl, directory, time, process, filepath, cereal, bytestring, digest+ build-depends: base >= 4.4 && < 4.11, text, containers, mtl, directory, time, process, filepath, cereal, bytestring, digest ghc-options: -Wall hs-source-dirs: src exposed-modules: Dib, Dib.Gatherers, Dib.Stage, Dib.Target, Dib.Types, Dib.Scanners.CDepScanner, Dib.Builders.C, Dib.Builders.Copy, Dib.Builders.Simple, Dib.Util extensions: OverloadedStrings executable dib- build-depends: base >= 4.4 && < 4.10, containers, mtl, time, directory, filepath+ build-depends: base >= 4.4 && < 4.11, containers, mtl, time, directory, filepath ghc-options: -Wall hs-source-dirs: . main-is: Main.hs
src/Dib.hs view
@@ -135,17 +135,18 @@ numProcs <- GHC.getNumProcessors -- Validate that we have at least one target- if targets == [] then putStrLn $ "ERROR: Invalid configuration, no targets defined." else do+ if null targets then putStrLn "ERROR: Invalid configuration, no targets defined." else do let allTargets = gatherAllTargets targets- let buildArgs = parseArgs args allTargets numProcs- let selectedTarget = buildTarget buildArgs- let theTarget = L.find (\(Target name _ _ _ _) -> name == selectedTarget) allTargets -- Validate targets let targetErrors = validateTargets allTargets if isJust targetErrors then putStrLn $ "ERROR: Invalid targets:\n" ++ fromJust targetErrors else do + let buildArgs = parseArgs args allTargets numProcs+ let selectedTarget = buildTarget buildArgs+ let theTarget = L.find (\(Target name _ _ _ _) -> name == selectedTarget) allTargets+ -- Validate that we're trying to build something that exists if isNothing theTarget then putStrLn $ "ERROR: Invalid target specified: \"" ++ T.unpack selectedTarget ++ "\"" else do @@ -183,7 +184,7 @@ validateTargets :: [Target] -> Maybe String validateTargets ts = let targetErrors = L.foldl' (\acc t -> acc ++ validate t) "" ts- validate (Target name _ _ stages gatherers) = if length stages > 0 && length gatherers == 0 then (T.unpack name) ++ ": target requires at least one gatherer since it specifies at least one stage.\n" else ""+ validate (Target name _ _ stages gatherers) = if not (null stages) && null gatherers then T.unpack name ++ ": target requires at least one gatherer since it specifies at least one stage.\n" else "" in if targetErrors == "" then Nothing else Just targetErrors extractVarsFromArgs :: [String] -> ArgDict@@ -232,10 +233,7 @@ makeArgDictLookupFuncChecked arg defVal validValues dict = let partialResult = makeArgDictLookupFunc arg defVal dict result = L.find (== partialResult) validValues- in if isJust result then- Right $ fromJust result- else- Left $ "ERROR: invalid value \"" ++ partialResult ++ "\" for argument \"" ++ arg ++ "\". Expected one of: [" ++ L.intercalate ", " validValues ++ "]"+ in maybe (Left $ "ERROR: invalid value \"" ++ partialResult ++ "\" for argument \"" ++ arg ++ "\". Expected one of: [" ++ L.intercalate ", " validValues ++ "]") Right result printSeparator :: IO () printSeparator = putStrLn "============================================================"
src/Dib/Builders/C.hs view
@@ -25,7 +25,6 @@ import Data.Word import System.Process (system) import System.Directory as D-import System.Exit import System.FilePath as F import qualified Data.Digest.CRC32 as Hash@@ -246,7 +245,7 @@ in Target (targetName info) (cTargetHash info) [] [cppStage, if staticLibrary info then archiveStage else linkStage] [buildDirGatherer, makeFileTreeGatherer (srcDir info) (matchExtensionsExcluded [".cpp", ".c"] [excludeFiles $ exclusions info])] changeExt :: T.Text -> BuildLocation -> SrcTransform -> SrcTransform-changeExt newExt b (OneToOne l _) = OneToOne l $ remapObjFile b $ (T.dropWhileEnd (/='.') l) <> newExt+changeExt newExt b (OneToOne l _) = OneToOne l $ remapObjFile b $ T.dropWhileEnd (/='.') l <> newExt changeExt _ _ _ = undefined combineTransforms :: T.Text -> [SrcTransform] -> [SrcTransform]
src/Dib/Builders/Simple.hs view
@@ -15,7 +15,6 @@ import qualified Data.Text as T import qualified System.Directory as D import System.Process (system)-import System.Exit import System.FilePath as P buildFunc :: (String -> String -> String) -> SrcTransform -> IO StageResult
src/Dib/Types.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE GeneralizedNewtypeDeriving, ExistentialQuantification, OverloadedStrings #-}+{-# LANGUAGE GeneralizedNewtypeDeriving, ExistentialQuantification #-} {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_HADDOCK hide, prune #-} @@ -117,7 +117,7 @@ type FilterFunc = (T.Text -> Bool) -- | 'Gatherer' that will return exactly one file.-data SingleFileGatherer = SingleFileGatherer T.Text+newtype SingleFileGatherer = SingleFileGatherer T.Text -- | 'Gatherer' that will return all files in a given directory (but not its -- subdirectories) that pass the filter.@@ -129,7 +129,7 @@ -- | 'Gatherer' that will run a command and return an empty list. -- Useful for making clean 'Target's. Use sparingly.-data CommandGatherer = CommandGatherer (IO ())+newtype CommandGatherer = CommandGatherer (IO ()) -- Horrible. instance Serialize.Serialize T.Text where