Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Remove build deps management #5915

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -597,12 +597,11 @@ commands:
GOLANG_VERSION=$(./scripts/get_golang_version.sh)
eval "$(<< parameters.build_dir >>/gimme "${GOLANG_VERSION}")"
scripts/configure_dev.sh
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
PACKAGES="$(go list ./... | grep -v /go-algorand/test/)"
export PACKAGE_NAMES=$(echo $PACKAGES | tr -d '\n')
export PARTITION_TOTAL=${CIRCLE_NODE_TOTAL}
export PARTITION_ID=${CIRCLE_NODE_INDEX}
gotestsum --format standard-verbose --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES
go run gotest.tools/gotestsum@v1.10.0 --format standard-verbose --junitfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/results.xml --jsonfile << parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}/testresults.json -- --tags "sqlite_unlock_notify sqlite_omit_load_extension" << parameters.short_test_flag >> -race -timeout 1h -coverprofile=coverage.txt -covermode=atomic -p 1 $PACKAGE_NAMES
- store_artifacts:
path: << parameters.result_path >>
destination: test-results
Expand Down Expand Up @@ -663,7 +662,6 @@ commands:
GOLANG_VERSION=$(./scripts/get_golang_version.sh)
eval "$(<< parameters.build_dir >>/gimme "${GOLANG_VERSION}")"
scripts/configure_dev.sh
scripts/buildtools/install_buildtools.sh -o "gotest.tools/gotestsum"
export ALGOTEST=1
export SHORTTEST=<< parameters.short_test_flag >>
export TEST_RESULTS=<< parameters.result_path >>/<< parameters.result_subdir >>/${CIRCLE_NODE_INDEX}
Expand Down
23 changes: 8 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,7 @@ GOTAGSLIST := sqlite_unlock_notify sqlite_omit_load_extension
# e.g. make GOTAGSCUSTOM=msgtrace
GOTAGSLIST += ${GOTAGSCUSTOM}

# If available, use gotestsum instead of 'go test'.
ifeq (, $(shell which gotestsum))
export GOTESTCOMMAND=go test
else
export GOTESTCOMMAND=gotestsum --format pkgname --jsonfile testresults.json --
endif
export GOTESTCOMMAND=go run gotest.tools/[email protected]
jannotti marked this conversation as resolved.
Show resolved Hide resolved

# M1 Mac--homebrew install location in /opt/homebrew
ifeq ($(OS_TYPE), darwin)
Expand Down Expand Up @@ -99,8 +94,8 @@ fmt:
fix: build
$(GOPATH1)/bin/algofix */

lint: deps
$(GOPATH1)/bin/golangci-lint run -c .golangci.yml
lint:
go run github.com/golangci/golangci-lint/cmd/[email protected] run -c .golangci.yml

check_go_version:
@if [ $(CURRENT_GO_VERSION_MAJOR) != $(GOLANG_VERSION_BUILD_MAJOR) ]; then \
Expand All @@ -127,17 +122,18 @@ cover:
prof:
cd node && go test $(GOTAGS) -cpuprofile=cpu.out -memprofile=mem.out -mutexprofile=mutex.out

generate: deps
generate:
PATH=$(GOPATH1)/bin:$$PATH go generate ./...

msgp: $(patsubst %,%/msgp_gen.go,$(MSGP_GENERATE))

