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