packages feed

shake-ext 1.5.0.0 → 2.0.0.0

raw patch · 3 files changed

+42/−2 lines, 3 filesdep +CabalPVP ok

version bump matches the API change (PVP)

Dependencies added: Cabal

API changes (from Hackage documentation)

+ Development.Shake.Cabal: getCabalDeps :: FilePath -> IO [FilePath]

Files

shake-ext.cabal view
@@ -1,7 +1,7 @@ name:                shake-ext-version:             1.5.0.0+version:             2.0.0.0 synopsis:            Helper functions for linting with shake -description:         This package provides several linters out of the box, as well as functionality for building ATS source files with [shake](http://shakebuild.com/).+description:         This package provides several linters out of the box, for use with [shake](http://shakebuild.com/). homepage:            https://hub.darcs.net/vmchale/shake-ext license:             BSD3 license-file:        LICENSE@@ -26,6 +26,7 @@                      , Development.Shake.Man                      , Development.Shake.Check                      , Development.Shake.Clean+                     , Development.Shake.Cabal   build-depends:       base >= 4.10 && < 5                      , shake                      , language-ats >= 0.1.1.3@@ -33,6 +34,7 @@                      , composition-prelude                      , directory                      , text+                     , Cabal >= 2.0   default-language:    Haskell2010   if flag(development)     ghc-options:       -Werror
+ src/Development/Shake/Cabal.hs view
@@ -0,0 +1,36 @@+module Development.Shake.Cabal ( getCabalDeps+                               ) where++import           Control.Arrow+import           Control.Monad+import           Data.Foldable                         (toList)+import           Data.Maybe                            (catMaybes)+import           Data.Semigroup+import           Distribution.ModuleName+import           Distribution.PackageDescription+import           Distribution.PackageDescription.Parse+import           Distribution.Types.CondTree+import           Distribution.Verbosity++libraryToFiles :: Library -> [FilePath]+libraryToFiles lib = cs <> is <> (toFilePath <$> explicitLibModules lib)+    where (cs, is) = (cSources &&& includes) $ libBuildInfo lib++extract :: CondTree a b Library -> [Library]+extract (CondNode d _ []) = [d]+extract (CondNode d _ bs) = d : (g =<< bs)+    where g (CondBranch _ tb fb) = join $ catMaybes [Just $ extract tb, extract <$> fb]++-- | Get library dependencies from a @.cabal@ file.+getCabalDeps :: FilePath -> IO [FilePath]+getCabalDeps = getCabalDepsV normal++-- | Same as above, but we set the 'Verbosity' to be used during parsing.+getCabalDepsV :: Verbosity -> FilePath -> IO [FilePath]+getCabalDepsV v p = do+    contents <- readFile p+    pkg <- readGenericPackageDescription v contents+    let extraSrc = extraSrcFiles $ packageDescription pkg+        libs = toList (condLibrary pkg)+        normalSrc = (libraryToFiles <=< extract) =<< libs+    pure (extraSrc <> normalSrc)
src/Development/Shake/Linters.hs view
@@ -21,6 +21,8 @@ dhall :: Action () dhall = mapM_ checkDhall =<< getDhall +-- TODO @cabal format@.+ checkDhall :: FilePath -> Action () checkDhall dh = do     contents <- liftIO $ readFile dh