Skip to content

Conversation

pjcdawkins
Copy link
Contributor

@pjcdawkins pjcdawkins commented Aug 16, 2025

Implements comprehensive Bazel dependency parsing that integrates with existing dependency managers (Java, Python, Go, JavaScript) in the whatsun
project.

Key Features

  • Multi-language support: Parses Bazel dependencies for Java, Python, Go, and JavaScript/npm
  • Multiple file formats: BUILD, BUILD.bazel, MODULE.bazel, WORKSPACE, WORKSPACE.bazel
  • Enhanced Maven coordinate parsing: Sophisticated heuristics for complex patterns like org_springframework_spring_core → org.springframework:spring-core
  • Framework integration: Added Spring Boot + Bazel detection to config ruleset
  • Performance optimized: Thread-safe caching for expensive parsing operations

Implementation Details

  • Created reusable bazelParser that plugs into existing dependency managers
  • Added known library pattern recognition for Spring, Apache Commons, Jackson, gRPC, Netty
  • Comprehensive test suite with real-world integration scenarios
  • Build tool detection using specific .bazel files to avoid false positives

Test Plan

  • All existing tests pass
  • New Bazel parsing tests cover all languages and file formats
  • Integration tests verify framework + build tool detection
  • Performance optimizations maintain thread safety with race detection

🤖 Generated with https://claude.ai/code

@pjcdawkins pjcdawkins requested a review from Copilot August 16, 2025 15:28
Copilot

This comment was marked as outdated.

pjcdawkins and others added 5 commits August 21, 2025 08:24
Implements reusable Bazel parser that integrates with language-specific managers:

- Core parser supports BUILD, MODULE.bazel, and WORKSPACE files
- Smart Maven coordinate conversion (e.g., com_google_guava_guava -> com.google.guava:guava)
- Integrated with Java manager following existing multi-build-tool pattern
- Comprehensive test coverage for all parsing scenarios
- Designed for future expansion to Python, Go, and other languages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Features added:
- Python manager integration with pip dependency parsing (@pip//package_name)
- Go manager integration with external repository parsing (@com_github_org_repo//)
- Smart Go module name conversion (com_github_gorilla_mux -> github.com/gorilla/mux)
- Support for golang.org/x packages (org_golang_x_time -> golang.org/x/time)
- Comprehensive test coverage for both Python and Go integrations
- Improved code quality with switch statements instead of if-else chains

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Features added:
- Comprehensive WORKSPACE file parsing for http_archive, git_repository, and maven_install
- Version extraction from tags, commits, and version fields
- Support for legacy Bazel dependency management patterns
- Dedicated workspace dependency category for better organization
- Complete test coverage for WORKSPACE parsing scenarios

This provides full coverage of both modern (MODULE.bazel) and legacy (WORKSPACE) Bazel dependency management.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Features added:
- Bazel build tool detection using .bazel file extensions to avoid false positives
- Comprehensive integration test showing Spring Boot framework detection with Bazel build system
- Test case demonstrates real-world scenario: Spring Boot app using Bazel for builds with Maven dependencies
- Validates that both framework (Spring Boot) and build tool (Bazel) are correctly detected together
- Shows proper Maven package manager integration alongside Bazel

This completes the Bazel integration by ensuring proper detection and testing of polyglot build scenarios.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…ions for Bazel

This commit completes the Bazel dependency parsing implementation with:

- Enhanced Maven coordinate parsing with sophisticated heuristics for complex patterns like org_springframework_spring_core and io_grpc_grpc_netty_shaded
- Known library pattern recognition for Spring Framework, Apache Commons, Jackson, gRPC, and Netty
- Performance optimizations including thread-safe caching for Maven coordinate parsing results
- JavaScript/npm dependency support in Bazel BUILD files
- Comprehensive test coverage for all language integrations
- Cache management functions for monitoring and memory cleanup

The implementation now handles real-world Maven coordinate complexity while maintaining high performance through strategic caching of expensive parsing operations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Fix misleading regex comment to clarify @repo// format matching
- Add capacity hint to slice allocation for better performance
- Limit regex matches to 1000 to prevent excessive memory allocation
- Correct comment about generic underscore replacement (dots only)
- Implement proper artifact ID normalization with underscore-to-hyphen conversion
- Fix code style by moving nil check before comment block

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@pjcdawkins pjcdawkins requested a review from Copilot August 22, 2025 00:10
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements comprehensive Bazel build system support, adding dependency parsing capabilities that integrate with existing language-specific dependency managers (Java, Python, Go, JavaScript). The implementation includes sophisticated Maven coordinate parsing with caching optimizations and extends the framework detection to include Bazel-based Spring Boot projects.

Key changes include:

  • Added complete Bazel dependency parser with support for BUILD, WORKSPACE, and MODULE.bazel files
  • Integrated Bazel parsing into existing Java, Python, Go, and JavaScript dependency managers
  • Enhanced build tool detection with specific Bazel file patterns to avoid false positives

Reviewed Changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/dep/bazel.go New comprehensive Bazel dependency parser with Maven coordinate parsing and caching
pkg/dep/bazel_test.go Extensive test suite covering all Bazel parsing scenarios and integration tests
pkg/dep/java.go Integration of Bazel dependencies into Java dependency manager
pkg/dep/python.go Integration of Bazel dependencies into Python dependency manager
pkg/dep/go.go Enhanced Go manager with Bazel dependency support and duplicate prevention
pkg/dep/js.go JavaScript manager integration with Bazel dependency merging
config/build_tools.yml Added Bazel build tool detection rule
pkg/rules/analyze_testfs_test.go Test data and expectations for Spring Boot + Bazel integration
expr.cache Cache file update with new Bazel file detection expression

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant