dyre 0.9.1 → 0.9.2
raw patch · 3 files changed
+43/−10 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +17/−0
- Config/Dyre/Compile.hs +23/−7
- dyre.cabal +3/−3
CHANGELOG.md view
@@ -1,3 +1,20 @@+# 0.9.2++- Support Cabal store in `$XDG_STATE_HOME/cabal/store`, which is the+ default location since cabal-install v3.10.++- Fix Cabal store package-db detection when package name contains+ hyphen characters.++- Recognise `NIX_GHC` environment variable for better support of Nix+ environments. `HC`, if set, takes precedence.++# 0.9.1++- Tell GHC about the Cabal store package DB via the `-package-db`+ option. This fixes compilation with Cabal store-based+ executables.+ # 0.9.0 - `realMain` can now **return arbitrary types**. To support this
Config/Dyre/Compile.hs view
@@ -4,9 +4,11 @@ -} module Config.Dyre.Compile ( customCompile, getErrorPath, getErrorString ) where +import Control.Applicative ((<|>)) import Control.Concurrent ( rtsSupportsBoundThreads ) import Control.Monad (when) import Data.Maybe (fromMaybe)+import Data.List (intercalate) import System.IO ( IOMode(WriteMode), withFile ) import System.Environment (lookupEnv) import System.Exit ( ExitCode(..) )@@ -64,7 +66,9 @@ then return $ Just stackYamlPath else return Nothing - hc <- fromMaybe "ghc" <$> lookupEnv "HC"+ hc' <- lookupEnv "HC"+ nix_ghc <- lookupEnv "NIX_GHC"+ let hc = fromMaybe "ghc" (hc' <|> nix_ghc) ghcProc <- maybe (runProcess hc flags (Just cacheDir') Nothing Nothing Nothing (Just errHandle)) (\stackYaml' -> runProcess "stack" ("ghc" : "--stack-yaml" : stackYaml' : "--" : flags)@@ -122,15 +126,27 @@ getCabalStoreGhcArgs proj = mkArgs . go . fmap dropTrailingPathSeparator . splitPath where go :: [String] -> Maybe (String {- unit-id -}, [String] {- package-db -})- go (".cabal" : "store" : hc : unit : _) =- case splitOn '-' unit of- [s, _, _] | s == proj -> Just (unit, [".cabal", "store", hc, "package.db"])- _ -> Nothing- go (h : t@(_cabal : _store : _hc : _unit : _)) = fmap (h:) <$> go t- go _ = Nothing+ go (dir : "store" : hc : unit : _)+ | dir `elem` [".cabal", "cabal" {- probably under $XDG_STATE_HOME -}]+ , pkgNameFromUnitId unit == Just proj+ = Just (unit, [dir, "store", hc, "package.db"])+ go (h : t@(_cabal : _store : _hc : _unit : _))+ = fmap (h:) <$> go t+ go _+ = Nothing mkArgs Nothing = [] mkArgs (Just (unitId, pkgDb)) = ["-package-db", joinPath pkgDb, "-package-id", unitId]++-- | Extract package name from a unit-id, or return @Nothing@+-- if the input does not look like a unit-id.+--+pkgNameFromUnitId :: String -> Maybe String+pkgNameFromUnitId = fmap (intercalate "-") . go . splitOn '-'+ where+ go [s,_,_] = Just [s] -- drop the version and hash+ go (s:rest) = (s:) <$> go rest+ go [] = Nothing splitOn :: (Eq a) => a -> [a] -> [[a]] splitOn a l = case span (/= a) l of
dyre.cabal view
@@ -1,5 +1,5 @@ name: dyre-version: 0.9.1+version: 0.9.2 category: Development, Configuration synopsis: Dynamic reconfiguration in Haskell @@ -16,13 +16,13 @@ stability: beta author: Will Donnelly maintainer: Fraser Tweedale <frase@frase.id.au>-copyright: (c) 2011-2019 Will Donnelly, Fraser Tweedale+copyright: (c) 2011-2023 Will Donnelly, Fraser Tweedale license: BSD3 license-file: LICENSE build-type: Simple cabal-version: >= 1.10-tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.3 || ==9.0.1+tested-with: GHC ==8.0.2 || ==8.2.2 || ==8.4.4 || ==8.6.5 || ==8.8.4 || ==8.10.7 || ==9.0.2 || ==9.2.7 || ==9.4.5 || ==9.6.1 extra-source-files: CHANGELOG.md