Modifies Makefile to support multiple plugins

Introduces new convention for plugins that fixes
multi plugin support

Each plugin name will exist at :
- cmd/<plugin name>/main.go
  Definitions to call plugin registration

- internal/plugin/<plugin name>
  Implementations for Navigation, Tab and Print as appropriate

Change-Id: I6f5e71900eb90b26917216ebd1a2749acc4f5a52
This commit is contained in:
jezogwza 2019-11-06 16:51:05 +00:00 committed by Rodolfo Pacheco
parent e4e14c891a
commit b273aab419
3 changed files with 26 additions and 20 deletions

View File

@ -8,6 +8,7 @@ GIT_VERSION=$(shell git describe --match 'v*' --always)
# Override the value of the version variable in main.go
LD_FLAGS= '-X main.version=$(GIT_VERSION)'
GO_FLAGS= -ldflags=$(LD_FLAGS)
PLUGINS:= $(shell ls cmd)
ifdef XDG_CONFIG_HOME
OCTANT_PLUGINSTUB_DIR ?= ${XDG_CONFIG_HOME}/octant/plugins
@ -20,11 +21,16 @@ endif
DIRS = internal pkg
RECURSIVE_DIRS = $(addsuffix /...,$(DIRS))
#.PHONY: install-plugin
#install-plugin:
# mkdir -p $(OCTANT_PLUGINSTUB_DIR)
# go build -o $(OCTANT_PLUGINSTUB_DIR)/airship-ui-plugin $(GO_FLAGS) opendev.org/airship/airshipui/cmd/airshipui
.PHONY: install-plugin
install-plugin:
.PHONY: install-plugins
install-plugins: $(PLUGINS)
$(PLUGINS):
mkdir -p $(OCTANT_PLUGINSTUB_DIR)
go build -o $(OCTANT_PLUGINSTUB_DIR)/airship-ui-plugin $(GO_FLAGS) opendev.org/airship/airshipui/cmd/airshipui
go build -o $(OCTANT_PLUGINSTUB_DIR)/$@-plugin $(GO_FLAGS) opendev.org/airship/airshipui/cmd/$@
.PHONY: test
test: generate

View File

@ -4,7 +4,7 @@ import (
"fmt"
"log"
"opendev.org/airship/airshipui/internal/plugin"
"opendev.org/airship/airshipui/internal/plugin/airshipui"
)
var (