aboutsummaryrefslogtreecommitdiff
path: root/server/lib/Uplcg/Version.hs
blob: b718a10d176873ccdfdb1c3f5765f0ab1925b703 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{-# LANGUAGE TemplateHaskell #-}
module Uplcg.Version
    ( version
    ) where

import           Control.Monad.Trans (liftIO)
import           Data.Version        (showVersion)
import qualified Language.Haskell.TH as TH
import qualified Paths_uplcg
import           System.Process      (readProcess)

version :: String
version = showVersion Paths_uplcg.version ++ " (" ++
    $(do
        hash <- liftIO $ readProcess "git" ["rev-parse", "HEAD"] ""
        pure . TH.LitE . TH.StringL $ take 8 hash) ++
    ")"