Skip to content

Commit f681cee

Browse files
authored
Merge pull request #157 from phadej/pui-bug
Fix Project Unit Id bug for GHC-9.6 and older
2 parents 1a522d9 + 2fc40b4 commit f681cee

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

cabal-docspec/Changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 0.0.0.20240703
2+
3+
- Fix "Project Unit Id" bug
4+
15
# 0.0.0.20240702
26

37
- Support `cabal-install-3.12` changed store directory logic

cabal-docspec/cabal-docspec.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.2
22
name: cabal-docspec
3-
version: 0.0.0.20240702
3+
version: 0.0.0.20240703
44
synopsis: Run examples in your docs
55
category: Development
66
description:

peura/src/Peura/GHC.hs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,14 @@ getGhcInfo tracer ghc = do
8787
lookup "LibDir" info
8888
libDir <- makeAbsoluteFilePath libDirStr
8989

90-
let pui :: String
91-
pui = fromMaybe "" $ lookup "Project Unit Id" info
92-
93-
let prefix = "ghc-" ++ prettyShow ver ++ "-"
94-
unless (L.isPrefixOf prefix pui) $
95-
die tracer $ prefix ++ " is not prefix of Project Unit Id: " ++ pui
90+
pui <- case lookup "Project Unit Id" info of
91+
Nothing -> return ""
92+
Just pui -> do
93+
let prefix = "ghc-" ++ prettyShow ver ++ "-"
94+
unless (L.isPrefixOf prefix pui) $
95+
die tracer $ prefix ++ " is not prefix of Project Unit Id: " ++ pui
96+
97+
return pui
9698

9799
return GhcInfo
98100
{ ghcPath = ghc

0 commit comments

Comments
 (0)