Skip to content

Commit

Permalink
Merge pull request #3769 from arybczak/extended-hash
Browse files Browse the repository at this point in the history
Include program args in PackageHash
  • Loading branch information
dcoutts authored Sep 3, 2016
2 parents 4c909d8 + 9fbd686 commit 15dbcaf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cabal-install/Distribution/Client/PackageHash.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ import qualified Crypto.Hash.SHA256 as SHA256
import qualified Data.ByteString.Base16 as Base16
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as LBS
import qualified Data.Map as Map
import qualified Data.Set as Set
import Data.Set (Set)

import Data.Maybe (catMaybes)
import Data.List (sortBy, intercalate)
import Data.Map (Map)
import Data.Function (on)
import Distribution.Compat.Binary (Binary(..))
import Control.Exception (evaluate)
Expand Down Expand Up @@ -164,13 +166,13 @@ data PackageHashConfigInputs = PackageHashConfigInputs {
pkgHashStripLibs :: Bool,
pkgHashStripExes :: Bool,
pkgHashDebugInfo :: DebugInfoLevel,
pkgHashProgramArgs :: Map String [String],
pkgHashExtraLibDirs :: [FilePath],
pkgHashExtraFrameworkDirs :: [FilePath],
pkgHashExtraIncludeDirs :: [FilePath],
pkgHashProgPrefix :: Maybe PathTemplate,
pkgHashProgSuffix :: Maybe PathTemplate

-- TODO: [required eventually] extra program options
-- TODO: [required eventually] pkgHashToolsVersions ?
-- TODO: [required eventually] pkgHashToolsExtraOptions ?
-- TODO: [research required] and what about docs?
Expand Down Expand Up @@ -210,7 +212,7 @@ renderPackageHashInputs PackageHashInputs{
--TODO: [nice to have] ultimately we probably want to put this config info
-- into the ghc-pkg db. At that point this should probably be changed to
-- use the config file infrastructure so it can be read back in again.
LBS.pack $ unlines $ catMaybes
LBS.pack $ unlines $ catMaybes $
[ entry "pkgid" display pkgHashPkgId
, mentry "component" show pkgHashComponent
, entry "src" showHashValue pkgHashSourceHash
Expand Down Expand Up @@ -240,7 +242,7 @@ renderPackageHashInputs PackageHashInputs{
, opt "extra-include-dirs" [] unwords pkgHashExtraIncludeDirs
, opt "prog-prefix" Nothing (maybe "" fromPathTemplate) pkgHashProgPrefix
, opt "prog-suffix" Nothing (maybe "" fromPathTemplate) pkgHashProgSuffix
]
] ++ Map.foldrWithKey (\prog args acc -> opt (prog ++ "-options") [] unwords args : acc) [] pkgHashProgramArgs
where
entry key format value = Just (key ++ ": " ++ format value)
mentry key format value = fmap (\v -> key ++ ": " ++ format v) value
Expand Down
1 change: 1 addition & 0 deletions cabal-install/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2570,6 +2570,7 @@ packageHashConfigInputs
pkgHashStripLibs = elabStripLibs,
pkgHashStripExes = elabStripExes,
pkgHashDebugInfo = elabDebugInfo,
pkgHashProgramArgs = elabProgramArgs,
pkgHashExtraLibDirs = elabExtraLibDirs,
pkgHashExtraFrameworkDirs = elabExtraFrameworkDirs,
pkgHashExtraIncludeDirs = elabExtraIncludeDirs,
Expand Down

0 comments on commit 15dbcaf

Please sign in to comment.