mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-27 10:45:08 -06:00
Makefile: Future proof the wasm runtime flag
Signed-off-by: Torin Sandall <torinsandall@gmail.com>
This commit is contained in:
@@ -5,15 +5,15 @@
|
||||
VERSION := $(shell ./build/get-build-version.sh)
|
||||
|
||||
CGO_ENABLED ?= 1
|
||||
WASMER_ENABLED ?= 1
|
||||
WASM_ENABLED ?= 1
|
||||
|
||||
# Force modules on and to use the vendor directory.
|
||||
GO := CGO_ENABLED=$(CGO_ENABLED) GO111MODULE=on GOFLAGS=-mod=vendor go
|
||||
GO_TEST_TIMEOUT := -timeout 30m
|
||||
|
||||
GO_TAGS := -tags=
|
||||
ifeq ($(WASMER_ENABLED),1)
|
||||
GO_TAGS = -tags=opa_wasmer
|
||||
ifeq ($(WASM_ENABLED),1)
|
||||
GO_TAGS = -tags=opa_wasm
|
||||
endif
|
||||
|
||||
GOVERSION := $(shell cat ./.go-version)
|
||||
@@ -221,7 +221,7 @@ CI_GOLANG_DOCKER_MAKE := $(DOCKER) run \
|
||||
-w /src \
|
||||
-e GOCACHE=/src/.go/cache \
|
||||
-e CGO_ENABLED=$(CGO_ENABLED) \
|
||||
-e WASMER_ENABLED=$(WASMER_ENABLED) \
|
||||
-e WASM_ENABLED=$(WASM_ENABLED) \
|
||||
-e FUZZ_TIME=$(FUZZ_TIME) \
|
||||
-e TELEMETRY_URL=$(TELEMETRY_URL) \
|
||||
golang:$(GOVERSION) \
|
||||
@@ -248,17 +248,17 @@ build-docker: ensure-release-dir
|
||||
|
||||
.PHONY: build-linux
|
||||
build-linux: ensure-release-dir
|
||||
@$(MAKE) build GOOS=linux CGO_ENABLED=0 WASMER_ENABLED=0
|
||||
@$(MAKE) build GOOS=linux CGO_ENABLED=0 WASM_ENABLED=0
|
||||
mv opa_linux_$(GOARCH) $(RELEASE_DIR)/
|
||||
|
||||
.PHONY: build-darwin
|
||||
build-darwin: ensure-release-dir
|
||||
@$(MAKE) build GOOS=darwin CGO_ENABLED=0 WASMER_ENABLED=0
|
||||
@$(MAKE) build GOOS=darwin CGO_ENABLED=0 WASM_ENABLED=0
|
||||
mv opa_darwin_$(GOARCH) $(RELEASE_DIR)/
|
||||
|
||||
.PHONY: build-windows
|
||||
build-windows: ensure-release-dir
|
||||
@$(MAKE) build GOOS=windows CGO_ENABLED=0 WASMER_ENABLED=0
|
||||
@$(MAKE) build GOOS=windows CGO_ENABLED=0 WASM_ENABLED=0
|
||||
mv opa_windows_$(GOARCH) $(RELEASE_DIR)/opa_windows_$(GOARCH).exe
|
||||
|
||||
.PHONY: ensure-release-dir
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ function opa::check_vet() {
|
||||
rc=0
|
||||
exit_code=0
|
||||
for pkg in $(opa::go_packages); do
|
||||
go vet -tags=opa_wasmer $pkg || rc=$?
|
||||
go vet -tags=opa_wasm $pkg || rc=$?
|
||||
if [[ $rc != 0 ]]; then
|
||||
exit_code=1
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
GOFLAGS=-mod=vendor GO111MODULE=on GOOS="" GOARCH="" go run -tags=wasmer ./vendor/golang.org/x/tools/cmd/goimports -local github.com/open-policy-agent/opa $@
|
||||
GOFLAGS=-mod=vendor GO111MODULE=on GOOS="" GOARCH="" go run -tags=opa_wasm ./vendor/golang.org/x/tools/cmd/goimports -local github.com/open-policy-agent/opa $@
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by an Apache2
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build !opa_wasmer
|
||||
// +build !opa_wasm
|
||||
|
||||
package wasm
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by an Apache2
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// +build opa_wasmer
|
||||
// +build opa_wasm
|
||||
|
||||
package wasm
|
||||
|
||||
|
||||
Reference in New Issue
Block a user