Schiefelbein, Andrew 37be06e6dc [WIP] transform airship ui into a standalone electron app
Removing octant reference for now, it will need to be
later embedded into the ui

Working on this will require these commands to be run in
the web directory:
npm install
npm install --save-dev electron

behind a proxy npm install may have issues, this might work:
npx cross-env ELECTRON_GET_USE_PROXY=true GLOBAL_AGENT_HTTPS_PROXY=
http://<proxy>:<port> npm install -D electron@latest

Change-Id: I5bd054a767fe8ab7b0461a16eced1921c4de11f6
2020-04-30 08:54:09 -05:00

83 lines
2.2 KiB
Makefile

# Copyright (c) 2019 VMware, Inc. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
SHELL=/bin/bash
# Obtain the version and git commit info
GIT_VERSION=$(shell git describe --match 'v*' --always)
TOOLBINDIR := tools/bin
LINTER := $(TOOLBINDIR)/golangci-lint
LINTER_CONFIG := .golangci.yaml
COVERAGE_OUTPUT := coverage.out
TESTFLAGS ?=
# Override the value of the version variable in main.go
LD_FLAGS= '-X opendev.org/airship/airshipui/internal/commands.version=$(GIT_VERSION)'
GO_FLAGS := -ldflags=$(LD_FLAGS)
BUILD_DIR := bin
# Find all main.go files under cmd, excluding airshipui itself (which is the octant wrapper)
PLUGIN_NAMES := $(filter-out airshipui,$(notdir $(subst /main.go,,$(wildcard cmd/*/main.go))))
PLUGINS := $(addprefix $(BUILD_DIR)/, $(PLUGIN_NAMES))
MAIN := $(BUILD_DIR)/airshipui
EXTENSION :=
ifdef XDG_CONFIG_HOME
OCTANT_PLUGINSTUB_DIR ?= ${XDG_CONFIG_HOME}/octant/plugins
# Determine in on windows
else ifeq ($(OS),Windows_NT)
OCTANT_PLUGINSTUB_DIR ?= $(subst \,/,${LOCALAPPDATA}/octant/plugins)
EXTENSION=.exe
else
OCTANT_PLUGINSTUB_DIR ?= ${HOME}/.config/octant/plugins
endif
DIRS = internal/plugin
RECURSIVE_DIRS = $(addprefix ./, $(addsuffix /..., $(DIRS)))
.PHONY: build
build: $(MAIN) $(PLUGINS)
$(MAIN): FORCE
@mkdir -p $(BUILD_DIR)
go build -o $(MAIN)$(EXTENSION) $(GO_FLAGS) cmd/$(@F)/main.go
$(PLUGINS): FORCE
@mkdir -p $(BUILD_DIR)
go build -o $@$(EXTENSION) $(GO_FLAGS) cmd/$(@F)/main.go
FORCE:
.PHONY: install-plugins
install-plugins: $(PLUGINS)
@mkdir -p $(OCTANT_PLUGINSTUB_DIR)
cp $(addsuffix $(EXTENSION), $^) $(OCTANT_PLUGINSTUB_DIR)
.PHONY: test
test:
go test $(RECURSIVE_DIRS) -v $(TESTFLAGS)
.PHONY: cover
cover: TESTFLAGS += -coverprofile=$(COVERAGE_OUTPUT)
cover: test
go tool cover -html=$(COVERAGE_OUTPUT)
.PHONY: clean
clean:
rm -rf $(BUILD_DIR) $(COVERAGE_OUTPUT)
# The golang-unit zuul job calls the env target, so create one
# Note: on windows if there is a WSL curl in c:\windows\system32
# it will cause problems installing the lint tools.
# The use of cygwin curl is working however
.PHONY: env
.PHONY: lint
lint: $(LINTER)
$(LINTER) run --config $(LINTER_CONFIG)
$(LINTER):
@mkdir -p $(TOOLBINDIR)
./tools/install_linter