only update version in cabal file on release builds
This was being very annoying in windows.
This commit is contained in:
parent
524ffd1e68
commit
07b0bf4cee
1 changed files with 9 additions and 5 deletions
|
@ -9,6 +9,7 @@ import Control.Applicative
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
import Control.Monad.IfElse
|
||||||
|
|
||||||
import Build.TestConfig
|
import Build.TestConfig
|
||||||
import Utility.SafeCommand
|
import Utility.SafeCommand
|
||||||
|
@ -81,19 +82,21 @@ testCp k option = TestCase cmd $ testCmd k cmdline
|
||||||
cmd = "cp " ++ option
|
cmd = "cp " ++ option
|
||||||
cmdline = cmd ++ " " ++ testFile ++ " " ++ testFile ++ ".new"
|
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,
|
{- 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.
|
- plus the date of the last commit, plus the git rev of that commit.
|
||||||
- This works for autobuilds, ad-hoc builds, etc.
|
- 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,
|
- If git or a git repo is not available, or something goes wrong,
|
||||||
- just use the version from the changelog. -}
|
- just use the version from the changelog. -}
|
||||||
getVersion :: Test
|
getVersion :: Test
|
||||||
getVersion = do
|
getVersion = do
|
||||||
changelogversion <- getChangelogVersion
|
changelogversion <- getChangelogVersion
|
||||||
version <- ifM (isJust <$> catchMaybeIO (getEnv "VERSION_FROM_CHANGELOG"))
|
version <- ifM (isReleaseBuild)
|
||||||
( return changelogversion
|
( return changelogversion
|
||||||
, catchDefaultIO changelogversion $ do
|
, catchDefaultIO changelogversion $ do
|
||||||
let major = takeWhile (/= '.') changelogversion
|
let major = takeWhile (/= '.') changelogversion
|
||||||
|
@ -160,7 +163,8 @@ run ts = do
|
||||||
then writeSysConfig $ androidConfig config
|
then writeSysConfig $ androidConfig config
|
||||||
else writeSysConfig config
|
else writeSysConfig config
|
||||||
cleanup
|
cleanup
|
||||||
cabalSetup
|
whenM (isReleaseBuild) $
|
||||||
|
cabalSetup
|
||||||
|
|
||||||
{- Hard codes some settings to cross-compile for Android. -}
|
{- Hard codes some settings to cross-compile for Android. -}
|
||||||
androidConfig :: [Config] -> [Config]
|
androidConfig :: [Config] -> [Config]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue