Skip to content

Commit aa47f49

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 aa47f49

File tree

4 files changed

+40
-1
lines changed

4 files changed

+40
-1
lines changed

cabal-install/cabal-install.cabal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ library
132132
Distribution.Client.Compat.Orphans
133133
Distribution.Client.Compat.Prelude
134134
Distribution.Client.Compat.Semaphore
135+
Distribution.Client.Compat.SysInfo
135136
Distribution.Client.Compat.Tar
136137
Distribution.Client.Config
137138
Distribution.Client.Configure
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{-# LANGUAGE CPP #-}
2+
3+
module Distribution.Compat.SysInfo
4+
( fullCompilerVersion
5+
) where
6+
7+
import Data.Version
8+
import qualified System.Info as SI
9+
10+
fullCompilerVersion :: Version
11+
#if MIN_VERSION_base(4,15,0)
12+
fullCompilerVersion = SI.fullCompilerVersion
13+
#else
14+
fullCompilerVersion = SI.compilerVersion
15+
#endif

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ import Distribution.Client.Utils
170170
, relaxEncodingErrors
171171
)
172172
import Distribution.Client.Version
173-
( cabalInstallGitInfo
173+
( cabalInstallCompilerInfo
174+
, cabalInstallGitInfo
174175
, cabalInstallVersion
175176
)
176177

@@ -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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@
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
1215
import Distribution.Version
16+
import qualified System.Info as SI
17+
import qualified Distribution.Client.Compat.SysInfo as SIC
1318

1419
import qualified Paths_cabal_install as PackageInfo
1520

@@ -28,6 +33,21 @@ import GitHash
2833
cabalInstallVersion :: Version
2934
cabalInstallVersion = mkVersion' PackageInfo.version
3035

36+
{- FOURMOLU_DISABLE -}
37+
-- |
38+
-- `cabal-install` compiler information.
39+
cabalInstallCompilerInfo :: String
40+
cabalInstallCompilerInfo = let ci = SIC.fullCompilerVersion
41+
in concat [ SI.compilerName
42+
, " "
43+
, intercalate "." (map show (DV.versionBranch ci))
44+
, " on "
45+
, SI.os
46+
, " "
47+
, SI.arch
48+
]
49+
{- FOURMOLU_ENABLE -}
50+
3151
-- |
3252
-- `cabal-install` Git information. Only filled in if built in a Git tree in
3353
-- developmnent mode and Template Haskell is available.

0 commit comments

Comments
 (0)