Merge pull request #1054 from chreekat/keter-build-args
Add build-args to keter subcommand
This commit is contained in:
commit
128165c19c
@ -11,6 +11,7 @@ import System.Process
|
|||||||
import Control.Monad
|
import Control.Monad
|
||||||
import System.Directory hiding (findFiles)
|
import System.Directory hiding (findFiles)
|
||||||
import Data.Maybe (mapMaybe)
|
import Data.Maybe (mapMaybe)
|
||||||
|
import Data.Monoid
|
||||||
import System.FilePath ((</>))
|
import System.FilePath ((</>))
|
||||||
import qualified Codec.Archive.Tar as Tar
|
import qualified Codec.Archive.Tar as Tar
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
@ -27,8 +28,9 @@ run a b = do
|
|||||||
keter :: String -- ^ cabal command
|
keter :: String -- ^ cabal command
|
||||||
-> Bool -- ^ no build?
|
-> Bool -- ^ no build?
|
||||||
-> Bool -- ^ no copy to?
|
-> Bool -- ^ no copy to?
|
||||||
|
-> [String] -- ^ build args
|
||||||
-> IO ()
|
-> IO ()
|
||||||
keter cabal noBuild noCopyTo = do
|
keter cabal noBuild noCopyTo buildArgs = do
|
||||||
ketercfg <- keterConfig
|
ketercfg <- keterConfig
|
||||||
mvalue <- decodeFile ketercfg
|
mvalue <- decodeFile ketercfg
|
||||||
value <-
|
value <-
|
||||||
@ -76,8 +78,11 @@ keter cabal noBuild noCopyTo = do
|
|||||||
then do run "stack" ["clean"]
|
then do run "stack" ["clean"]
|
||||||
createDirectoryIfMissing True "./dist/bin"
|
createDirectoryIfMissing True "./dist/bin"
|
||||||
run "stack"
|
run "stack"
|
||||||
(words "--local-bin-path ./dist/bin build --copy-bins")
|
((words "--local-bin-path ./dist/bin build --copy-bins")
|
||||||
else mapM_ (\x -> run cabal [x]) ["clean", "configure", "build"]
|
<> buildArgs)
|
||||||
|
else do run cabal ["clean"]
|
||||||
|
run cabal ["configure"]
|
||||||
|
run cabal ("build" : buildArgs)
|
||||||
|
|
||||||
_ <- try' $ removeDirectoryRecursive "static/tmp"
|
_ <- try' $ removeDirectoryRecursive "static/tmp"
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,7 @@ data Command = Init { _initBare :: Bool, _initName :: Maybe String, _initDatabas
|
|||||||
| Keter
|
| Keter
|
||||||
{ _keterNoRebuild :: Bool
|
{ _keterNoRebuild :: Bool
|
||||||
, _keterNoCopyTo :: Bool
|
, _keterNoCopyTo :: Bool
|
||||||
|
, _keterBuildArgs :: [String]
|
||||||
}
|
}
|
||||||
| Version
|
| Version
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
@ -106,7 +107,7 @@ main = do
|
|||||||
Configure -> cabal ["configure"]
|
Configure -> cabal ["configure"]
|
||||||
Build es -> touch' >> cabal ("build":es)
|
Build es -> touch' >> cabal ("build":es)
|
||||||
Touch -> touch'
|
Touch -> touch'
|
||||||
Keter{..} -> keter (cabalCommand o) _keterNoRebuild _keterNoCopyTo
|
Keter{..} -> keter (cabalCommand o) _keterNoRebuild _keterNoCopyTo _keterBuildArgs
|
||||||
Version -> putStrLn ("yesod-bin version: " ++ showVersion Paths_yesod_bin.version)
|
Version -> putStrLn ("yesod-bin version: " ++ showVersion Paths_yesod_bin.version)
|
||||||
AddHandler{..} -> addHandler addHandlerRoute addHandlerPattern addHandlerMethods
|
AddHandler{..} -> addHandler addHandlerRoute addHandlerPattern addHandlerMethods
|
||||||
Test -> cabalTest cabal
|
Test -> cabalTest cabal
|
||||||
@ -189,6 +190,9 @@ keterOptions :: Parser Command
|
|||||||
keterOptions = Keter
|
keterOptions = Keter
|
||||||
<$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" )
|
<$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" )
|
||||||
<*> switch ( long "nocopyto" <> help "Ignore copy-to directive in keter config file" )
|
<*> switch ( long "nocopyto" <> help "Ignore copy-to directive in keter config file" )
|
||||||
|
<*> optStrToList ( long "build-args" <> help "Build arguments" )
|
||||||
|
where
|
||||||
|
optStrToList m = option (words <$> str) $ value [] <> m
|
||||||
|
|
||||||
defaultRescan :: Int
|
defaultRescan :: Int
|
||||||
defaultRescan = 10
|
defaultRescan = 10
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user