Skip to content

Commit

Permalink
Merge pull request #4445 from ipfs/fix/4427
Browse files Browse the repository at this point in the history
build for all supported platforms when testing
  • Loading branch information
whyrusleeping committed Dec 4, 2017
2 parents 6104cfd + 6917d2f commit e8cad12
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/ipfs/Rules.mk
Expand Up @@ -2,6 +2,7 @@ include mk/header.mk
IPFS_BIN_$(d) := $(call go-curr-pkg-tgt)

TGT_BIN += $(IPFS_BIN_$(d))
TEST += $(d)-try-build
CLEAN += $(IPFS_BIN_$(d))

PATH := $(realpath $(d)):$(PATH)
Expand All @@ -14,12 +15,22 @@ PATH := $(realpath $(d)):$(PATH)

$(d)_flags =-ldflags="-X "github.com/ipfs/go-ipfs/repo/config".CurrentCommit=$(shell git rev-parse --short HEAD)"

$(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags)
$(d)-try-build $(IPFS_BIN_$(d)): GOFLAGS += $(cmd/ipfs_flags)

# uses second expansion to collect all $(DEPS_GO)
$(IPFS_BIN_$(d)): $(d) $$(DEPS_GO) ALWAYS #| $(DEPS_OO_$(d))
$(go-build)

TRY_BUILD_$(d)=$(addprefix $(d)-try-build-,$(SUPPORTED_PLATFORMS))
$(d)-try-build: $(TRY_BUILD_$(d))
.PHONY: $(d)-try-build

$(TRY_BUILD_$(d)): private PLATFORM = $(subst -, ,$(patsubst $<-try-build-%,%,$@))
$(TRY_BUILD_$(d)): private GOOS = $(word 1,$(PLATFORM))
$(TRY_BUILD_$(d)): private GOARCH = $(word 2,$(PLATFORM))
$(TRY_BUILD_$(d)): $(d) $$(DEPS_GO) ALWAYS
GOOS=$(GOOS) GOARCH=$(GOARCH) $(go-try-build)
.PHONY: $(TRY_BUILD_$(d))

$(d)-install: GOFLAGS += $(cmd/ipfs_flags)
$(d)-install: $(d) $$(DEPS_GO) ALWAYS
Expand Down
4 changes: 4 additions & 0 deletions mk/golang.mk
Expand Up @@ -23,6 +23,10 @@ define go-build
$(GOCC) build -i $(go-flags-with-tags) -o "$@" "$(call go-pkg-name,$<)"
endef

define go-try-build
$(GOCC) build $(go-flags-with-tags) -o /dev/null "$(call go-pkg-name,$<)"
endef

test_go_short: GOTFLAGS += -test.short
test_go_short: test_go_expensive
.PHONY: test_go_short
Expand Down
11 changes: 11 additions & 0 deletions mk/util.mk
Expand Up @@ -9,6 +9,17 @@ else
PATH_SEP :=:
endif

# SUPPORTED_PLATFORM += windows/386 FIXME: #4438 (badger bug)
SUPPORTED_PLATFORMS += windows-amd64

SUPPORTED_PLATFORMS += linux-arm
SUPPORTED_PLATFORMS += linux-arm64
SUPPORTED_PLATFORMS += linux-386
SUPPORTED_PLATFORMS += linux-amd64

SUPPORTED_PLATFORMS += darwin-386
SUPPORTED_PLATFORMS += darwin-amd64

space:=
space+=
comma:=,
Expand Down

0 comments on commit e8cad12

Please sign in to comment.