%/msgp_gen.go: deps ALWAYS
MSGP := go run github.com/algorand/[email protected]
%/msgp_gen.go: ALWAYS
@set +e; \
printf "msgp: $(@D)..."; \
$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./[email protected] 2>&1; \
$(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand > ./[email protected] 2>&1; \
if [ "$$?" != "0" ]; then \
printf "failed:\n$(GOPATH1)/bin/msgp -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \
printf "failed:\n$(MSGP) -file ./$(@D) -o $@ -warnmask github.com/algorand/go-algorand\n"; \
cat ./[email protected]; \
rm ./[email protected]; \
exit 1; \
Expand All @@ -157,9 +153,6 @@ crypto/libs/$(OS_TYPE)/$(ARCH)/lib/libsodium.a:
$(MAKE) && \
$(MAKE) install

deps:
./scripts/check_deps.sh

# artifacts

# Regenerate kmd swagger spec files
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ Initial environment setup:
git clone https://github.com/algorand/go-algorand
cd go-algorand
./scripts/configure_dev.sh
./scripts/buildtools/install_buildtools.sh
```

At this point, you are ready to build go-algorand. We use `make` and have a
Expand Down
2 changes: 1 addition & 1 deletion agreement/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/algorand/go-algorand/protocol"
)

//go:generate stringer -type=actionType
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=actionType
type actionType uint8

const (
Expand Down
2 changes: 1 addition & 1 deletion agreement/coservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"github.com/algorand/go-algorand/logging"
)

//go:generate stringer -type=coserviceType
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=coserviceType
const (
demuxCoserviceType coserviceType = iota
tokenizerCoserviceType
Expand Down
2 changes: 1 addition & 1 deletion agreement/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type externalEvent interface {
// interface. The semantics of an event depends on the eventType and not on the
// type of the implementing struct.
//
//go:generate stringer -type=eventType
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=eventType
type eventType uint8

const (
Expand Down
2 changes: 1 addition & 1 deletion agreement/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
//msgp:ignore stateMachineTag
type stateMachineTag int

//go:generate stringer -type=stateMachineTag
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=stateMachineTag
const (
demultiplexer stateMachineTag = iota // type demux

Expand Down
23 changes: 9 additions & 14 deletions daemon/algod/api/Makefile
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
GOPATH := $(shell go env GOPATH)
GOPATH1 := $(firstword $(subst :, ,$(GOPATH)))

# `make all` or just `make` should be appropriate for dev work
all: server/v2/generated/model/types.go server/v2/generated/nonparticipating/public/routes.go server/v2/generated/nonparticipating/private/routes.go server/v2/generated/participating/public/routes.go server/v2/generated/participating/private/routes.go server/v2/generated/data/routes.go server/v2/generated/experimental/routes.go

# `make generate` should be able to replace old `generate.sh` script and be appropriate for build system use
generate: oapi-codegen all
generate: all

CODEGEN := go run github.com/algorand/oapi-codegen/cmd/[email protected]
server/v2/generated/nonparticipating/public/routes.go: algod.oas3.yml
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/nonparticipating/public/public_routes.yml algod.oas3.yml
$(CODEGEN) -config ./server/v2/generated/nonparticipating/public/public_routes.yml algod.oas3.yml

server/v2/generated/nonparticipating/private/routes.go: algod.oas3.yml
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/nonparticipating/private/private_routes.yml algod.oas3.yml
$(CODEGEN) -config ./server/v2/generated/nonparticipating/private/private_routes.yml algod.oas3.yml

server/v2/generated/participating/public/routes.go: algod.oas3.yml
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/participating/public/public_routes.yml algod.oas3.yml
$(CODEGEN) -config ./server/v2/generated/participating/public/public_routes.yml algod.oas3.yml

server/v2/generated/participating/private/routes.go: algod.oas3.yml
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/participating/private/private_routes.yml algod.oas3.yml
$(CODEGEN) -config ./server/v2/generated/participating/private/private_routes.yml algod.oas3.yml


server/v2/generated/data/routes.go: algod.oas3.yml
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/data/data_routes.yml algod.oas3.yml
$(CODEGEN) -config ./server/v2/generated/data/data_routes.yml algod.oas3.yml

server/v2/generated/experimental/routes.go: algod.oas3.yml
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/experimental/experimental_routes.yml algod.oas3.yml
$(CODEGEN) -config ./server/v2/generated/experimental/experimental_routes.yml algod.oas3.yml

server/v2/generated/model/types.go: algod.oas3.yml
$(GOPATH1)/bin/oapi-codegen -config ./server/v2/generated/model/model_types.yml algod.oas3.yml
$(CODEGEN) -config ./server/v2/generated/model/model_types.yml algod.oas3.yml

algod.oas3.yml: algod.oas2.json
curl -s -X POST "https://converter.swagger.io/api/convert" -H "accept: application/json" -H "Content-Type: application/json" -d @./algod.oas2.json -o .3tmp.json
python3 jsoncanon.py < .3tmp.json > algod.oas3.yml
rm -f .3tmp.json

oapi-codegen: .PHONY
../../../scripts/buildtools/install_buildtools.sh -o github.com/algorand/oapi-codegen -c github.com/algorand/oapi-codegen/cmd/oapi-codegen

clean:
rm -rf server/v2/generated/model/types.go server/v2/generated/nonparticipating/public/routes.go server/v2/generated/nonparticipating/private/routes.go server/v2/generated/participating/public/routes.go server/v2/generated/participating/private/routes.go server/v2/generated/data/routes.go algod.oas3.yml

Expand Down
6 changes: 3 additions & 3 deletions daemon/kmd/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
// Base path must be a fully specified package name (else, it seems that swagger feeds a relative path to
// loader.Config.Import(), and that breaks the vendor directory if the source is symlinked from elsewhere)
//
//go:generate swagger generate spec -m -o="./swagger.json"
//go:generate swagger validate ./swagger.json --stop-on-error
//go:generate go run github.com/go-swagger/go-swagger/cmd/[email protected] generate spec -m -o="./swagger.json"
//go:generate go run github.com/go-swagger/go-swagger/cmd/[email protected] validate ./swagger.json --stop-on-error
//go:generate sh ../lib/kmdapi/bundle_swagger_json.sh
package api

Expand All @@ -70,7 +70,7 @@ import (

"github.com/gorilla/mux"

"github.com/algorand/go-algorand/daemon/kmd/api/v1"
v1 "github.com/algorand/go-algorand/daemon/kmd/api/v1"
"github.com/algorand/go-algorand/daemon/kmd/lib/kmdapi"
"github.com/algorand/go-algorand/daemon/kmd/session"
"github.com/algorand/go-algorand/logging"
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const (
// OnCompletion is an enum representing some layer 1 side effect that an
// ApplicationCall transaction will have if it is included in a block.
//
//go:generate stringer -type=OnCompletion -output=application_string.go
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=OnCompletion -output=application_string.go
type OnCompletion uint64

const (
Expand Down
2 changes: 1 addition & 1 deletion data/transactions/logic/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/algorand/go-algorand/protocol"
)

//go:generate stringer -type=TxnField,GlobalField,AssetParamsField,AppParamsField,AcctParamsField,AssetHoldingField,OnCompletionConstType,EcdsaCurve,EcGroup,Base64Encoding,JSONRefType,VrfStandard,BlockField -output=fields_string.go
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=TxnField,GlobalField,AssetParamsField,AppParamsField,AcctParamsField,AssetHoldingField,OnCompletionConstType,EcdsaCurve,EcGroup,Base64Encoding,JSONRefType,VrfStandard,BlockField -output=fields_string.go

// FieldSpec unifies the various specs for assembly, disassembly, and doc generation.
type FieldSpec interface {
Expand Down
2 changes: 1 addition & 1 deletion docs/messagepack.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ idea of the performance difference, [here are some benchmarks for Transactions](

## Code generation

Install `msgp` with [install_buildtools.sh](scripts/buildtools/install_buildtools.sh) and use it with `make msgp`.
Generate messagepack code with `make msgp`.

The generated Marshal and Unmarshal utilities are located in `msgp_gen.go`
files. Update `MSGP_GENERATE` in the Makefile to add another package.
2 changes: 1 addition & 1 deletion ledger/store/trackerdb/hashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
// By encoding HashKind at a known-offset, it's possible for hash readers to
// disambiguate the hashed resource.
//
//go:generate stringer -type=HashKind
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=HashKind
//msgp:ignore HashKind
type HashKind byte

Expand Down
2 changes: 1 addition & 1 deletion logging/logspec/agreement.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// AgreementType is an enum identifying a specific type of AgreementEvent
// TODO Maybe this should be called AgreementEventType, since these are not actually types of agreements
//
//go:generate stringer -type=AgreementType
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=AgreementType
type AgreementType int

const (
Expand Down
2 changes: 1 addition & 1 deletion logging/logspec/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// LedgerType is an enum identifying a specific type of LedgerEvent
// TODO Maybe this should be called LedgerEventType, since these are not actually types of ledgers
//
//go:generate stringer -type=LedgerType
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=LedgerType
type LedgerType int

const (
Expand Down
2 changes: 1 addition & 1 deletion logging/logspec/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
// TODO Maybe this should be called ComponentEventType (and change Event to ComponentEvent),
// since these are not actually types of components
//
//go:generate stringer -type=Component
//go:generate go run golang.org/x/tools/cmd/stringer@v0.17.0 -type=Component
type Component int

const (
Expand Down
95 changes: 0 additions & 95 deletions scripts/buildtools/install_buildtools.sh

This file was deleted.

7 changes: 0 additions & 7 deletions scripts/buildtools/versions

This file was deleted.

Loading