diff options
author | Joey Hess <id@joeyh.name> | 2013-05-10 15:36:31 -0500 |
---|---|---|
committer | Joey Hess <id@joeyh.name> | 2013-05-10 15:36:31 -0500 |
commit | ccce4b0ded18c6eecea5d666f38f55a4fc6a1977 (patch) | |
tree | e7299280f565787f9acdd7b5a36147ff2cd1344b /Build | |
parent | 220076c0ea1ddb5e51e50a1765b6bf7029ef9f11 (diff) |
only update version in cabal file on release builds
This was being very annoying in windows.
Diffstat (limited to 'Build')
-rwxr-xr-x | Build/Configure.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Build/Configure.hs b/Build/Configure.hs index 478869582..b694559a8 100755 --- a/Build/Configure.hs +++ b/Build/Configure.hs @@ -9,6 +9,7 @@ import Control.Applicative import System.FilePath import System.Environment import Data.Maybe +import Control.Monad.IfElse import Build.TestConfig import Utility.SafeCommand @@ -81,19 +82,21 @@ testCp k option = TestCase cmd $ testCmd k cmdline cmd = "cp " ++ option cmdline = cmd ++ " " ++ testFile ++ " " ++ testFile ++ ".new" +{- For release builds, VERSION_FROM_CHANGELOG makes it use just the most + - recent version from the changelog. -} +isReleaseBuild :: IO Bool +isReleaseBuild = isJust <$> catchMaybeIO (getEnv "VERSION_FROM_CHANGELOG") + {- Version is usually based on the major version from the changelog, - plus the date of the last commit, plus the git rev of that commit. - This works for autobuilds, ad-hoc builds, etc. - - - For official builds, VERSION_FROM_CHANGELOG makes it use just the most - - recent version from the changelog. - - - If git or a git repo is not available, or something goes wrong, - just use the version from the changelog. -} getVersion :: Test getVersion = do changelogversion <- getChangelogVersion - version <- ifM (isJust <$> catchMaybeIO (getEnv "VERSION_FROM_CHANGELOG")) + version <- ifM (isReleaseBuild) ( return changelogversion , catchDefaultIO changelogversion $ do let major = takeWhile (/= '.') changelogversion @@ -160,7 +163,8 @@ run ts = do then writeSysConfig $ androidConfig config else writeSysConfig config cleanup - cabalSetup + whenM (isReleaseBuild) $ + cabalSetup {- Hard codes some settings to cross-compile for Android. -} androidConfig :: [Config] -> [Config] |