Ensure ExtensionBuilder respects the proxy settings (#14899)

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
张小白 2024-07-21 22:46:43 +08:00 committed by GitHub
parent 0a9d50bf01
commit 9c26d07f7a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 5 deletions

1
Cargo.lock generated
View file

@ -4013,6 +4013,7 @@ dependencies = [
"env_logger",
"extension",
"fs",
"http 0.1.0",
"language",
"log",
"rpc",

View file

@ -64,10 +64,10 @@ struct CargoTomlPackage {
}
impl ExtensionBuilder {
pub fn new(cache_dir: PathBuf) -> Self {
pub fn new(http_client: Arc<dyn HttpClient>, cache_dir: PathBuf) -> Self {
Self {
cache_dir,
http: http::client(None),
http: http_client,
}
}

View file

@ -243,7 +243,10 @@ impl ExtensionStore {
extension_index: Default::default(),
installed_dir,
index_path,
builder: Arc::new(ExtensionBuilder::new(build_dir)),
builder: Arc::new(ExtensionBuilder::new(
http::client(http_client.proxy().cloned()),
build_dir,
)),
outstanding_operations: Default::default(),
modified_extensions: Default::default(),
reload_complete_senders: Vec::new(),

View file

@ -16,8 +16,9 @@ path = "src/main.rs"
anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
env_logger.workspace = true
fs.workspace = true
extension = { workspace = true, features = ["no-webrtc"] }
fs.workspace = true
http.workspace = true
language.workspace = true
log.workspace = true
rpc.workspace = true

View file

@ -13,6 +13,7 @@ use extension::{
extension_builder::{CompileExtensionOptions, ExtensionBuilder},
ExtensionManifest,
};
use http::HttpClientWithProxy;
use language::LanguageConfig;
use theme::ThemeRegistry;
use tree_sitter::{Language, Query, WasmStore};
@ -58,7 +59,9 @@ async fn main() -> Result<()> {
let mut manifest = ExtensionManifest::load(fs.clone(), &extension_path).await?;
log::info!("compiling extension");
let builder = ExtensionBuilder::new(scratch_dir);
let http_client = Arc::new(HttpClientWithProxy::new(None));
let builder = ExtensionBuilder::new(http_client, scratch_dir);
builder
.compile_extension(
&extension_path,