From e7815945df66b2893e0c424169dde8ddbeb0efe3 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 13 Feb 2024 23:05:50 +0700 Subject: feat(tvix/cli): support configuring BuildService Allow using a BUILD_SERVICE_ADDR env var, or cmdline args to configure it. Still default to the dummy implementation. Change-Id: I68f34f7b09eabef2b0491103857bbc798398ebfc Reviewed-on: https://cl.tvl.fyi/c/depot/+/10846 Tested-by: BuildkiteCI Reviewed-by: raitobezarius --- tvix/cli/src/main.rs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tvix') diff --git a/tvix/cli/src/main.rs b/tvix/cli/src/main.rs index a678d01e5c38..da09ab878954 100644 --- a/tvix/cli/src/main.rs +++ b/tvix/cli/src/main.rs @@ -1,9 +1,8 @@ use clap::Parser; use rustyline::{error::ReadlineError, Editor}; use std::rc::Rc; -use std::sync::Arc; use std::{fs, path::PathBuf}; -use tvix_build::buildservice::DummyBuildService; +use tvix_build::buildservice; use tvix_eval::builtins::impure_builtins; use tvix_eval::observer::{DisassemblingObserver, TracingObserver}; use tvix_eval::{EvalIO, Value}; @@ -67,6 +66,9 @@ struct Args { #[arg(long, env, default_value = "memory://")] path_info_service_addr: String, + + #[arg(long, env, default_value = "dummy://")] + build_service_addr: String, } /// Interprets the given code snippet, printing out warnings, errors @@ -91,11 +93,26 @@ fn interpret(code: &str, path: Option, args: &Args, explain: bool) -> b }) .expect("unable to setup {blob|directory|pathinfo}service before interpreter setup"); + let build_service = tokio_runtime + .block_on({ + let blob_service = blob_service.clone(); + let directory_service = directory_service.clone(); + async move { + buildservice::from_addr( + &args.build_service_addr, + blob_service.clone(), + directory_service.clone(), + ) + .await + } + }) + .expect("unable to setup buildservice before interpreter setup"); + let tvix_store_io = Rc::new(TvixStoreIO::new( blob_service.clone(), directory_service.clone(), path_info_service.into(), - Arc::::default(), + build_service.into(), tokio_runtime.handle().clone(), )); -- cgit 1.4.1