forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dep-assert.sh
executable file
·37 lines (31 loc) · 1017 Bytes
/
dep-assert.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -o errexit
CWD=$(pwd)
# no simapp imports in modules
SIMAPP_REGEX="cosmossdk.io/simapp"
find . -type f -name 'go.mod' -print0 | while IFS= read -r -d '' file
do
d=$(dirname "$file")
if [[ "$d" =~ \./simapp$|\./simapp/v2$|\./tests* ]]; then
continue
fi
if cd "$CWD/$d" && go list -test -f '{{ .Imports }}' ./... | grep -q -E "${SIMAPP_REGEX}"; then
echo "${d} has a dependency on simapp!"
exit 1
fi
done
# no runtime/v2 or server/v2 imports in x/ modules
RUNTIMEV2_REGEX="cosmossdk.io/runtime/v2"
SEVERV2_REGEX="cosmossdk.io/server/v2"
find ./x/ -type f -name 'go.mod' -print0 | while IFS= read -r -d '' file
do
d=$(dirname "$file")
if cd "$CWD/$d" && go list -test -f '{{ .Imports }}' ./... | grep -q -E "${RUNTIMEV2_REGEX}"; then
echo "${d} has a dependency on runtime/v2!"
exit 1
fi
if cd "$CWD/$d" && go list -test -f '{{ .Imports }}' ./... | grep -q -E "${SEVERV2_REGEX}"; then
echo "${d} has a dependency on server/v2!"
exit 1
fi
done