{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module Bcc.Config.Git.Rev (
gitRev
) where
import Bcc.Prelude
import Data.FileEmbed (dummySpaceWith)
import qualified Data.Text as T
import Bcc.Config.Git.RevFromGit (gitRevFromGit)
gitRev :: Text
gitRev :: Text
gitRev | Text
gitRevEmbed Text -> Text -> Bool
forall a. Eq a => a -> a -> Bool
/= Text
zeroRev = Text
gitRevEmbed
| Text -> Bool
T.null Text
fromGit = Text
zeroRev
| Bool
otherwise = Text
fromGit
where
gitRevEmbed :: Text
gitRevEmbed :: Text
gitRevEmbed = ByteString -> Text
decodeUtf8 $(dummySpaceWith "gitrev" 40)
#if defined(arm_HOST_ARCH)
fromGit = ""
#else
fromGit :: Text
fromGit = Text -> Text
T.strip (String -> Text
T.pack $(String
gitRevFromGit))
#endif
zeroRev :: Text
zeroRev :: Text
zeroRev = Text
"0000000000000000000000000000000000000000"