forked from 1b-agent/opencadstudio-upstream
Merge remote-tracking branch 'origin/main' into plugin/host-model-api
# Conflicts: # crates/ocs_plugin_api/src/process/v4.rs # src/app/update/mod.rs
This commit is contained in:
commit
8648225ac5
309 files changed
+81166
-4157
No files matched your search
+24
-15
@@ -84,19 +84,11 @@ impl ExternalPlugin {
|
||||
|
||||
/// Returns whether the package's dependency fingerprint matches the host.
|
||||
pub fn acadrust_compatible(&self) -> bool {
|
||||
if !ocs_plugin_api::version_info::uses_acadrust_gate(self.api_version) {
|
||||
return true;
|
||||
}
|
||||
if !self.acadrust_declared {
|
||||
return true;
|
||||
}
|
||||
match self.acadrust_source.as_deref() {
|
||||
None | Some("") => false,
|
||||
Some(source) => ocs_plugin_api::version_info::acadrust_sources_compatible(
|
||||
source,
|
||||
ocs_plugin_api::version_info::host_acadrust_source(),
|
||||
),
|
||||
}
|
||||
acadrust_source_compatible(
|
||||
self.api_version,
|
||||
self.acadrust_declared,
|
||||
self.acadrust_source.as_deref(),
|
||||
)
|
||||
}
|
||||
|
||||
/// Returns whether the package's rustc matches the host.
|
||||
@@ -123,6 +115,22 @@ impl ExternalPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn acadrust_source_compatible(
|
||||
api_version: u32,
|
||||
declared: bool,
|
||||
source: Option<&str>,
|
||||
) -> bool {
|
||||
!ocs_plugin_api::version_info::uses_acadrust_gate(api_version)
|
||||
|| declared
|
||||
&& source.is_some_and(|source| {
|
||||
!source.is_empty()
|
||||
&& ocs_plugin_api::version_info::acadrust_sources_compatible(
|
||||
source,
|
||||
ocs_plugin_api::version_info::host_acadrust_source(),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// `<config>/OpenCADStudio/plugins`, matching the settings/recent-files store.
|
||||
/// Overridable via `OCS_PLUGINS_DIR` for tests.
|
||||
pub fn plugins_dir() -> Option<PathBuf> {
|
||||
@@ -718,7 +726,7 @@ rustc_version = "rustc 0.0.0-fake"
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn undeclared_acadrust_falls_back_to_api_gate() {
|
||||
fn undeclared_acadrust_is_incompatible_for_gated_api() {
|
||||
let toml = r#"
|
||||
[plugin]
|
||||
id = "opencad.test"
|
||||
@@ -729,7 +737,8 @@ api_version = 4
|
||||
let p = parse_plugin_toml(toml).expect("parsed");
|
||||
assert!(!p.acadrust_declared);
|
||||
assert!(p.acadrust_source.is_none());
|
||||
assert!(p.acadrust_compatible(), "undeclared acadrust is treated as compatible");
|
||||
assert!(!p.acadrust_compatible());
|
||||
assert!(!p.loadable());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user