Skip to content

Commit

Permalink
Convert project to glide.
Browse files Browse the repository at this point in the history
Fixes decred#399.
  • Loading branch information
jrick committed Apr 26, 2016
1 parent a549b69 commit 9109336
Show file tree
Hide file tree
Showing 7 changed files with 212 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
btcwallet
vendor
10 changes: 6 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
language: go
go:
- 1.5.3
- 1.6
- 1.5.4
- 1.6.1
sudo: false
before_install:
- gotools=golang.org/x/tools
install:
- go get -d -t -v ./...
- go get -v github.com/Masterminds/glide
- glide install
- go get -v $(glide novendor)
- go get -v $gotools/cmd/cover
- go get -v github.com/bradfitz/goimports
- go get -v github.com/golang/lint/golint
- go get -v github.com/davecgh/go-spew/spew
script:
- export PATH=$PATH:$HOME/gopath/bin
- ./goclean.sh
71 changes: 64 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,72 @@ https://github.com/btcsuite/btcwallet/releases

### Windows/Linux/BSD/POSIX - Build from source

- If necessary, install Go according to the installation instructions
here: http://golang.org/doc/install. It is recommended to add
`$GOPATH/bin` to your `PATH` at this point.
Building or updating from source requires the following build dependencies:

- **Go 1.5 or 1.6**

Installation instructions can be found here: http://golang.org/doc/install.
It is recommended to add `$GOPATH/bin` to your `PATH` at this point.

- **Glide**

Glide is used to manage project dependencies and provide reproducible builds.
To install:

`go get -u github.com/Masterminds/glide`

Unfortunately, the use of `glide` prevents a handy tool such as `go get` from
automatically downloading, building, and installing the source in a single
command. Instead, the latest project and dependency sources must be first
obtained manually with `git` and `glide`, and then `go` is used to build and
install the project.

**Getting the source**:

For a first time installation, the project and dependency sources can be
obtained manually with `git` and `glide` (create directories as needed):

```
git clone https://github.com/btcsuite/btcwallet $GOPATH/src/github.com/btcsuite/btcwallet
cd $GOPATH/src/github.com/btcsuite/btcwallet
glide install
```

To update an existing source tree, pull the latest changes and install the
matching dependencies:

```
cd $GOPATH/src/github.com/btcsuite/btcwallet
git pull
glide install
```

**Building/Installing**:

The `go` tool is used to build or install (to `GOPATH`) the project. Some
example build instructions are provided below (all must run from the `btcwallet`
project directory) in a `sh`-compatible shell on Unix, or PowerShell on Windows
(`$()` subshells are not supported by `cmd`).

To build and install `btcwallet` and all helper commands (in the `cmd`
directory) to `$GOPATH/bin/`, as well as installing all compiled non-vendored
packages to `$GOPATH/pkg/` (**use this if you are unsure which command to
run**):

```
go install $(glide novendor)
```

To build a `btcwallet` executable and install it to `$GOPATH/bin/`:

```
go install
```

To build a `btcwallet` executable and place it in the current directory:

- Run the following commands to obtain and install btcd, btcwallet
and all dependencies:
```
go get -u -v github.com/btcsuite/btcd/...
go get -u -v github.com/btcsuite/btcwallet/...
go build
```

## Getting Started
Expand Down
12 changes: 8 additions & 4 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ environment:
GOPATH: c:\projects
GORACE: halt_on_error=1

install:
init:
- go version
- go get -v -t ./...
- go get -u github.com/Masterminds/glide
- go get -u github.com/davecgh/go-spew/spew

install:
- glide install

build_script:
- go build ./...
- ps: go get $(glide novendor)

