{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE Trustworthy #-}
module Futhark.Version
( version,
versionString,
)
where
import Data.Version
import Development.GitRev
import qualified Paths_futhark
version :: Version
version :: Version
version = Version
Paths_futhark.version
versionString :: String
versionString :: [Char]
versionString =
Version -> [Char]
showVersion Version
version
[Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ if [Char]
used_hash [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
/= [Char]
"UNKNOWN"
then [Char]
"\n" [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
gitversion
else [Char]
""
where
used_hash :: [Char]
used_hash = Int -> [Char] -> [Char]
forall a. Int -> [a] -> [a]
take Int
7 $(gitHash)
gitversion :: [Char]
gitversion =
[[Char]] -> [Char]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat
[ [Char]
"git: ",
[Char]
branch,
[Char]
used_hash,
[Char]
" (",
$(gitCommitDate),
[Char]
")",
[Char]
dirty
]
branch :: [Char]
branch
| $(gitBranch) [Char] -> [Char] -> Bool
forall a. Eq a => a -> a -> Bool
== [Char]
"master" = [Char]
""
| Bool
otherwise = $(gitBranch) [Char] -> [Char] -> [Char]
forall a. [a] -> [a] -> [a]
++ [Char]
" @ "
dirty :: [Char]
dirty = if $(gitDirtyTracked) then [Char]
" [modified]" else [Char]
""