Skip to content

Commit

Permalink
Merge pull request #586 from akutz/feature/reduce-build-tags
Browse files Browse the repository at this point in the history
Reduce Build Tags
  • Loading branch information
akutz committed Jul 18, 2017
2 parents 7f26908 + 15a0b3e commit 01dcd63
Show file tree
Hide file tree
Showing 145 changed files with 232 additions and 509 deletions.
56 changes: 27 additions & 29 deletions .travis.yml
Expand Up @@ -11,14 +11,12 @@ os:
- linux

env:
- TRAVIS_GOARCH=amd64 BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- TRAVIS_GOARCH=arm BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- TRAVIS_GOARCH=arm64 BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- VFS_INSTANCEID_USE_FIELDS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- BUILD_TAGS="gofig pflag libstorage_integration_driver_linux"
- BUILD_TAGS=""
- TRAVIS_GOARCH=amd64 COVERAGE_ENABLED=1
- TRAVIS_GOARCH=arm
- TRAVIS_GOARCH=arm64
- VFS_INSTANCEID_USE_FIELDS=true
- LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true
- LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true

matrix:
fast_finish: true
Expand All @@ -27,29 +25,29 @@ matrix:
- go: 1.7.5
- go: tip
exclude:
- go: 1.6.3
env: VFS_INSTANCEID_USE_FIELDS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: 1.6.3
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: 1.6.3
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: 1.7.5
env: VFS_INSTANCEID_USE_FIELDS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: 1.7.5
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: 1.7.5
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: tip
env: VFS_INSTANCEID_USE_FIELDS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: tip
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: tip
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true BUILD_TAGS="gofig pflag libstorage_integration_driver_linux libstorage_storage_driver libstorage_storage_driver_vfs"
- go: 1.6.3
env: VFS_INSTANCEID_USE_FIELDS=true
- go: 1.6.3
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true
- go: 1.6.3
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true
- go: 1.7.5
env: VFS_INSTANCEID_USE_FIELDS=true
- go: 1.7.5
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true
- go: 1.7.5
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true
- go: tip
env: VFS_INSTANCEID_USE_FIELDS=true
- go: tip
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS=true
- go: tip
env: LIBSTORAGE_TEST_TCP=false LIBSTORAGE_TEST_TCP_TLS_PEERS=true

before_install:
- export GOARCH="${TRAVIS_GOARCH:-amd64}"
- go env
- if [ "$BUILD_TAGS" = "$DEFAULT_BUILD_TAGS" ] && [ "$TRAVIS_GO_VERSION" = "$COVERED_GO_VERSION" ]; then echo coverage enabled; fi
- if [ "$COVERAGE_ENABLED" = "1" ] && [ "$TRAVIS_GO_VERSION" = "$COVERED_GO_VERSION" ]; then echo coverage enabled; fi
- git config --global 'url.https://gopkg.in/yaml.v1.insteadof' 'https://gopkg.in/yaml.v1/'
- git config --global 'url.https://gopkg.in/yaml.v2.insteadof' 'https://gopkg.in/yaml.v2/'
- git config --global 'url.https://gopkg.in/fsnotify.v1.insteadof' 'https://gopkg.in/fsnotify.v1/'
Expand All @@ -62,10 +60,10 @@ before_install:
script:
- make gometalinter-all
- make -j build
- if [ "$GOARCH" = "amd64" ] && [ "$BUILD_TAGS" = "$DEFAULT_BUILD_TAGS" ] && [ "$TRAVIS_GO_VERSION" = "$COVERED_GO_VERSION" ]; then make -j test; fi
- if [ "$GOARCH" = "amd64" ] && [ "$TRAVIS_GO_VERSION" = "$COVERED_GO_VERSION" ]; then make -j test; fi

after_success:
- if [ "$GOARCH" = "amd64" ] && [ "$BUILD_TAGS" = "$DEFAULT_BUILD_TAGS" ] && [ "$TRAVIS_GO_VERSION" = "$COVERED_GO_VERSION" ]; then make -j cover; fi
- if [ "$GOARCH" = "amd64" ] && [ "$COVERAGE_ENABLED" = "1" ] && [ "$TRAVIS_GO_VERSION" = "$COVERED_GO_VERSION" ]; then make -j cover; fi

addons:
apt:
Expand Down
37 changes: 11 additions & 26 deletions Makefile
Expand Up @@ -2,22 +2,13 @@ SHELL := /bin/bash

GO_VERSION := 1.8

ifeq (undefined,$(origin BUILD_TAGS))
BUILD_TAGS := gofig \
pflag \
libstorage_integration_driver_linux
ifneq (true,$(TRAVIS))
BUILD_TAGS += libstorage_storage_driver \
libstorage_storage_driver_vfs
endif
endif

ifneq (,$(DRIVERS))
BUILD_TAGS += libstorage_storage_driver
BUILD_TAGS += $(foreach d,$(DRIVERS),libstorage_storage_driver_$(d))
# add DRIVERS to the list of Go build tags stored in BUILD_TAGS
ifneq (,$(strip $(DRIVERS)))
BUILD_TAGS += $(DRIVERS)
endif

ifneq (,$(BUILD_TAGS))
# sort the BUILD_TAGS. this has the side-effect of removing duplicates
ifneq (,$(strip $(BUILD_TAGS)))
BUILD_TAGS := $(sort $(BUILD_TAGS))
endif

Expand Down Expand Up @@ -1137,19 +1128,13 @@ cover-debug:
################################################################################
deps: $(GO_DEPS)

build-tests: $(GO_BUILD_TESTS)

build-lss: $(LSS_ALL)

build-libstorage: $(GO_BUILD)

build-generated:
$(MAKE) $(API_GENERATED_SRC)

build-client-nogofig:
go build ./client


clean-build:
rm -fr $(API_GENERATED_SRC)
$(MAKE) build
Expand All @@ -1162,11 +1147,12 @@ ifeq ($(GOOS)_$(GOARCH),$(GOHOSTOS)_$(GOHOSTARCH))
endif
$(MAKE) build-lss

parallel-test: $(filter-out ./drivers/storage/vfs/%,$(GO_TEST))
vfs-test: $(filter ./drivers/storage/vfs/%,$(GO_TEST))
test:
$(MAKE) vfs-test
$(MAKE) -j parallel-test
build-tests:$(filter-out ./drivers/storage/%,$(GO_BUILD_TESTS)) \
$(filter ./drivers/storage/vfs/%,$(GO_BUILD_TESTS))

test: build-tests
$(MAKE) -j $(filter-out ./drivers/storage/%,$(GO_TEST))
DRIVERS=vfs $(MAKE) $(filter ./drivers/storage/vfs/%,$(GO_TEST))

test-debug:
LIBSTORAGE_DEBUG=true $(MAKE) test
Expand Down Expand Up @@ -1220,7 +1206,6 @@ test-rbd:
test-rbd-clean:
DRIVERS=rbd $(MAKE) clean


test-vfs:
DRIVERS=vfs $(MAKE) ./drivers/storage/vfs/tests/vfs.test

Expand Down
15 changes: 12 additions & 3 deletions api/registry/registry_config.go
@@ -1,11 +1,20 @@
package registry

import (
gofig "github.com/akutz/gofig/types"
"github.com/akutz/gofig"

"github.com/codedellemc/libstorage/api/types"
)

// NewConfig is a function that returns a new Config object.
var NewConfig func() gofig.Config
var NewConfig = gofig.New

// NewConfigReg is a function that returns a new ConfigRegistration object.
var NewConfigReg func(string) gofig.ConfigRegistration
var NewConfigReg = gofig.NewRegistration

// ProcessRegisteredConfigs processes the registered configuration requests.
func ProcessRegisteredConfigs(ctx types.Context) {
for r := range ConfigRegs(ctx) {
gofig.Register(r)
}
}
20 changes: 0 additions & 20 deletions api/registry/registry_config_gofig.go

This file was deleted.

10 changes: 0 additions & 10 deletions api/registry/registry_config_nogofig.go

This file was deleted.

12 changes: 7 additions & 5 deletions api/server/server.go
Expand Up @@ -25,11 +25,13 @@ import (
"github.com/codedellemc/libstorage/api/utils"
apicnfg "github.com/codedellemc/libstorage/api/utils/config"

// imported to load routers
_ "github.com/codedellemc/libstorage/imports/routers"

// imported to load remote storage drivers
_ "github.com/codedellemc/libstorage/imports/remote"
// import and load the routers
_ "github.com/codedellemc/libstorage/api/server/router/help"
_ "github.com/codedellemc/libstorage/api/server/router/root"
_ "github.com/codedellemc/libstorage/api/server/router/service"
_ "github.com/codedellemc/libstorage/api/server/router/snapshot"
_ "github.com/codedellemc/libstorage/api/server/router/tasks"
_ "github.com/codedellemc/libstorage/api/server/router/volume"
)

var (
Expand Down
5 changes: 1 addition & 4 deletions cli/lss/lss.go
@@ -1,5 +1,3 @@
// +build gofig pflag

package lss

import (
Expand All @@ -26,8 +24,7 @@ import (

// load the drivers
_ "github.com/codedellemc/libstorage/imports/config"
_ "github.com/codedellemc/libstorage/imports/remote"
_ "github.com/codedellemc/libstorage/imports/routers"
_ "github.com/codedellemc/libstorage/imports/storage"
)

var (
Expand Down
15 changes: 0 additions & 15 deletions cli/lss/lss_nogofig.go

This file was deleted.

10 changes: 8 additions & 2 deletions client/client.go
Expand Up @@ -11,8 +11,14 @@ import (
"github.com/codedellemc/libstorage/api/utils"
apicnfg "github.com/codedellemc/libstorage/api/utils/config"

// load the local imports
_ "github.com/codedellemc/libstorage/imports/local"
// load the config
_ "github.com/codedellemc/libstorage/imports/config"

// load the libStorage storage executors
_ "github.com/codedellemc/libstorage/imports/executors"

// load the libStorage storage driver
_ "github.com/codedellemc/libstorage/drivers/storage/libstorage"
)

type client struct {
Expand Down
@@ -1,4 +1,4 @@
package local
package client

import (
// load the packages
Expand Down
@@ -1,8 +1,7 @@
// +build libstorage_integration_driver_linux

package local
package client

import (
// load the packages
_ "github.com/codedellemc/libstorage/drivers/integration/linux"
_ "github.com/codedellemc/libstorage/drivers/os/linux"
)
55 changes: 55 additions & 0 deletions drivers/integration/linux/linux.go
Expand Up @@ -2,6 +2,7 @@ package linux

import (
"os"
"path"

"fmt"

Expand Down Expand Up @@ -607,3 +608,57 @@ func (d *driver) volumeCreateImplicit() bool {
func (d *driver) volumeRemoveForce() bool {
return d.config.GetBool(types.ConfigIgVolOpsRemoveForce)
}

// register the gofig configuration
func init() {
registry.RegisterConfigReg(
"Integration",
func(ctx types.Context, r gofig.ConfigRegistration) {

r.Key(
gofig.String,
"", "ext4", "",
types.ConfigIgVolOpsCreateDefaultFsType)

r.Key(
gofig.String,
"", "", "", types.ConfigIgVolOpsCreateDefaultType)

r.Key(
gofig.String,
"", "", "",
types.ConfigIgVolOpsCreateDefaultIOPS)

r.Key(
gofig.String,
"", "16", "",
types.ConfigIgVolOpsCreateDefaultSize)

r.Key(
gofig.String,
"", "", "",
types.ConfigIgVolOpsCreateDefaultAZ)

r.Key(
gofig.String,
"",
path.Join(context.MustPathConfig(ctx).Lib, "volumes"),
"",
types.ConfigIgVolOpsMountPath)

r.Key(
gofig.String,
"", "/data", "",
types.ConfigIgVolOpsMountRootPath)

r.Key(
gofig.Bool,
"", true, "",
types.ConfigIgVolOpsCreateImplicit)

r.Key(
gofig.Bool,
"", false, "",
types.ConfigIgVolOpsMountPreempt)
})
}

0 comments on commit 01dcd63

Please sign in to comment.