Skip to content

Commit

Permalink
Merge pull request #157 from phadej/pui-bug
Browse files Browse the repository at this point in the history
Fix Project Unit Id bug for GHC-9.6 and older
  • Loading branch information
phadej authored Jul 2, 2024
2 parents 1a522d9 + 2fc40b4 commit f681cee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 4 additions & 0 deletions cabal-docspec/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.0.0.20240703

- Fix "Project Unit Id" bug

# 0.0.0.20240702

- Support `cabal-install-3.12` changed store directory logic
Expand Down
2 changes: 1 addition & 1 deletion cabal-docspec/cabal-docspec.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.2
name: cabal-docspec
version: 0.0.0.20240702
version: 0.0.0.20240703
synopsis: Run examples in your docs
category: Development
description:
Expand Down
14 changes: 8 additions & 6 deletions peura/src/Peura/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,14 @@ getGhcInfo tracer ghc = do
lookup "LibDir" info
libDir <- makeAbsoluteFilePath libDirStr

let pui :: String
pui = fromMaybe "" $ lookup "Project Unit Id" info

let prefix = "ghc-" ++ prettyShow ver ++ "-"
unless (L.isPrefixOf prefix pui) $
die tracer $ prefix ++ " is not prefix of Project Unit Id: " ++ pui
pui <- case lookup "Project Unit Id" info of
Nothing -> return ""
Just pui -> do
let prefix = "ghc-" ++ prettyShow ver ++ "-"
unless (L.isPrefixOf prefix pui) $
die tracer $ prefix ++ " is not prefix of Project Unit Id: " ++ pui

return pui

return GhcInfo
{ ghcPath = ghc
Expand Down

0 comments on commit f681cee

Please sign in to comment.