From 5b6f0c4efbfdc0c9bcb440c8da132bdaee4e518d Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Thu, 6 Sep 2018 08:11:19 -0700 Subject: Improve compilation process The current architecture offers the possibility to add more plugins and extend the its functionality. This flexibility has to be supported during the compilation process. This change modify the Makefile to find plugins and compile them. It also adds a start.sh script which allows to run MultiCloud services without the need of packaging their binaries in a container. Change-Id: I9271c51daa4fd9156717e37f1818886c72e36c27 Signed-off-by: Victor Morales Issue-ID: MULTICLOUD-301 --- src/k8splugin/Makefile | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/k8splugin/Makefile b/src/k8splugin/Makefile index 542de958..6171d8c2 100644 --- a/src/k8splugin/Makefile +++ b/src/k8splugin/Makefile @@ -16,10 +16,9 @@ export GOPATH ... all: clean dep - CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -a -tags netgo -o ./deployment.so ./plugins/deployment/plugin.go - CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -a -tags netgo -o ./namespace.so ./plugins/namespace/plugin.go - CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -a -tags netgo -o ./service.so ./plugins/service/plugin.go - CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o ./k8plugin ./cmd/main.go + CGO_ENABLED=1 GOOS=linux GOARCH=amd64 + @find plugins -type d -not -path plugins -exec sh -c "ls {}/plugin.go | xargs go build -buildmode=plugin -a -tags netgo -o $(basename {}).so" \; + go build -a -tags netgo -o ./k8plugin ./cmd/main.go # The following is done this way as each patch on CI runs build and each merge runs deploy. So for build we don't need to build binary and hence # no need to create a static binary with additional flags. However, for generating binary, additional build flags are necessary. This if used with @@ -36,9 +35,7 @@ format: go fmt ./... plugins: - go build -buildmode=plugin -o ./plugins/deployment/deployment.so ./plugins/deployment/plugin.go - go build -buildmode=plugin -o ./plugins/namespace/namespace.so ./plugins/namespace/plugin.go - go build -buildmode=plugin -o ./plugins/service/service.so ./plugins/service/plugin.go + @find plugins -type d -not -path plugins -exec sh -c "ls {}/plugin.go | xargs go build -buildmode=plugin -o $(basename {}).so" \; dep: go get -u $(DEPENDENCIES) -- cgit 1.2.3-korg