Allow conditionally build for Testnet/Mainnet. Closes #40
This commit is contained in:
parent
f11c6421a1
commit
286a8fc344
33
Makefile
33
Makefile
|
@ -5,30 +5,47 @@ GOBIN = build/bin
|
||||||
GO ?= latest
|
GO ?= latest
|
||||||
|
|
||||||
statusgo:
|
statusgo:
|
||||||
build/env.sh go build -i -o $(GOBIN)/statusgo -v $(shell build/flags.sh) ./cmd/status
|
build/env.sh go build -i -o $(GOBIN)/statusgo -v $(shell build/testnet-flags.sh) ./cmd/status
|
||||||
@echo "status go compilation done."
|
@echo "status go compilation done."
|
||||||
@echo "Run \"build/bin/statusgo\" to view available commands"
|
@echo "Run \"build/bin/statusgo\" to view available commands"
|
||||||
|
|
||||||
statusgo-cross: statusgo-android statusgo-ios
|
statusgo-cross: statusgo-android statusgo-ios
|
||||||
@echo "Full cross compilation done:"
|
@echo "Full cross compilation done."
|
||||||
@ls -ld $(GOBIN)/statusgo-*
|
@ls -ld $(GOBIN)/statusgo-*
|
||||||
|
|
||||||
statusgo-android: xgo
|
statusgo-android: xgo
|
||||||
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v $(shell build/flags.sh) ./cmd/status
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v $(shell build/testnet-flags.sh) ./cmd/status
|
||||||
@echo "Android cross compilation done:"
|
@echo "Android cross compilation done."
|
||||||
|
|
||||||
statusgo-ios: xgo
|
statusgo-ios: xgo
|
||||||
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/flags.sh) ./cmd/status
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/testnet-flags.sh) ./cmd/status
|
||||||
@echo "iOS framework cross compilation done:"
|
@echo "iOS framework cross compilation done."
|
||||||
|
|
||||||
statusgo-ios-simulator: xgo
|
statusgo-ios-simulator: xgo
|
||||||
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo-ios-simulator --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/flags.sh) ./cmd/status
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo-ios-simulator --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/testnet-flags.sh) ./cmd/status
|
||||||
@echo "iOS framework cross compilation done:"
|
@echo "iOS framework cross compilation done."
|
||||||
|
|
||||||
xgo:
|
xgo:
|
||||||
build/env.sh docker pull farazdagi/xgo
|
build/env.sh docker pull farazdagi/xgo
|
||||||
build/env.sh go get github.com/karalabe/xgo
|
build/env.sh go get github.com/karalabe/xgo
|
||||||
|
|
||||||
|
statusgo-mainnet:
|
||||||
|
build/env.sh go build -i -o $(GOBIN)/statusgo -v $(shell build/mainnet-flags.sh) ./cmd/status
|
||||||
|
@echo "status go compilation done (mainnet)."
|
||||||
|
@echo "Run \"build/bin/statusgo\" to view available commands"
|
||||||
|
|
||||||
|
statusgo-android-mainnet: xgo
|
||||||
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=android-16/aar -v $(shell build/mainnet-flags.sh) ./cmd/status
|
||||||
|
@echo "Android cross compilation done (mainnet)."
|
||||||
|
|
||||||
|
statusgo-ios-mainnet: xgo
|
||||||
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/mainnet-flags.sh) ./cmd/status
|
||||||
|
@echo "iOS framework cross compilation done (mainnet)."
|
||||||
|
|
||||||
|
statusgo-ios-simulator-mainnet: xgo
|
||||||
|
build/env.sh $(GOBIN)/xgo --image farazdagi/xgo-ios-simulator --go=$(GO) -out statusgo --dest=$(GOBIN) --targets=ios-9.3/framework -v $(shell build/mainnet-flags.sh) ./cmd/status
|
||||||
|
@echo "iOS framework cross compilation done (mainnet)."
|
||||||
|
|
||||||
ci:
|
ci:
|
||||||
build/env.sh go test -v -cover ./geth
|
build/env.sh go test -v -cover ./geth
|
||||||
build/env.sh go test -v -cover ./jail
|
build/env.sh go test -v -cover ./jail
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ ! -f "build/env.sh" ]; then
|
||||||
|
echo "$0 must be run from the root of the repository."
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set gitCommit when running from a Git checkout.
|
||||||
|
if [ -f ".git/HEAD" ]; then
|
||||||
|
echo "-ldflags '-X github.com/status-im/status-go/geth.UseTestnet=false -X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X main.gitCommit=$(git rev-parse HEAD)'";
|
||||||
|
fi
|
|
@ -9,5 +9,5 @@ fi
|
||||||
|
|
||||||
# set gitCommit when running from a Git checkout.
|
# set gitCommit when running from a Git checkout.
|
||||||
if [ -f ".git/HEAD" ]; then
|
if [ -f ".git/HEAD" ]; then
|
||||||
echo "-ldflags '-X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X main.gitCommit=$(git rev-parse HEAD)'"
|
echo "-ldflags '-X github.com/status-im/status-go/geth.UseTestnet=true -X main.buildStamp=`date -u '+%Y-%m-%d.%H:%M:%S'` -X main.gitCommit=$(git rev-parse HEAD)'";
|
||||||
fi
|
fi
|
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/status-im/status-go/geth"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -22,5 +23,10 @@ func main() {
|
||||||
if gitCommit != "" {
|
if gitCommit != "" {
|
||||||
verString += "-" + gitCommit[:8]
|
verString += "-" + gitCommit[:8]
|
||||||
}
|
}
|
||||||
fmt.Printf("Status\nGit Commit: %s\nBuild Time: %s\nVersion: %s\n", gitCommit, buildStamp, verString)
|
netVersion := "mainnet"
|
||||||
|
if geth.UseTestnet == "true" {
|
||||||
|
netVersion = "testnet"
|
||||||
|
}
|
||||||
|
fmt.Printf("Status\nGit Commit: %s\nBuild Time: %s\nVersion: %s\nNetwork: %s\n",
|
||||||
|
gitCommit, buildStamp, verString, netVersion)
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ type NodeManager struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
UseTestnet = "true" // can be overridden via -ldflags '-X geth.UseTestnet'
|
||||||
nodeManagerInstance *NodeManager
|
nodeManagerInstance *NodeManager
|
||||||
createOnce sync.Once
|
createOnce sync.Once
|
||||||
)
|
)
|
||||||
|
@ -110,7 +111,9 @@ func (m *NodeManager) MakeNode(datadir string, rpcport int) *node.Node {
|
||||||
set.Bool("lightkdf", true, "Reduce key-derivation RAM & CPU usage at some expense of KDF strength")
|
set.Bool("lightkdf", true, "Reduce key-derivation RAM & CPU usage at some expense of KDF strength")
|
||||||
set.Bool("shh", true, "whisper")
|
set.Bool("shh", true, "whisper")
|
||||||
set.Bool("light", true, "disable eth")
|
set.Bool("light", true, "disable eth")
|
||||||
set.Bool("testnet", true, "light test network")
|
if UseTestnet == "true" {
|
||||||
|
set.Bool("testnet", true, "light test network")
|
||||||
|
}
|
||||||
set.Bool("rpc", true, "enable rpc")
|
set.Bool("rpc", true, "enable rpc")
|
||||||
set.String("rpcaddr", "localhost", "host for RPC")
|
set.String("rpcaddr", "localhost", "host for RPC")
|
||||||
set.Int("rpcport", rpcport, "rpc port")
|
set.Int("rpcport", rpcport, "rpc port")
|
||||||
|
|
|
@ -2,9 +2,9 @@ package geth_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
"path/filepath"
|
|
||||||
|
|
||||||
"github.com/status-im/status-go/geth"
|
"github.com/status-im/status-go/geth"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue