Commit ec4565c8 authored by Valentin Reis's avatar Valentin Reis
Browse files

more workflow into shakebuild.

parent 9757b5b5
Pipeline #6179 passed with stages
in 36 seconds
......@@ -3,18 +3,5 @@
}:
rec {
argonix = pkgs.argonix;
hack = pkgs.argolib.getHackEnv pkgs pkgs.haskellPackages argonix;
preCommit = pkgs.mkShell {
name = "shake";
ARGOTK_SHARE = "${pkgs.argotk}/share";
buildInputs = [
(pkgs.haskellPackages.ghcWithPackages (p: with p; [
argonix
shake
panpipe
]))
];
};
}
#! /usr/bin/env nix-shell
#! nix-shell ./default.nix -i runhaskell -A preCommit
{-# language NoImplicitPrelude #-}
{-# language OverloadedStrings #-}
{-|
Module : shake.hs
Description : dev tasks
Description : dev tasks.
Copyright : (c) Valentin Reis, 2018
License : MIT
Maintainer : fre@freux.fr -}
Maintainer : fre@freux.fr
-}
import Development.Shake
import Protolude
import Development.Shake.FilePath
import Control.Monad
import System.Process.Typed
main = shakeArgs shakeOptions $ do
phony "clean" $ do
removeFilesAfter "." ["README.md"]
main = getArgs >>= deal
where
deal args
| "ghcid" `elem` args = void $ startProcess $ proc
"ghcid"
[ "--command"
, "cabal new-repl argonix"
, "--restart"
, "argonix.cabal"
, "--restart"
, "default.nix"
, "--restart"
, "shell.nix"
]
| otherwise = runshake
runshake = shakeArgs shakeOptions $ do
phony "clean" $ removeFilesAfter "." ["README.md"]
want ["README.md"]
"README.md" %> \out -> do
let template = ".README.md"
need [template , "src/Argonix.hs" ]
(Stdout panpipe) <- cmd "which panpipe"
cmd_ "pandoc --filter"
[take (length panpipe - 1) panpipe, template, "-o", out]
need [template, "src/Argonix.hs"]
panpipe <- toS <$> readProcessStdout_ (shell "which panpipe")
runProcess_ $ proc
"pandoc"
["--filter", take (length panpipe - 1) panpipe, template, "-o", out]
phony "clean" (removeFilesAfter "." ["README.md"])
phony "brittany" brittany
brittany = runProcess_ (shell "brittany --write-mode inplace src/*.hs")
......@@ -94,7 +94,6 @@ toCommand :: NixCommand -> Text
toCommand NixBuild = "nix-build"
toCommand NixShell = "nix-shell"
targetParser :: Parser Text
targetParser = strArgument
(metavar "TARGET" <> showDefault <> help
......@@ -130,7 +129,6 @@ sudoRemoveFile desc filePath = do
<> toS filePath
<> ", even with sudo."
cleanSockets :: Verbosity -> IO ()
cleanSockets verbosity =
putVerbose verbosity "cleaning sockets" >> for_ socketList cleanSocket
......@@ -224,7 +222,9 @@ setupSystem target sa = do
sVerbose
( "cp "
<> toS nodeos_config
<> "/bin/argo_nodeos_config /tmp/argo_nodeos_config") >>= \case
<> "/bin/argo_nodeos_config /tmp/argo_nodeos_config"
)
>>= \case
ExitSuccess -> return ()
ExitFailure n ->
die ("Failed to copy argo_nodeos_config" <> show n)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment