mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Add script to ensure visibility is OK (#332)
* Add script to ensure visibility is OK * typo * another typo
This commit is contained in:
parent
2bd1e334bc
commit
5776e573ed
@ -65,9 +65,12 @@ matrix:
|
||||
test \
|
||||
//... $REMOTE_FLAGS
|
||||
|
||||
# Check that BUILD files are formatted correctly.
|
||||
# Check that BUILD files are formatted correctly.
|
||||
- ./check_gazelle.sh
|
||||
|
||||
# Check that target visibility is correct..
|
||||
- ./check_visibility.sh
|
||||
|
||||
# Shutdown must be last.
|
||||
- bazel shutdown
|
||||
|
||||
|
@ -4,7 +4,7 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["service.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/network",
|
||||
visibility = ["//visibility:public"],
|
||||
visibility = ["//beacon-chain:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/types:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
|
@ -4,7 +4,7 @@ go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["service.go"],
|
||||
importpath = "github.com/prysmaticlabs/prysm/beacon-chain/sync",
|
||||
visibility = ["//visibility:public"],
|
||||
visibility = ["//beacon-chain:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/types:go_default_library",
|
||||
"@com_github_sirupsen_logrus//:go_default_library",
|
||||
|
29
check_visibility.sh
Executable file
29
check_visibility.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Continous Integration script to check that BUILD.bazel files have the correct
|
||||
# visibility.
|
||||
|
||||
# Protected packages are:
|
||||
# //beacon-chain/...
|
||||
# //client/...
|
||||
|
||||
# Duplicate redirect 5 to stdout so that it can be captured, but still printed
|
||||
# nicely.
|
||||
exec 5>&1
|
||||
|
||||
# Run gazelle while piping a copy of the output to stdout via 5.
|
||||
changes=$(
|
||||
bazel query 'visible(//... except (//beacon-chain/... union //client/...), (//beacon-chain/... union //client/...))' | tee >(cat - >&5)
|
||||
)
|
||||
|
||||
# If the captured stdout is not empty then targets are exposed!
|
||||
if [ -z "$changes" ]
|
||||
then
|
||||
echo "OK: Visibility is good."
|
||||
exit 0
|
||||
else
|
||||
echo "FAIL: The above targets belong to protected packages and the targets \
|
||||
are visible outside of their package!"
|
||||
echo "Please reduce the target visibility."
|
||||
exit 1
|
||||
fi
|
Loading…
Reference in New Issue
Block a user