Merge pull request #116 from Liqwid-Labs/connor/export-scripts-rev
Include revision information in `agora-scripts.json`
This commit is contained in:
commit
04dcf16c9a
4 changed files with 17 additions and 4 deletions
6
Makefile
6
Makefile
|
|
@ -1,7 +1,7 @@
|
|||
# This really ought to be `/usr/bin/env bash`, but nix flakes don't like that.
|
||||
SHELL := /bin/sh
|
||||
|
||||
.PHONY: hoogle format haddock usage tag format_nix format_haskell format_check lint ps_bridge bench bench_check
|
||||
.PHONY: hoogle format haddock usage tag format_nix format_haskell format_check lint ps_bridge bench bench_check scripts
|
||||
|
||||
AGORA_TARGETS := agora agora-bench agora-purescript-bridge agora-scripts agora-specs agora-test agora-testlib
|
||||
|
||||
|
|
@ -20,6 +20,7 @@ usage:
|
|||
@echo " ps_bridge -- Generate purescript bridge files"
|
||||
@echo " bench -- Generate bench report bench.csv"
|
||||
@echo " bench_check -- Check if bench report is up-to-date"
|
||||
@echo " scripts -- Export scripts to json files"
|
||||
|
||||
hoogle:
|
||||
pkill hoogle || true
|
||||
|
|
@ -68,3 +69,6 @@ bench_check:
|
|||
|| (echo "bench.csv is outdated"; exit 1)
|
||||
# TODO: do the clean-up even if `diff` fails.
|
||||
rm -rf $(BENCH_TMPDIR)
|
||||
|
||||
scripts:
|
||||
cabal run agora-scripts
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
{- |
|
||||
Module : Scripts
|
||||
Maintainer : emi@haskell.fyi
|
||||
|
|
@ -28,6 +30,7 @@ import Agora.Treasury (treasuryValidator)
|
|||
import Control.Monad ((>=>))
|
||||
import Data.Aeson qualified as Aeson
|
||||
import Data.Tagged (Tagged)
|
||||
import Development.GitRev (gitBranch, gitHash)
|
||||
import GHC.Generics qualified as GHC
|
||||
import Options (Options (..), parseOptions)
|
||||
import Plutarch.Api.V1 (mintingPolicySymbol, mkMintingPolicy)
|
||||
|
|
@ -48,7 +51,8 @@ data ScriptParams = ScriptParams
|
|||
|
||||
-- | Scripts that get exported.
|
||||
data AgoraScripts = AgoraScripts
|
||||
{ governorPolicyInfo :: PolicyInfo
|
||||
{ gitRev :: String
|
||||
, governorPolicyInfo :: PolicyInfo
|
||||
, governorValidatorInfo :: ValidatorInfo
|
||||
, stakePolicyInfo :: PolicyInfo
|
||||
, stakeValidatorInfo :: ValidatorInfo
|
||||
|
|
@ -78,7 +82,8 @@ main = do
|
|||
agoraScripts :: ScriptParams -> AgoraScripts
|
||||
agoraScripts params =
|
||||
AgoraScripts
|
||||
{ governorPolicyInfo = mkPolicyInfo (governorPolicy governor)
|
||||
{ gitRev = revision
|
||||
, governorPolicyInfo = mkPolicyInfo (governorPolicy governor)
|
||||
, governorValidatorInfo = mkValidatorInfo (governorValidator governor)
|
||||
, stakePolicyInfo = mkPolicyInfo (stakePolicy params.gtClassRef)
|
||||
, stakeValidatorInfo = mkValidatorInfo (stakeValidator stake)
|
||||
|
|
@ -88,6 +93,9 @@ agoraScripts params =
|
|||
, authorityTokenPolicyInfo = mkPolicyInfo (authorityTokenPolicy authorityToken)
|
||||
}
|
||||
where
|
||||
revision :: String
|
||||
revision = $(gitBranch) <> "@" <> $(gitHash)
|
||||
|
||||
governor :: Governor
|
||||
governor =
|
||||
Governor
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -230,6 +230,7 @@ executable agora-scripts
|
|||
other-modules: Options
|
||||
build-depends:
|
||||
, agora
|
||||
, gitrev
|
||||
, optparse-applicative
|
||||
|
||||
executable agora-purescript-bridge
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue