#!/usr/bin/make -f

#export DH_VERBOSE := 1
# Disable conformance due to it requires with Bazel workspace, and not to vendoring it due to out of previous discussion.
export DH_GOLANG_EXCLUDES := examples codelab repl/main conformance
export DH_GOLANG_INSTALL_EXTRA := cel/templates/authoring.tmpl

export BUILDDIR := build

%:
	dh $@ --builddirectory=$(BUILDDIR)

execute_before_dh_auto_configure:
	mkdir -p -v $(BUILDDIR)/src/cel.dev/cel-go/vendor
	cp -v -a debian/missing-sources/* $(BUILDDIR)/src/cel.dev/cel-go/vendor

override_dh_install:
	find debian/golang-cel-cel-go-dev/usr/share/gocode/src/cel.dev/cel-go/ \
	    -type f -exec chmod -x \{\} \;
	dh_install -i

override_dh_auto_test:
	# Allow tests failed on 32bits DEB_HOST_ARCH_BITS
ifeq ($(DEB_HOST_ARCH_BITS),32)
	GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn dh_auto_test -- -short || true
else
	# Set to warn to workaround the conflict registration from vendor/
	# Disable flaky tests #1146551
	GOLANG_PROTOBUF_REGISTRATION_CONFLICT=warn dh_auto_test -- -short -skip="\
	TestContextEval|\
	TestConcurrentEval|\
	TestInterpreter_InterruptableEval|\
	"
endif


