diff --git a/semantic.cabal b/semantic.cabal index b3d7abcff..42b6c8ed4 100644 --- a/semantic.cabal +++ b/semantic.cabal @@ -287,7 +287,7 @@ library , StrictData , TypeApplications if flag(release) - ghc-options: -Wall -Werror -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -O1 -j + ghc-options: -Wall -Werror -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -O1 -j -DCOMPUTE_GIT_SHA else ghc-options: -Wall -Wmissing-export-lists -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-name-shadowing -O0 -j ghc-prof-options: -fprof-auto @@ -296,7 +296,7 @@ executable semantic hs-source-dirs: app main-is: Main.hs if flag(release) - ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O1 -j + ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O1 -j -DCOMPUTE_GIT_SHA else ghc-options: -threaded -rtsopts "-with-rtsopts=-N -A4m -n2m" -static -j -O0 -j cc-options: -DU_STATIC_IMPLEMENTATION=1 diff --git a/src/Semantic/Version.hs b/src/Semantic/Version.hs index 782cbc1f8..bba60272e 100644 --- a/src/Semantic/Version.hs +++ b/src/Semantic/Version.hs @@ -1,4 +1,7 @@ +{-# LANGUAGE CPP #-} +#ifdef COMPUTE_GIT_SHA {-# OPTIONS_GHC -fforce-recomp #-} -- So that gitHash is correct. +#endif {-# LANGUAGE TemplateHaskell #-} module Semantic.Version ( buildSHA @@ -6,12 +9,19 @@ module Semantic.Version ) where import Data.Version (showVersion) +#ifdef COMPUTE_GIT_SHA import Development.GitRev +#endif import Paths_semantic (version) -- The SHA1 hash of this build of semantic. +-- If compiled as a development build, this will be all zeroes. buildSHA :: String +#ifdef COMPUTE_GIT_SHA buildSHA = $(gitHash) +#else +buildSHA = "" +#endif -- The version string of this build of semantic. buildVersion :: String