-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`cabal --version` in such builds will include the Git commit and branch (if not `master`).
- Loading branch information
Showing
7 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,51 @@ | ||
{-# LANGUAGE CPP #-} | ||
#ifdef GIT_REV | ||
{-# LANGUAGE TemplateHaskell #-} | ||
#endif | ||
|
||
-- | Provides the version number of @cabal-install@. | ||
module Distribution.Client.Version | ||
( cabalInstallVersion | ||
, cabalInstallGitInfo | ||
) where | ||
|
||
import Distribution.Version | ||
|
||
import qualified Paths_cabal_install as PackageInfo | ||
|
||
#ifdef GIT_REV | ||
import Data.Either (isLeft) | ||
import GitHash | ||
( giHash | ||
, giBranch | ||
, giCommitDate | ||
, tGitInfoCwdTry | ||
) | ||
#endif | ||
|
||
-- | | ||
-- This value determines the output of `cabal-install --version`. | ||
cabalInstallVersion :: Version | ||
cabalInstallVersion = mkVersion' PackageInfo.version | ||
|
||
-- | | ||
-- `cabal-install` Git information. Only filled in if built in a Git tree in | ||
-- developmnent mode and Template Haskell is available. | ||
cabalInstallGitInfo :: String | ||
#ifdef GIT_REV | ||
cabalInstallGitInfo = concat [ "(commit " | ||
, giHash' | ||
, branchInfo | ||
, ", " | ||
, either (const "") giCommitDate gi' | ||
, ")" | ||
] | ||
where | ||
gi' = $$tGitInfoCwdTry | ||
giHash' = take 7 . either (const "") giHash $ gi' | ||
branchInfo | isLeft gi' = "" | ||
| either id giBranch gi' == "master" = "" | ||
| otherwise = " on " <> either id giBranch gi' | ||
#else | ||
cabalInstallGitInfo = "" | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters