peridot/scripts/govendor
2023-10-04 02:55:49 +02:00

32 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
go mod tidy
go mod vendor
find vendor -name "BUILD.bazel" -delete
find vendor -name "BUILD" -delete
# if the vendor package has a build/BUILD directory/file, then force BUILD.bazel
for d in $(find vendor -iname build); do
echo '' > $(dirname $d)/BUILD.bazel
done
# run nfv2 to generate replace entries for generated content
# we don't want to invoke bazel all the time so check if it's built already
if [[ ! -f bazel-bin/devtools/nfv2/nfv2_/nfv2 ]]; then
bazel build //devtools/nfv2
fi
# it's meant to be run with bazel but it only requires the workspace directory env
BUILD_WORKSPACE_DIRECTORY="$(pwd)" bazel-bin/devtools/nfv2/nfv2_/nfv2
# hot patch Pika because it has a stupid low limit for page size
# this is a hack and should be removed once we have a proper solution
sed -i .orig 's/100/1000/g' vendor/go.ciq.dev/pika/pika_page_token.go
bazel run //:gazelle
# we don't care about the local repository warnings from updating the deps.bzl file
# obviously ignoring all errors is stupid, but the warnings are too noisy
# todo(mustafa): figure out a filter for the warnings
bazel run //:gazelle-update-repos 2>/dev/null