sourcegraph/internal/codeintel/codegraph/BUILD.bazel
Varun Gandhi dc7da57edb
chore: Make location fetching queries more uniform (#64026)
This patch changes the location querying code so that:
1. We're populating structures corresponding to SCIP instead of LSIF
   (with "scheme" and "identifier" inside "MonikerData")
2. Avoid repeatedly allocating a constant string 'scip' for the scheme
    only to throw it away later.
3. Makes the two queries and their scanning code more similar for easier
    comparison. When I land precise usagesForSymbol, I will de-duplicate
    some of the scanning code between these two queries.

I have avoided renaming all of the local variables to avoid creating
more noise.

## Test plan

Covered by existing tests.
2024-07-24 11:14:22 +02:00

59 lines
1.8 KiB
Python

load("//dev:go_defs.bzl", "go_test")
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "codegraph",
srcs = [
"cleanup.go",
"data_store.go",
"insert.go",
"locus.go",
"observability.go",
],
importpath = "github.com/sourcegraph/sourcegraph/internal/codeintel/codegraph",
visibility = ["//:__subpackages__"],
deps = [
"//internal/codeintel/core",
"//internal/codeintel/shared",
"//internal/codeintel/shared/ranges",
"//internal/codeintel/shared/trie",
"//internal/codeintel/uploads/shared",
"//internal/collections",
"//internal/database/basestore",
"//internal/database/batch",
"//internal/database/dbutil",
"//internal/metrics",
"//internal/observation",
"//lib/codeintel/precise",
"//lib/errors",
"@com_github_keegancsmith_sqlf//:sqlf",
"@com_github_lib_pq//:pq",
"@com_github_sourcegraph_log//:log",
"@com_github_sourcegraph_scip//bindings/go/scip",
"@io_opentelemetry_go_otel//attribute",
"@org_golang_google_protobuf//proto",
],
)
go_test(
name = "codegraph_test",
srcs = [
"cleanup_test.go",
"insert_test.go",
],
data = glob(["testdata/**"]),
embed = [":codegraph"],
tags = ["requires-network"],
deps = [
"//internal/codeintel/shared",
"//internal/database/basestore",
"//internal/database/dbtest",
"//internal/observation",
"@com_github_google_go_cmp//cmp",
"@com_github_keegancsmith_sqlf//:sqlf",
"@com_github_sourcegraph_log//:log",
"@com_github_sourcegraph_log//logtest",
"@com_github_sourcegraph_scip//bindings/go/scip",
],
)