{"id":29091076,"url":"https://github.com/sean7218/bazel-build-server","last_synced_at":"2025-09-08T00:39:35.076Z","repository":{"id":295516285,"uuid":"989130890","full_name":"sean7218/bazel-build-server","owner":"sean7218","description":"bazel build server for sourcekit-lsp","archived":false,"fork":false,"pushed_at":"2025-07-20T00:12:37.000Z","size":224,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-20T00:52:58.433Z","etag":null,"topics":["bazel","build-server-protocol","ios","language-server-protocol","macos","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sean7218.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-23T15:49:31.000Z","updated_at":"2025-07-20T00:17:38.000Z","dependencies_parsed_at":"2025-07-06T23:26:47.183Z","dependency_job_id":"ceccfefe-06b3-4fdb-b98f-1c17d279ec35","html_url":"https://github.com/sean7218/bazel-build-server","commit_stats":null,"previous_names":["sean7218/bazel-build-server","sean7218/bazel-sourcekit-bsp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sean7218/bazel-build-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sean7218%2Fbazel-build-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sean7218%2Fbazel-build-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sean7218%2Fbazel-build-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sean7218%2Fbazel-build-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sean7218","download_url":"https://codeload.github.com/sean7218/bazel-build-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sean7218%2Fbazel-build-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274117519,"owners_count":25225103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-07T02:00:09.463Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","build-server-protocol","ios","language-server-protocol","macos","swift"],"created_at":"2025-06-28T06:02:02.910Z","updated_at":"2025-09-08T00:39:35.058Z","avatar_url":"https://github.com/sean7218.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bazel SourceKit BSP\n\nA Build Server Protocol (BSP) implementation that enables SourceKit LSP integration with Bazel-based Swift projects.\n\n## Overview\n\nThis project bridges the gap between Bazel build systems and SourceKit LSP, providing full IDE functionality (syntax highlighting, code completion, jump to definition, error diagnostics) for Swift projects built with Bazel.\n\n**Key Features:**\n- 🚀 Real-time IDE features for Bazel Swift projects\n- 📋 Build Server Protocol 2.0 compliance\n- ⚡ Intelligent caching of Bazel query results\n- 📝 Comprehensive logging and debugging support\n- 🔄 Background target refresh for optimal performance\n\n## Prerequisites\n\n- macOS 13.0 or later\n- Swift 6.1 or later\n- Bazel 6.0 or later\n- Visual Studio Code with Swift extension (recommended)\n\n## Quick Start\n\n### 1. Build the Server\n\n```bash\n# Clone and build\ngit clone \u003crepository-url\u003e\ncd bazel-build-server\nswift build --configuration release\n\n# Or use the Makefile\nmake release\n```\n\n### 2. Configure Your Project\n\nCreate a `buildServer.json` in your Bazel workspace root:\n\n```json\n{\n  \"name\": \"bazel-sourcekit-bsp\",\n  \"argv\": [\"/path/to/bazel-build-server\"],\n  \"version\": \"1.0.0\",\n  \"bspVersion\": \"2.0.0\",\n  \"languages\": [\"swift\"],\n  \"targets\": [\"//YourApp:YourApp\"],\n  \"indexDatabasePath\": \"/path/to/your/project/.index-db\",\n  \"aqueryArgs\": []\n}\n```\n\n### 3. IDE Setup (VS Code)\n\n1. Open your Bazel workspace in VS Code\n2. Install the Swift extension\n3. The build server will automatically be detected via `buildServer.json`\n\n## Configuration\n\n### buildServer.json Options\n\n| Field | Description | Example |\n|-------|-------------|---------|\n| `argv` | Path to the build server executable | `[\"/usr/local/bin/bazel-build-server\"]` |\n| `targets` | Bazel targets to track | `[\"//App:App\", \"//Tests:Tests\"]` |\n| `indexDatabasePath` | SourceKit index database location | `\"/workspace/.index-db\"` |\n| `aqueryArgs` | Additional Bazel aquery arguments | `[\"--output=jsonproto\"]` |\n\n### Installation Options\n\n**Option 1: System-wide Installation**\n```bash\nmake install  # Installs to /usr/local/bin\n```\n\n**Option 2: Local Development**\n```bash\nmake test-harness  # Copies binary to TestHarness directory\n```\n\n## Development\n\n### Building and Testing\n\n```bash\n# Development build\nswift build\n\n# Run tests\nswift test\n\n# Clean build artifacts\nswift package clean\n```\n\n### Test Harness\n\nThe `TestHarness/` directory contains a complete example Bazel workspace:\n\n```bash\ncd TestHarness\ncode .  # Open in VS Code to test the integration\n```\n\n### Debugging\n\nLogs are written to:\n- **Main log**: `~/bazel-build-server.log`\n- **Activity log**: `~/.bazel-sourcekit-bsp/activity.log`\n\nSet log level in the build server for verbose output.\n\n## Architecture\n\nThe build server implements a clean separation of concerns:\n\n- **JSON-RPC Layer**: Handles LSP communication protocol\n- **Request Processing**: Manages BSP method implementations  \n- **Bazel Integration**: Executes and caches Bazel queries\n- **Target Management**: Thread-safe target tracking and updates\n\n## Troubleshooting\n\n**Build server not starting:**\n- Verify the `argv` path in `buildServer.json` is correct\n- Check file permissions on the executable\n- Review logs at `~/bazel-build-server.log`\n\n**No IDE features working:**\n- Ensure your Bazel targets build successfully\n- Verify `targets` array in `buildServer.json` matches your project\n- Check that the index database path is writable\n\n**Performance issues:**\n- Review `aqueryArgs` for optimization opportunities\n- Monitor cache hit rates in activity logs\n- Consider reducing the number of tracked targets\n\n## VS Code Extensions\n\nRecommended extensions for the best experience:\n\n- **[Swift](https://marketplace.visualstudio.com/items?itemName=sswg.swift-lang)** - Core Swift language support\n- **[SwiftFormat](https://github.com/nicklockwood/SwiftFormat)** - Code formatting on save\n- **[Error Lens](https://github.com/usernamehw/vscode-error-lens)** - Inline error display\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch\n3. Add tests for new functionality\n4. Ensure all tests pass with `swift test`\n5. Submit a pull request\n\n## License\n\nSee [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsean7218%2Fbazel-build-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsean7218%2Fbazel-build-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsean7218%2Fbazel-build-server/lists"}