Extract SemanticVersion
into its own crate (#9956)
This PR extracts the `SemanticVersion` out of `util` and into its own `SemanticVersion` crate. This allows for making use of `SemanticVersion` without needing to pull in some of the heavier dependencies included in the `util` crate. As part of this the public API for `SemanticVersion` has been tidied up a bit. Release Notes: - N/A
This commit is contained in:
parent
77f1cc95b8
commit
16e6f5643c
28 changed files with 147 additions and 110 deletions
|
@ -33,6 +33,7 @@ lsp.workspace = true
|
|||
node_runtime.workspace = true
|
||||
project.workspace = true
|
||||
schemars.workspace = true
|
||||
semantic_version.workspace = true
|
||||
serde.workspace = true
|
||||
serde_json.workspace = true
|
||||
settings.workspace = true
|
||||
|
|
|
@ -2,6 +2,7 @@ use anyhow::{anyhow, Context, Result};
|
|||
use collections::BTreeMap;
|
||||
use fs::Fs;
|
||||
use language::LanguageServerName;
|
||||
use semantic_version::SemanticVersion;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
ffi::OsStr,
|
||||
|
@ -9,7 +10,6 @@ use std::{
|
|||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
};
|
||||
use util::SemanticVersion;
|
||||
|
||||
/// This is the old version of the extension manifest, from when it was `extension.json`.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
|
||||
|
|
|
@ -33,6 +33,7 @@ use language::{
|
|||
QUERY_FILENAME_PREFIXES,
|
||||
};
|
||||
use node_runtime::NodeRuntime;
|
||||
use semantic_version::SemanticVersion;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use settings::Settings;
|
||||
use std::str::FromStr;
|
||||
|
@ -44,7 +45,6 @@ use std::{
|
|||
};
|
||||
use theme::{ThemeRegistry, ThemeSettings};
|
||||
use url::Url;
|
||||
use util::SemanticVersion;
|
||||
use util::{
|
||||
http::{AsyncBody, HttpClient, HttpClientWithUrl},
|
||||
maybe,
|
||||
|
|
|
@ -14,11 +14,12 @@ use futures::{
|
|||
use gpui::BackgroundExecutor;
|
||||
use language::LanguageRegistry;
|
||||
use node_runtime::NodeRuntime;
|
||||
use semantic_version::SemanticVersion;
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::{Arc, OnceLock},
|
||||
};
|
||||
use util::{http::HttpClient, SemanticVersion};
|
||||
use util::http::HttpClient;
|
||||
use wasmtime::{
|
||||
component::{Component, ResourceTable},
|
||||
Engine, Store,
|
||||
|
@ -203,11 +204,11 @@ pub fn parse_wasm_extension_version(
|
|||
|
||||
fn parse_wasm_extension_version_custom_section(data: &[u8]) -> Option<SemanticVersion> {
|
||||
if data.len() == 6 {
|
||||
Some(SemanticVersion {
|
||||
major: u16::from_be_bytes([data[0], data[1]]) as _,
|
||||
minor: u16::from_be_bytes([data[2], data[3]]) as _,
|
||||
patch: u16::from_be_bytes([data[4], data[5]]) as _,
|
||||
})
|
||||
Some(SemanticVersion::new(
|
||||
u16::from_be_bytes([data[0], data[1]]) as _,
|
||||
u16::from_be_bytes([data[2], data[3]]) as _,
|
||||
u16::from_be_bytes([data[4], data[5]]) as _,
|
||||
))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -4,8 +4,8 @@ mod v0_0_4;
|
|||
use super::{wasm_engine, WasmState};
|
||||
use anyhow::{Context, Result};
|
||||
use language::LspAdapterDelegate;
|
||||
use semantic_version::SemanticVersion;
|
||||
use std::sync::Arc;
|
||||
use util::SemanticVersion;
|
||||
use wasmtime::{
|
||||
component::{Component, Instance, Linker, Resource},
|
||||
Store,
|
||||
|
|
|
@ -3,15 +3,11 @@ use crate::wasm_host::WasmState;
|
|||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use language::{LanguageServerBinaryStatus, LspAdapterDelegate};
|
||||
use semantic_version::SemanticVersion;
|
||||
use std::sync::{Arc, OnceLock};
|
||||
use util::SemanticVersion;
|
||||
use wasmtime::component::{Linker, Resource};
|
||||
|
||||
pub const VERSION: SemanticVersion = SemanticVersion {
|
||||
major: 0,
|
||||
minor: 0,
|
||||
patch: 1,
|
||||
};
|
||||
pub const VERSION: SemanticVersion = SemanticVersion::new(0, 0, 1);
|
||||
|
||||
wasmtime::component::bindgen!({
|
||||
async: true,
|
||||
|
|
|
@ -5,19 +5,16 @@ use async_tar::Archive;
|
|||
use async_trait::async_trait;
|
||||
use futures::io::BufReader;
|
||||
use language::{LanguageServerBinaryStatus, LspAdapterDelegate};
|
||||
use semantic_version::SemanticVersion;
|
||||
use std::{
|
||||
env,
|
||||
path::PathBuf,
|
||||
sync::{Arc, OnceLock},
|
||||
};
|
||||
use util::{maybe, SemanticVersion};
|
||||
use util::maybe;
|
||||
use wasmtime::component::{Linker, Resource};
|
||||
|
||||
pub const VERSION: SemanticVersion = SemanticVersion {
|
||||
major: 0,
|
||||
minor: 0,
|
||||
patch: 4,
|
||||
};
|
||||
pub const VERSION: SemanticVersion = SemanticVersion::new(0, 0, 4);
|
||||
|
||||
wasmtime::component::bindgen!({
|
||||
async: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue