From f627caa3925b9fde2f884a0c7857e620992c37b4 Mon Sep 17 00:00:00 2001 From: Jake Keuhlen Date: Thu, 9 Oct 2025 14:36:58 -0600 Subject: [PATCH 1/2] Include HIE version in -v output --- app/App/Arguments.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/App/Arguments.hs b/app/App/Arguments.hs index 80a54098..ebe32a53 100644 --- a/app/App/Arguments.hs +++ b/app/App/Arguments.hs @@ -1,4 +1,5 @@ {-# LANGUAGE ApplicativeDo #-} +{-# LANGUAGE CPP #-} module App.Arguments ( execArgParser, @@ -20,6 +21,20 @@ import Text.Read currVersion :: String currVersion = showVersion version +hieBuiltVersion :: String +hieBuiltVersion = +#ifdef __GLASGOW_HASKELL__ + let ghcInt = (__GLASGOW_HASKELL__ :: Int) +# ifdef __GLASGOW_HASKELL_PATCHLEVEL1__ + patch = (__GLASGOW_HASKELL_PATCHLEVEL1__ :: Int) +# else + patch = (0 :: Int) +# endif + in show (ghcInt * 10 + patch) +#else + "unknown" +#endif + data PrgOptions = StaticLsOptions { staticEnvOpts :: StaticEnvOptions @@ -46,6 +61,7 @@ handleParseResultWithSuppression defaultOpts res = case res of Success (StaticLsOptions {showVer = True}) -> do -- Show version info putStrLn $ "static-ls, version " <> currVersion + putStrLn $ "hie version " <> hieBuiltVersion exitSuccess Success a -> return a.staticEnvOpts -- Ignore if invalid arguments are input @@ -85,7 +101,7 @@ argParser defaultOpts = True ( long "version" <> short 'v' - <> help "Show the program version" + <> help "Show the program version and HIE version" ) <*> flag False From ae0934baa8846f141477cc4613663a284883925c Mon Sep 17 00:00:00 2001 From: Jake Keuhlen Date: Thu, 9 Oct 2025 15:03:39 -0600 Subject: [PATCH 2/2] switch to grabbing hieVersion from the ghc utils --- app/App/Arguments.hs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/app/App/Arguments.hs b/app/App/Arguments.hs index ebe32a53..f79d6103 100644 --- a/app/App/Arguments.hs +++ b/app/App/Arguments.hs @@ -1,5 +1,4 @@ {-# LANGUAGE ApplicativeDo #-} -{-# LANGUAGE CPP #-} module App.Arguments ( execArgParser, @@ -10,6 +9,7 @@ module App.Arguments ( import Control.Applicative import Data.Maybe import Data.Version (showVersion) +import GHC.Iface.Ext.Types qualified as GHC import Options.Applicative import Paths_static_ls (version) import StaticLS.StaticEnv.Options @@ -22,18 +22,7 @@ currVersion :: String currVersion = showVersion version hieBuiltVersion :: String -hieBuiltVersion = -#ifdef __GLASGOW_HASKELL__ - let ghcInt = (__GLASGOW_HASKELL__ :: Int) -# ifdef __GLASGOW_HASKELL_PATCHLEVEL1__ - patch = (__GLASGOW_HASKELL_PATCHLEVEL1__ :: Int) -# else - patch = (0 :: Int) -# endif - in show (ghcInt * 10 + patch) -#else - "unknown" -#endif +hieBuiltVersion = show GHC.hieVersion data PrgOptions = StaticLsOptions