Skip to content

Commit fe384e3

Browse files
committed
add compiler info to --version
I'm not sure if this counts as a significant change or not, since it's possible scripts depend on the output. (The git info change doesn't really count, since it's only operable on unreleased versions.)
1 parent a11e104 commit fe384e3

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

cabal-install/src/Distribution/Client/Main.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ import Distribution.Client.Utils
172172
import Distribution.Client.Version
173173
( cabalInstallGitInfo
174174
, cabalInstallVersion
175+
, cabalInstallCompilerInfo
175176
)
176177

177178
import Distribution.Package (packageId)
@@ -424,6 +425,8 @@ mainWorker args = do
424425
++ display cabalVersion
425426
++ " of the Cabal library "
426427
++ cabalGitInfo'
428+
++ "\nwith "
429+
++ cabalInstallCompilerInfo
427430
where
428431
cabalGitInfo'
429432
| cabalGitInfo == cabalInstallGitInfo = "(in-tree)"

cabal-install/src/Distribution/Client/Version.hs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
module Distribution.Client.Version
88
( cabalInstallVersion
99
, cabalInstallGitInfo
10+
, cabalInstallCompilerInfo
1011
) where
1112

13+
import Data.List (intercalate)
14+
import qualified Data.Version as DV
15+
import qualified System.Info as SI
1216
import Distribution.Version
1317

1418
import qualified Paths_cabal_install as PackageInfo
@@ -28,9 +32,27 @@ import GitHash
2832
cabalInstallVersion :: Version
2933
cabalInstallVersion = mkVersion' PackageInfo.version
3034

35+
-- |
36+
-- `cabal-install` compiler information.
37+
cabalInstallCompilerInfo :: String
38+
cabalInstallCompilerInfo = let ci =
39+
#if MIN_VERSION_base(4,15,0)
40+
SI.fullCompilerVersion
41+
#else
42+
SI.compilerVersion
43+
#endif
44+
in concat [ SI.compilerName
45+
, " "
46+
, intercalate "." (map show (DV.versionBranch ci))
47+
, " on "
48+
, SI.os
49+
, " "
50+
, SI.arch
51+
]
52+
3153
-- |
3254
-- `cabal-install` Git information. Only filled in if built in a Git tree in
33-
-- developmnent mode and Template Haskell is available.
55+
-- development mode and Template Haskell is available.
3456
cabalInstallGitInfo :: String
3557
#ifdef GIT_REV
3658
cabalInstallGitInfo = if giHash' == ""

0 commit comments

Comments
 (0)