Skip to content

Commit

Permalink
Issue containers#324 Adding a build target and ensure compilation on …
Browse files Browse the repository at this point in the history
…macOS

- Making sure that build target can handle build tags and build on macOS
- Adding target to go fmt target

Signed-off-by: Hardy Ferentschik <hardy@hibernate.org>
  • Loading branch information
hferentschik committed Aug 14, 2017
1 parent 74e3593 commit a91704d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@ SKOPEO_REPO = projectatomic/skopeo
SKOPEO_BRANCH = master
# Set SUDO=sudo to run container integration tests using sudo.
SUDO =
BUILDTAGS = btrfs_noversion libdm_no_deferred_remove
BUILDTAGS ?= btrfs_noversion libdm_no_deferred_remove
BUILDFLAGS := -tags "$(BUILDTAGS)"

PACKAGES := $(shell go list ./... | grep -v github.com/containers/image/vendor)
SOURCE_DIRS := $(shell echo $(PACKAGES) | tr " " "\n" | awk -F '/' '{print $$4}')

all: tools .gitvalidation test validate
all: tools build .gitvalidation test validate

build: vendor
go build $(BUILDFLAGS) $(PACKAGES)

tools: tools.timestamp

Expand All @@ -28,7 +32,7 @@ clean:
rm -rf vendor tools.timestamp

test: vendor
@go test $(BUILDFLAGS) -cover $(PACKAGES)
go test $(BUILDFLAGS) -cover $(PACKAGES)

# This is not run as part of (make all), but Travis CI does run this.
# Demonstarting a working version of skopeo (possibly with modified SKOPEO_REPO/SKOPEO_BRANCH, e.g.
Expand All @@ -47,6 +51,10 @@ test-skopeo:
$(SUDO) make BUILDTAGS="$(BUILDTAGS)" check && \
rm -rf $${skopeo_path}

.PHONY: fmt
fmt:
@gofmt -l -s -w $(SOURCE_DIRS)

validate: lint
@go vet $(PACKAGES)
@test -z "$$(gofmt -s -l . | grep -ve '^vendor' | tee /dev/stderr)"
Expand Down
2 changes: 2 additions & 0 deletions ostree/ostree_dest.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !containers_image_ostree_stub

package ostree

import (
Expand Down
3 changes: 3 additions & 0 deletions ostree/ostree_stub.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// +build containers_image_ostree_stub

package ostree
2 changes: 2 additions & 0 deletions ostree/ostree_transport.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !containers_image_ostree_stub

package ostree

import (
Expand Down
2 changes: 2 additions & 0 deletions ostree/ostree_transport_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// +build !containers_image_ostree_stub

package ostree

import (
Expand Down

0 comments on commit a91704d

Please sign in to comment.