mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-25 01:34:02 +00:00
Add 'include' field to extension manifest, for copying files when packaging
This commit is contained in:
parent
1435900029
commit
ec9dbd728a
3 changed files with 23 additions and 0 deletions
|
@ -82,6 +82,9 @@ pub struct ExtensionManifest {
|
|||
pub indexed_docs_providers: BTreeMap<Arc<str>, IndexedDocsProviderEntry>,
|
||||
#[serde(default)]
|
||||
pub snippets: Option<PathBuf>,
|
||||
|
||||
#[serde(default)]
|
||||
pub include: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, PartialEq, Eq, Debug, Deserialize, Serialize)]
|
||||
|
@ -214,5 +217,6 @@ fn manifest_from_old_manifest(
|
|||
slash_commands: BTreeMap::default(),
|
||||
indexed_docs_providers: BTreeMap::default(),
|
||||
snippets: None,
|
||||
include: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -191,6 +191,22 @@ async fn copy_extension_resources(
|
|||
}
|
||||
}
|
||||
|
||||
if !manifest.include.is_empty() {
|
||||
for include_path in &manifest.include {
|
||||
copy_recursive(
|
||||
fs.as_ref(),
|
||||
&extension_path.join(&include_path),
|
||||
&output_dir.join(&include_path),
|
||||
CopyOptions {
|
||||
overwrite: true,
|
||||
ignore_if_exists: false,
|
||||
},
|
||||
)
|
||||
.await
|
||||
.with_context(|| format!("failed to copy included path '{}'", include_path))?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,7 @@ async fn test_extension_store(cx: &mut TestAppContext) {
|
|||
slash_commands: BTreeMap::default(),
|
||||
indexed_docs_providers: BTreeMap::default(),
|
||||
snippets: None,
|
||||
include: Vec::new(),
|
||||
}),
|
||||
dev: false,
|
||||
},
|
||||
|
@ -193,6 +194,7 @@ async fn test_extension_store(cx: &mut TestAppContext) {
|
|||
slash_commands: BTreeMap::default(),
|
||||
indexed_docs_providers: BTreeMap::default(),
|
||||
snippets: None,
|
||||
include: Vec::new(),
|
||||
}),
|
||||
dev: false,
|
||||
},
|
||||
|
@ -365,6 +367,7 @@ async fn test_extension_store(cx: &mut TestAppContext) {
|
|||
slash_commands: BTreeMap::default(),
|
||||
indexed_docs_providers: BTreeMap::default(),
|
||||
snippets: None,
|
||||
include: Vec::new(),
|
||||
}),
|
||||
dev: false,
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue