mirror of
https://github.com/nolen777/eagle0.git
synced 2026-07-28 21:35:42 +00:00
Complete deproto migration: delete plan and update linter (#5529)
The library/ code is now fully protoless (zero Scala proto dependencies). Transitive deps through C++/Go build tools (map generation) are expected. Changes: - Delete docs/DEPROTO_PLAN.md - migration complete - Delete scripts/build_deps_baseline.txt - no longer needed - Update check_build_deps.sh to enforce zero Scala proto deps in library/ (C++/Go proto deps are allowed as they're build-time tools) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# BUILD dependency baseline - updated Tue Jan 20 21:22:24 PST 2026
|
||||
# Do not increase these numbers - only decrease!
|
||||
library_proto_deps=26
|
||||
+27
-80
@@ -6,16 +6,12 @@
|
||||
# ./scripts/check_build_deps.sh # Check all rules
|
||||
# ./scripts/check_build_deps.sh --ci # CI mode (fail on any violation)
|
||||
# ./scripts/check_build_deps.sh --count # Just count current violations (for tracking progress)
|
||||
# ./scripts/check_build_deps.sh --strict # Fail if proto deps in library/ exceed baseline
|
||||
#
|
||||
# The baseline for proto deps is stored in scripts/build_deps_baseline.txt
|
||||
# Update it with: ./scripts/check_build_deps.sh --update-baseline
|
||||
# ./scripts/check_build_deps.sh --strict # Same as --ci (strict enforcement)
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
||||
BASELINE_FILE="$SCRIPT_DIR/build_deps_baseline.txt"
|
||||
cd "$REPO_ROOT"
|
||||
|
||||
RED='\033[0;31m'
|
||||
@@ -26,15 +22,6 @@ NC='\033[0m' # No Color
|
||||
MODE="${1:-check}"
|
||||
EXIT_CODE=0
|
||||
|
||||
# Get baseline proto count (default to a high number if no baseline exists)
|
||||
get_baseline() {
|
||||
if [ -f "$BASELINE_FILE" ]; then
|
||||
grep "^library_proto_deps=" "$BASELINE_FILE" | cut -d= -f2
|
||||
else
|
||||
echo "999999" # No baseline = don't fail
|
||||
fi
|
||||
}
|
||||
|
||||
# Rule 1: src/main should not depend on src/test
|
||||
check_main_depends_on_test() {
|
||||
echo -e "${YELLOW}Checking: src/main should not depend on src/test...${NC}"
|
||||
@@ -51,26 +38,24 @@ check_main_depends_on_test() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Rule 2: library/ should not depend on src/main/protobuf
|
||||
# Note: This rule is aspirational - there are currently many violations as part of ongoing deproto effort
|
||||
check_library_depends_on_proto() {
|
||||
echo -e "${YELLOW}Checking: library/ should not depend on src/main/protobuf...${NC}"
|
||||
# Rule 2: library/ should not depend on Scala proto types
|
||||
# C++/Go proto deps are allowed (they're build-time deps for map generation tools)
|
||||
check_library_depends_on_scala_proto() {
|
||||
echo -e "${YELLOW}Checking: library/ should not depend on Scala proto types...${NC}"
|
||||
|
||||
violations=$(bazel query 'deps(//src/main/scala/net/eagle0/eagle/library/...) intersect //src/main/protobuf/...' 2>/dev/null || true)
|
||||
count=$(echo "$violations" | grep -c "^//" || echo "0")
|
||||
violations=$(bazel query 'deps(//src/main/scala/net/eagle0/eagle/library/...) intersect //src/main/protobuf/...' 2>/dev/null | grep "_scala_proto" || true)
|
||||
if [ -z "$violations" ]; then
|
||||
count=0
|
||||
else
|
||||
count=$(echo "$violations" | grep -c "^//" || true)
|
||||
fi
|
||||
|
||||
if [ "$count" -gt 0 ]; then
|
||||
echo -e "${YELLOW}Found $count proto dependencies in library/ (deproto in progress)${NC}"
|
||||
if [ "$MODE" == "--count" ]; then
|
||||
echo "$violations" | head -20
|
||||
if [ "$count" -gt 20 ]; then
|
||||
echo "... and $((count - 20)) more"
|
||||
fi
|
||||
fi
|
||||
# Don't fail on this rule yet - it's aspirational
|
||||
return 0
|
||||
echo -e "${RED}VIOLATION: Found $count Scala proto dependencies in library/:${NC}"
|
||||
echo "$violations"
|
||||
return 1
|
||||
else
|
||||
echo -e "${GREEN}✓ No proto dependencies in library/${NC}"
|
||||
echo -e "${GREEN}✓ No Scala proto dependencies in library/${NC}"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
@@ -96,51 +81,21 @@ check_library_depends_on_proto_converters() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Count proto deps for tracking deproto progress
|
||||
# Count proto deps for informational purposes
|
||||
count_proto_deps() {
|
||||
echo -e "${YELLOW}=== Proto dependency counts ===${NC}"
|
||||
|
||||
library_count=$(bazel query 'deps(//src/main/scala/net/eagle0/eagle/library/...) intersect //src/main/protobuf/...' 2>/dev/null | grep -c "^//" || echo "0")
|
||||
echo "library/: $library_count proto dependencies"
|
||||
|
||||
baseline=$(get_baseline)
|
||||
if [ "$baseline" != "999999" ]; then
|
||||
echo "baseline: $baseline"
|
||||
if [ "$library_count" -lt "$baseline" ]; then
|
||||
echo -e "${GREEN}↓ Reduced by $((baseline - library_count)) from baseline${NC}"
|
||||
elif [ "$library_count" -gt "$baseline" ]; then
|
||||
echo -e "${RED}↑ Increased by $((library_count - baseline)) from baseline${NC}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check if proto deps exceed baseline (for strict mode)
|
||||
check_proto_baseline() {
|
||||
library_count=$(bazel query 'deps(//src/main/scala/net/eagle0/eagle/library/...) intersect //src/main/protobuf/...' 2>/dev/null | grep -c "^//" || echo "0")
|
||||
baseline=$(get_baseline)
|
||||
|
||||
echo -e "${YELLOW}Checking: proto deps in library/ should not exceed baseline...${NC}"
|
||||
echo "Current: $library_count, Baseline: $baseline"
|
||||
|
||||
if [ "$library_count" -gt "$baseline" ]; then
|
||||
echo -e "${RED}VIOLATION: Proto dependencies increased from $baseline to $library_count${NC}"
|
||||
echo "Run './scripts/check_build_deps.sh --count' to see which protos are used"
|
||||
return 1
|
||||
scala_proto_results=$(bazel query 'deps(//src/main/scala/net/eagle0/eagle/library/...) intersect //src/main/protobuf/...' 2>/dev/null | grep "_scala_proto" || true)
|
||||
if [ -z "$scala_proto_results" ]; then
|
||||
scala_proto_count=0
|
||||
else
|
||||
echo -e "${GREEN}✓ Proto deps at or below baseline${NC}"
|
||||
return 0
|
||||
scala_proto_count=$(echo "$scala_proto_results" | wc -l | tr -d ' ')
|
||||
fi
|
||||
}
|
||||
echo "library/ Scala proto deps: $scala_proto_count"
|
||||
|
||||
# Update baseline file
|
||||
update_baseline() {
|
||||
library_count=$(bazel query 'deps(//src/main/scala/net/eagle0/eagle/library/...) intersect //src/main/protobuf/...' 2>/dev/null | grep -c "^//" || echo "0")
|
||||
|
||||
echo "# BUILD dependency baseline - updated $(date)" > "$BASELINE_FILE"
|
||||
echo "# Do not increase these numbers - only decrease!" >> "$BASELINE_FILE"
|
||||
echo "library_proto_deps=$library_count" >> "$BASELINE_FILE"
|
||||
|
||||
echo -e "${GREEN}Updated baseline: library_proto_deps=$library_count${NC}"
|
||||
# C++/Go proto deps are expected (map generation tools)
|
||||
all_proto_count=$(bazel query 'deps(//src/main/scala/net/eagle0/eagle/library/...) intersect //src/main/protobuf/...' 2>/dev/null | wc -l | tr -d ' ')
|
||||
echo "library/ all proto deps (includes C++/Go build tools): $all_proto_count"
|
||||
}
|
||||
|
||||
echo "=== BUILD.bazel Dependency Check ==="
|
||||
@@ -150,22 +105,14 @@ case "$MODE" in
|
||||
--count)
|
||||
count_proto_deps
|
||||
;;
|
||||
--ci)
|
||||
--ci|--strict)
|
||||
check_main_depends_on_test || EXIT_CODE=1
|
||||
check_library_depends_on_proto || EXIT_CODE=1
|
||||
check_library_depends_on_scala_proto || EXIT_CODE=1
|
||||
check_library_depends_on_proto_converters || EXIT_CODE=1
|
||||
;;
|
||||
--strict)
|
||||
check_main_depends_on_test || EXIT_CODE=1
|
||||
check_proto_baseline || EXIT_CODE=1
|
||||
check_library_depends_on_proto_converters || EXIT_CODE=1
|
||||
;;
|
||||
--update-baseline)
|
||||
update_baseline
|
||||
;;
|
||||
*)
|
||||
check_main_depends_on_test || EXIT_CODE=1
|
||||
check_library_depends_on_proto
|
||||
check_library_depends_on_scala_proto || EXIT_CODE=1
|
||||
check_library_depends_on_proto_converters || EXIT_CODE=1
|
||||
echo ""
|
||||
count_proto_deps
|
||||
|
||||
Reference in New Issue
Block a user