Skip to content

Commit

Permalink
Add Makefile target for building AGC binary for running tests
Browse files Browse the repository at this point in the history
Add a Makefile target that calls `make autonity` in the autonity
repository to build the AGC binary.
  • Loading branch information
szemate committed Feb 17, 2025
1 parent b6271a8 commit a0705a3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
26 changes: 18 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
VERSION := $(shell cat AUTONITY_VERSION)
AUTONITY := build/autonity
ABIDIR := $(AUTONITY)/params/generated
SRCDIR := $(AUTONITY)/autonity/solidity/contracts
AUTONITY_DIR := build/autonity
AUTONITY_BIN := $(AUTONITY_DIR)/build/bin/autonity
ABIDIR := $(AUTONITY_DIR)/params/generated
SRCDIR := $(AUTONITY_DIR)/autonity/solidity/contracts
OUTDIR := autonity/contracts

abigen = hatch run generate:pyabigen \
Expand All @@ -10,6 +11,7 @@ abigen = hatch run generate:pyabigen \
--devdoc $(word 2,$(1)) \
--userdoc $(word 3,$(1)) \
$(word 4,$(1))

gentargets = $(shell find $(SRCDIR) -name $(1).sol) \
$(addprefix $(ABIDIR)/$(1),.docdev .docuser .abi) \
pyproject.toml
Expand Down Expand Up @@ -55,16 +57,24 @@ $(OUTDIR)/supply_control.py: $(call gentargets,SupplyControl)
$(OUTDIR)/upgrade_manager.py: $(call gentargets,UpgradeManager)
$(call abigen,$^) --exclude setOperator >$@

$(ABIDIR)/%.abi $(ABIDIR)/%.docdev $(ABIDIR)/%.docuser: $(AUTONITY) AUTONITY_VERSION
$(ABIDIR)/%.abi $(ABIDIR)/%.docdev $(ABIDIR)/%.docuser: $(AUTONITY_DIR) AUTONITY_VERSION
cd $< && \
git fetch origin && \
git checkout $(VERSION) && \
git checkout -d $(VERSION) && \
make contracts

$(AUTONITY):
$(AUTONITY_BIN): $(AUTONITY_DIR) AUTONITY_VERSION
cd $< && \
git fetch origin && \
git checkout -d $(VERSION) && \
make autonity

$(AUTONITY_DIR):
git clone [email protected]:autonity/autonity.git $@

autonity: $(AUTONITY_BIN)

clean:
rm -rf $(AUTONITY)
rm -rf $(AUTONITY_DIR)

.PHONY = clean
.PHONY = autonity clean
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ Installed pypy3.10 @ /home/develop/.local/share/hatch/pythons/pypy3.10

### Building and testing

First clone [Autonity](https://github.com/autonity/autonity) and build the
Autonity Go Client binary with:

```sh
make autonity
```

To launch the tests across all supported Python versions, run:

```sh
Expand Down

0 comments on commit a0705a3

Please sign in to comment.