Skip to content
This repository was archived by the owner on Aug 2, 2021. It is now read-only.

Makefile: added support for "make swarm" command#1412

Merged
nonsense merged 4 commits intoethersphere:masterfrom
cobordism:makeswarm
Jun 3, 2019
Merged

Makefile: added support for "make swarm" command#1412
nonsense merged 4 commits intoethersphere:masterfrom
cobordism:makeswarm

Conversation

@cobordism
Copy link
Copy Markdown

Fixes #1411

Makefile Outdated
@type "solc" 2> /dev/null || echo 'Please install solc'
@type "protoc" 2> /dev/null || echo 'Please install protoc'

swarm-devtools:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need such a target?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:(
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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why we need this either.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, this is the way it has always been. I am not changing anything at all from previous behaviour.

@cobordism
Copy link
Copy Markdown
Author

Do you want me to make a minimal version - for just the make swarm command and nothing else?

@nonsense
Copy link
Copy Markdown
Contributor

nonsense commented Jun 3, 2019

@homotopycolimit I think we don't need a Makefile at all, it is just an indirection for our tooling - namely go.

Instead of calling make swarm, when you have to go and read the Makefile, you can just do go install ./..., or go install github.com/ethersphere/swarm/cmd/swarm.

Makefile Outdated
# don't need to bother with make.

GOBIN = $(shell pwd)/build/bin
GO ?= latest
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be used.

@cobordism
Copy link
Copy Markdown
Author

cobordism commented Jun 3, 2019

you're about to tell me something with the words 'rebase' and 'sqash' aren't you? :scared:

@nonsense
Copy link
Copy Markdown
Contributor

nonsense commented Jun 3, 2019

@homotopycolimit no need to rebase, as there are no conflicts. In Github we have Squash and merge, which is what you need :) In the future, just use the Squash and merge button and make sure you have package: prefix (in this case Makefile: is good enough) as part of the PR / commit.

@nonsense nonsense merged commit 70320ce into ethersphere:master Jun 3, 2019
@nonsense
Copy link
Copy Markdown
Contributor

nonsense commented Jun 3, 2019

Screenshot from 2019-06-03 20-59-42

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Makefile missing after repo split.

2 participants