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 @@ ...@@ -3,18 +3,5 @@
}: }:
rec { rec {
argonix = pkgs.argonix; argonix = pkgs.argonix;
hack = pkgs.argolib.getHackEnv pkgs pkgs.haskellPackages 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 {-# language NoImplicitPrelude #-}
#! nix-shell ./default.nix -i runhaskell -A preCommit {-# language OverloadedStrings #-}
{-| {-|
Module : shake.hs Module : shake.hs
Description : dev tasks Description : dev tasks.
Copyright : (c) Valentin Reis, 2018 Copyright : (c) Valentin Reis, 2018
License : MIT License : MIT
Maintainer : fre@freux.fr -} Maintainer : fre@freux.fr
-}
import Development.Shake import Development.Shake
import Protolude
import Development.Shake.FilePath import Development.Shake.FilePath
import Control.Monad import Control.Monad
import System.Process.Typed
main = shakeArgs shakeOptions $ do main = getArgs >>= deal
phony "clean" $ do where
removeFilesAfter "." ["README.md"] 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"] want ["README.md"]
"README.md" %> \out -> do "README.md" %> \out -> do
let template = ".README.md" let template = ".README.md"
need [template , "src/Argonix.hs" ] need [template, "src/Argonix.hs"]
(Stdout panpipe) <- cmd "which panpipe" panpipe <- toS <$> readProcessStdout_ (shell "which panpipe")
cmd_ "pandoc --filter" runProcess_ $ proc
[take (length panpipe - 1) panpipe, template, "-o", out] "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 ...@@ -94,7 +94,6 @@ toCommand :: NixCommand -> Text
toCommand NixBuild = "nix-build" toCommand NixBuild = "nix-build"
toCommand NixShell = "nix-shell" toCommand NixShell = "nix-shell"
targetParser :: Parser Text targetParser :: Parser Text
targetParser = strArgument targetParser = strArgument
(metavar "TARGET" <> showDefault <> help (metavar "TARGET" <> showDefault <> help
...@@ -130,7 +129,6 @@ sudoRemoveFile desc filePath = do ...@@ -130,7 +129,6 @@ sudoRemoveFile desc filePath = do
<> toS filePath <> toS filePath
<> ", even with sudo." <> ", even with sudo."
cleanSockets :: Verbosity -> IO () cleanSockets :: Verbosity -> IO ()
cleanSockets verbosity = cleanSockets verbosity =
putVerbose verbosity "cleaning sockets" >> for_ socketList cleanSocket putVerbose verbosity "cleaning sockets" >> for_ socketList cleanSocket
...@@ -224,7 +222,9 @@ setupSystem target sa = do ...@@ -224,7 +222,9 @@ setupSystem target sa = do
sVerbose sVerbose
( "cp " ( "cp "
<> toS nodeos_config <> toS nodeos_config
<> "/bin/argo_nodeos_config /tmp/argo_nodeos_config") >>= \case <> "/bin/argo_nodeos_config /tmp/argo_nodeos_config"
)
>>= \case
ExitSuccess -> return () ExitSuccess -> return ()
ExitFailure n -> ExitFailure n ->
die ("Failed to copy argo_nodeos_config" <> show 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