shake-cabal 0.2.0.0 → 0.2.1.0
raw patch · 5 files changed
+67/−13 lines, 5 filesdep +binarydep +deepseqdep +hashablePVP ok
version bump matches the API change (PVP)
Dependencies added: binary, deepseq, hashable
API changes (from Hackage documentation)
+ Development.Shake.Cabal: cabalOracle :: Rules (CabalVersion -> Action String)
+ Development.Shake.Cabal: hsOracle :: (RuleResult q ~ a, q ~ a, ShakeValue q) => Rules (q -> Action a)
Files
- CHANGELOG.md +4/−0
- LICENSE +1/−1
- shake-cabal.cabal +13/−6
- src/Development/Shake/Cabal.hs +4/−6
- src/Development/Shake/Cabal/Oracles.hs +45/−0
CHANGELOG.md view
@@ -1,5 +1,9 @@ # shake-cabal +## 0.2.1.0++ * Add `hsOracle` and `cabalOracle`+ ## 0.2.0.0 * More precise `HsCompiler` type
LICENSE view
@@ -1,4 +1,4 @@-Copyright Vanessa McHale (c) 2018+Copyright Vanessa McHale (c) 2018-2019 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
shake-cabal.cabal view
@@ -1,9 +1,9 @@ cabal-version: 1.18 name: shake-cabal-version: 0.2.0.0+version: 0.2.1.0 license: BSD3 license-file: LICENSE-copyright: Copyright: (c) 2018 Vanessa McHale+copyright: Copyright: (c) 2018-2019 Vanessa McHale maintainer: vanessa.mchale@iohk.io author: Vanessa McHale bug-reports: https://hub.darcs.net/vmchale/ats/issues@@ -29,7 +29,11 @@ exposed-modules: Development.Shake.Cabal hs-source-dirs: src+ other-modules:+ Development.Shake.Cabal.Oracles default-language: Haskell2010+ other-extensions: DeriveAnyClass DeriveGeneric DeriveDataTypeable+ TypeFamilies ghc-options: -Wall build-depends: base >=4.8 && <5,@@ -37,14 +41,17 @@ Cabal >=2.2, directory -any, composition-prelude -any,- filepath -any- + filepath -any,+ deepseq -any,+ hashable -any,+ binary -any+ if flag(development) ghc-options: -Werror- + if impl(ghc >=8.0) ghc-options: -Wincomplete-uni-patterns -Wincomplete-record-updates -Wredundant-constraints -Wnoncanonical-monad-instances- + if impl(ghc >=8.4) ghc-options: -Wmissing-export-lists
src/Development/Shake/Cabal.hs view
@@ -2,6 +2,9 @@ , getCabalDepsV , getCabalDepsA , shakeVerbosityToCabalVerbosity+ -- * Oracles+ , hsOracle+ , cabalOracle -- * Types , HsCompiler (..) -- * Helper functions@@ -19,6 +22,7 @@ import Data.Maybe (catMaybes) import Development.Shake hiding (doesFileExist) import qualified Development.Shake as Shake+import Development.Shake.Cabal.Oracles import Distribution.ModuleName import Distribution.PackageDescription import Distribution.PackageDescription.Parsec@@ -31,12 +35,6 @@ import System.Directory (doesFileExist) import System.FilePath (pathSeparator) import System.Info (arch, os)--data HsCompiler = GHC { _pref :: Maybe String -- ^ Target architecture- , _suff :: Maybe String -- ^ Compiler version- }- | GHCJS { _suff :: Maybe String -- ^ Compiler version- } hsCompiler :: HsCompiler -> String hsCompiler (GHC Nothing Nothing) = "ghc"
+ src/Development/Shake/Cabal/Oracles.hs view
@@ -0,0 +1,45 @@+{-# LANGUAGE DeriveAnyClass #-}+{-# LANGUAGE DeriveDataTypeable #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE TypeFamilies #-}++-- this is in a separate module because the TypeFamilies extension apparently+-- causes previously valid code to not typecheck... ok+module Development.Shake.Cabal.Oracles ( hsOracle+ , cabalOracle+ , HsCompiler (..)+ ) where++import Control.DeepSeq (NFData)+import Data.Binary (Binary)+import Data.Hashable (Hashable)+import Data.Typeable (Typeable)+import Development.Shake+import GHC.Generics (Generic)++-- | Use this for tracking 'HsCompiler'+--+-- @since 0.2.1.0+hsOracle :: (RuleResult q ~ a, q ~ a, ShakeValue q) => Rules (q -> Action a)+hsOracle = addOracle pure++-- | Use this to track the version of cabal globally available+--+-- @since 0.2.1.0+cabalOracle :: Rules (CabalVersion -> Action String)+cabalOracle = addOracle $ \CabalVersion -> do+ (Stdout out) <- command [] "cabal" [ "--numeric-version"]+ pure out++data HsCompiler = GHC { _pref :: Maybe String -- ^ Target architecture+ , _suff :: Maybe String -- ^ Compiler version+ }+ | GHCJS { _suff :: Maybe String -- ^ Compiler version+ }+ deriving (Generic, Show, Eq, NFData, Hashable, Binary, Typeable)++data CabalVersion = CabalVersion+ deriving (Generic, Show, Typeable, Eq, Hashable, Binary, NFData)++type instance RuleResult HsCompiler = HsCompiler+type instance RuleResult CabalVersion = String