From 21dbf389062bffb6171eb03548a57eab75fa113a Mon Sep 17 00:00:00 2001 From: Varun Gandhi Date: Fri, 26 Jan 2024 02:58:11 -0600 Subject: [PATCH] build: Use scip-treesitter binary consistently (#59891) Use the same environment variable name everywhere, and make sure we use the new binary name for tests. --- cmd/syntactic-code-intel-worker/shared/config.go | 2 +- dev/scip-treesitter-dev | 4 ++-- .../syntax-highlighter/crates/scip-treesitter-cli/BUILD.bazel | 2 +- .../crates/scip-treesitter-cli/tests/integration_test.rs | 4 ++-- sg.config.yaml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmd/syntactic-code-intel-worker/shared/config.go b/cmd/syntactic-code-intel-worker/shared/config.go index 5e87f279b85..0dc914f6909 100644 --- a/cmd/syntactic-code-intel-worker/shared/config.go +++ b/cmd/syntactic-code-intel-worker/shared/config.go @@ -33,7 +33,7 @@ func (c *Config) Load() { c.WorkerBudget = int64(c.GetInt("SYNTACTIC_CODE_INTEL_WORKER_BUDGET", "0", "The amount of compressed input data (in bytes) a worker can process concurrently. Zero acts as an infinite budget.")) c.MaximumRuntimePerJob = c.GetInterval("SYNTACTIC_CODE_INTEL_WORKER_MAXIMUM_RUNTIME_PER_JOB", "25m", "The maximum time a single repository indexing job can take") - c.CliPath = c.Get("SCIP_TREESITTER_COMMAND", "scip-treesitter", "TODO: fill in description") + c.CliPath = c.Get("SCIP_TREESITTER_PATH", "scip-treesitter", "TODO: fill in description") c.ListenAddress = c.GetOptional("SYNTACTIC_CODE_INTEL_WORKER_ADDR", "The address under which the syntactic codeintel worker API listens. Can include a port.") // Fall back to a reasonable default. diff --git a/dev/scip-treesitter-dev b/dev/scip-treesitter-dev index 58e2aca1cee..41bb7a0246c 100755 --- a/dev/scip-treesitter-dev +++ b/dev/scip-treesitter-dev @@ -3,14 +3,14 @@ # Wrapper for `scip-treesitter` similar to `dev/scip-ctags-dev`. # # To use an alternate scip-treesitter binary for development, invoke -# `SCIP_TREESITTER_COMMAND=path/to/scip-treesitter sg start`. +# `SCIP_TREESITTER_PATH=path/to/scip-treesitter sg start`. root="$(dirname "${BASH_SOURCE[0]}")/.." >/dev/null TARGET=$("$root/dev/scip-treesitter-install.sh" which) if [ ! -f "${TARGET}" ]; then echo "scip-treesitter is not installed, please run ./dev/scip-treesitter-install.sh" - echo "Alternatively you can use SCIP_TREESITTER_COMMAND=path/to/scip-treesitter to use your own binary." + echo "Alternatively you can use SCIP_TREESITTER_PATH=path/to/scip-treesitter to use your own binary." exit 1 else ${TARGET} "$@" diff --git a/docker-images/syntax-highlighter/crates/scip-treesitter-cli/BUILD.bazel b/docker-images/syntax-highlighter/crates/scip-treesitter-cli/BUILD.bazel index 425ef25f31b..736e7213ef8 100644 --- a/docker-images/syntax-highlighter/crates/scip-treesitter-cli/BUILD.bazel +++ b/docker-images/syntax-highlighter/crates/scip-treesitter-cli/BUILD.bazel @@ -78,7 +78,7 @@ rust_test( env = { "INSTA_WORKSPACE_ROOT": ".", "RUST_BACKTRACE": "1", - "SCIP_CLI_LOCATION": "$(rootpath :scip-treesitter)", + "SCIP_TREESITTER_PATH": "$(rootpath :scip-treesitter)", }, deps = all_crate_deps( normal = True, diff --git a/docker-images/syntax-highlighter/crates/scip-treesitter-cli/tests/integration_test.rs b/docker-images/syntax-highlighter/crates/scip-treesitter-cli/tests/integration_test.rs index eb865759ce0..3083153fb2e 100644 --- a/docker-images/syntax-highlighter/crates/scip-treesitter-cli/tests/integration_test.rs +++ b/docker-images/syntax-highlighter/crates/scip-treesitter-cli/tests/integration_test.rs @@ -10,9 +10,9 @@ use scip_treesitter_cli::io::read_index_from_file; lazy_static::lazy_static! { static ref BINARY_LOCATION: PathBuf = { - match std::env::var("SCIP_CLI_LOCATION") { + match std::env::var("SCIP_TREESITTER_PATH") { Ok(va) => std::env::current_dir().unwrap().join(va), - _ => cargo_bin("scip-treesitter-cli"), + _ => cargo_bin("scip-treesitter"), } }; } diff --git a/sg.config.yaml b/sg.config.yaml index 20ec754a376..4eff62544ba 100644 --- a/sg.config.yaml +++ b/sg.config.yaml @@ -587,7 +587,7 @@ commands: - cmd/syntactic-code-intel-worker - lib/codeintel env: - SCIP_TREESITTER_COMMAND: dev/scip-treesitter-dev + SCIP_TREESITTER_PATH: dev/scip-treesitter-dev syntactic-code-intel-worker-0: <<: *syntactic_codeintel_worker_template