test_script:
- go test -v -race ./...
- ps: go test -race $(glide novendor)
74 changes: 74 additions & 0 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions glide.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package: github.com/btcsuite/btcwallet
import:
- package: github.com/btcsuite/bolt
- package: github.com/btcsuite/btcd
subpackages:
- blockchain
- btcec
- btcjson
- chaincfg
- txscript
- wire
- package: github.com/btcsuite/btclog
- package: github.com/btcsuite/btcrpcclient
- package: github.com/btcsuite/btcutil
subpackages:
- hdkeychain
- package: github.com/btcsuite/fastsha256
- package: github.com/btcsuite/go-flags
- package: github.com/btcsuite/golangcrypto
subpackages:
- nacl/secretbox
- ripemd160
- scrypt
- ssh/terminal
- package: github.com/btcsuite/seelog
- package: github.com/btcsuite/websocket
- package: github.com/golang/protobuf
subpackages:
- proto
- package: golang.org/x/net
subpackages:
- context
- package: google.golang.org/grpc
subpackages:
- codes
- credentials
- grpclog
46 changes: 22 additions & 24 deletions goclean.sh
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
#!/bin/bash
# The script does automatic checking on a Go package and its sub-packages, including:
# 1. gofmt (http://golang.org/cmd/gofmt/)
# 2. goimports (https://github.com/bradfitz/goimports)
# 3. golint (https://github.com/golang/lint)
# 4. go vet (http://golang.org/cmd/vet)
# 5. race detector (http://blog.golang.org/race-detector)
# 6. test coverage (http://blog.golang.org/cover)
# 1. go fmt (http://golang.org/cmd/gofmt/)
# 2. golint (https://github.com/golang/lint)
# 3. go vet (http://golang.org/cmd/vet)
# 4. race detector (http://blog.golang.org/race-detector)

set -ex

# Automatic checks
test -z "$(gofmt -l -w . | tee /dev/stderr)"
test -z "$(goimports -l -w . | tee /dev/stderr)"
test -z "$(golint ./... | grep -v 'ALL_CAPS\|OP_\|NewFieldVal\|RpcCommand\|RpcRawCommand\|RpcSend\|Dns\|api.pb.go\|StartConsensusRpc\|factory_test.go\|legacy' | tee /dev/stderr)"
test -z "$(go vet ./... 2>&1 | grep -v 'Example\|newestSha\|rpcserver/server.go' | tee /dev/stderr)"
env GORACE="halt_on_error=1" go test -v -race ./...
test -z "$(go fmt $(glide novendor) | tee /dev/stderr)"
# test -z "$(goimports -l -w . | tee /dev/stderr)"
test -z "$(for package in $(glide novendor); do golint $package; done | grep -v 'ALL_CAPS\|OP_\|NewFieldVal\|RpcCommand\|RpcRawCommand\|RpcSend\|Dns\|api.pb.go\|StartConsensusRpc\|factory_test.go\|legacy' | tee /dev/stderr)"
test -z "$(go vet $(glide novendor) 2>&1 | grep -v '^exit status \|Example\|newestSha\| not a string in call to Errorf$' | tee /dev/stderr)"
env GORACE="halt_on_error=1" go test -v -race $(glide novendor)

# Run test coverage on each subdirectories and merge the coverage profile.

set +x
echo "mode: count" > profile.cov
#set +x
#echo "mode: count" > profile.cov

# Standard go tooling behavior is to ignore dirs with leading underscores.
for dir in $(find . -maxdepth 10 -not -path '.' -not -path './.git*' \
-not -path '*/_*' -not -path './cmd*' -not -path './release*' -type d)
do
if ls $dir/*.go &> /dev/null; then
go test -covermode=count -coverprofile=$dir/profile.tmp $dir
if [ -f $dir/profile.tmp ]; then
cat $dir/profile.tmp | tail -n +2 >> profile.cov
rm $dir/profile.tmp
fi
fi
done
#for dir in $(find . -maxdepth 10 -not -path '.' -not -path './.git*' \
# -not -path '*/_*' -not -path './cmd*' -not -path './release*' -type d)
#do
#if ls $dir/*.go &> /dev/null; then
# go test -covermode=count -coverprofile=$dir/profile.tmp $dir
# if [ -f $dir/profile.tmp ]; then
# cat $dir/profile.tmp | tail -n +2 >> profile.cov
# rm $dir/profile.tmp
# fi
#fi
#done

# To submit the test coverage result to coveralls.io,
# use goveralls (https://github.com/mattn/goveralls)
Expand Down

0 comments on commit 9109336

Please sign in to comment.