Introduce extension-cli binary, for packaging extensions in CI (#9523)

This will be used in the
[extensions](https://github.com/zed-industries/extensions) repository
for packaging the extensions that users submit.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
Max Brunsfeld 2024-03-19 07:50:21 -07:00 committed by GitHub
parent 7ef6600cdd
commit 868616d62e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 229 additions and 18 deletions

View file

@ -1,4 +1,4 @@
mod build_extension;
pub mod extension_builder;
mod extension_lsp_adapter;
mod extension_manifest;
mod wasm_host;
@ -10,8 +10,8 @@ use crate::{extension_lsp_adapter::ExtensionLspAdapter, wasm_host::wit};
use anyhow::{anyhow, bail, Context as _, Result};
use async_compression::futures::bufread::GzipDecoder;
use async_tar::Archive;
use build_extension::{CompileExtensionOptions, ExtensionBuilder};
use collections::{hash_map, BTreeMap, HashMap, HashSet};
use extension_builder::{CompileExtensionOptions, ExtensionBuilder};
use extension_manifest::ExtensionLibraryKind;
use fs::{Fs, RemoveOptions};
use futures::{
@ -545,6 +545,7 @@ impl ExtensionStore {
builder
.compile_extension(
&extension_source_path,
&extension_manifest,
CompileExtensionOptions { release: false },
)
.await
@ -580,6 +581,7 @@ impl ExtensionStore {
pub fn rebuild_dev_extension(&mut self, extension_id: Arc<str>, cx: &mut ModelContext<Self>) {
let path = self.installed_dir.join(extension_id.as_ref());
let builder = self.builder.clone();
let fs = self.fs.clone();
match self.outstanding_operations.entry(extension_id.clone()) {
hash_map::Entry::Occupied(_) => return,
@ -588,8 +590,9 @@ impl ExtensionStore {
cx.notify();
let compile = cx.background_executor().spawn(async move {
let manifest = Self::load_extension_manifest(fs, &path).await?;
builder
.compile_extension(&path, CompileExtensionOptions { release: true })
.compile_extension(&path, &manifest, CompileExtensionOptions { release: true })
.await
});
@ -1000,7 +1003,7 @@ impl ExtensionStore {
Ok(())
}
async fn load_extension_manifest(
pub async fn load_extension_manifest(
fs: Arc<dyn Fs>,
extension_dir: &Path,
) -> Result<ExtensionManifest> {