Makefile: added support for "make swarm" command#1412
Makefile: added support for "make swarm" command#1412nonsense merged 4 commits intoethersphere:masterfrom cobordism:makeswarm
Conversation
Makefile
Outdated
| @type "solc" 2> /dev/null || echo 'Please install solc' | ||
| @type "protoc" 2> /dev/null || echo 'Please install protoc' | ||
|
|
||
| swarm-devtools: |
There was a problem hiding this comment.
Why do we need such a target?
There was a problem hiding this comment.
It was in the previous version over at go-ethereum.
My PR is only to import that functionality into our new repo. Pruning the content seems like another step that I did not feel fully qualified to make.
There was a problem hiding this comment.
I see that it is just an import, but we literally don't need this whole file. I'd rather if we just don't have a Makefile at all.
All you need to build Swarm is part of the README.md already and it is two commands.
Running the tests is a single command.
Usually you need a Makefile when you add some non-obvious behaviour or you do multiple steps as part of the build and test processes, which we don't currently.
There was a problem hiding this comment.
:(
I heartily disagree.
make swarm works when go install does not.
It works from any directory. It works without GOPATH, it works without GOROOT. It is far easier to use for anyone who is not already a go developer with a fully installed and configured go development environment.
There was a problem hiding this comment.
Here is what it looks like from my perspective:
sorry we have removed the makefile, you can no longer use make swarm to compile swarm.
Instead please create a directory called go,
in it create a directory called src
in it create a directory called github.com
in it create a directory called ethersphere
move the swarm source into this directory.
Next set up the necessary environment variables for go to work (see golang documentation)
then use go install instead of make.
and all that why?
There was a problem hiding this comment.
@homotopycolimit right - it wasn't obvious right from the get-go that the purpose of the Makefile is to build the project for people that don't have a proper Go environment setup - i.e. GOPATH, etc.
If you use the go tooling, go get builds the proper paths for you, so you don't have to create directories yourself.
In the future we could modify our vendoring strategy and use go.mod so that we don't have the requirement for GOPATH.
Until then I agree that having a Makefile is useful, so that it builds swarm for users who have just cloned the repo.
Makefile
Outdated
| # The devtools target installs tools required for 'go generate'. | ||
| # You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'. | ||
|
|
||
| devtools: |
There was a problem hiding this comment.
Not sure why we need this either.
There was a problem hiding this comment.
it was in the previous version. That's all I know.
Makefile
Outdated
| lint: ## Run linters. | ||
| build/env.sh go run build/ci.go lint | ||
|
|
||
| clean: |
There was a problem hiding this comment.
I'd rather we don't maintain any of these to be honest. Whoever works on this project, should be aware of the caches within Go. Also this is about Go 1.10 which is no longer supported by the Go team - we suggest people use Go 1.11 or Go 1.12.
| # with Go source code. If you know what GOPATH is then you probably | ||
| # don't need to bother with make. | ||
|
|
||
| GOBIN = $(shell pwd)/build/bin |
There was a problem hiding this comment.
We actually have a build folder in the Swarm codebase that has source code in it, unlike many projects that use it for artifacts and binaries. So adding a bin folder in it is kinda weird.
There was a problem hiding this comment.
again, this is the way it has always been. I am not changing anything at all from previous behaviour.
|
Do you want me to make a minimal version - for just the |
|
@homotopycolimit I think we don't need a Instead of calling |
Makefile
Outdated
| # don't need to bother with make. | ||
|
|
||
| GOBIN = $(shell pwd)/build/bin | ||
| GO ?= latest |
There was a problem hiding this comment.
This doesn't appear to be used.
|
you're about to tell me something with the words 'rebase' and 'sqash' aren't you? :scared: |
|
@homotopycolimit no need to rebase, as there are no conflicts. In Github we have |

Fixes #1411