forked from 1b-agent/opencadstudio-upstream
feat(plugins): include rustc version in plugin compatibility gate
OpenCADStudio/plugins#901 - Record the host's rustc --version output in the embedded version_info.json. - Add rustc_version/rustc_declared/rustc_compatible to plugin manifests and release metadata, mirroring the existing acadrust gate. - Reject API v4+ plugins whose declared rustc differs from the host, with a clear one-line error message. - Propagate the rustc gate through the marketplace, install flow, and UI. - Update plugin architecture docs to describe the new ABI metadata.
This commit is contained in:
1 parent
3024869de0
commit
ed3e064a47
7 files changed
+344
-7
No files matched your search
@@ -89,6 +89,25 @@ plugin compiles against. Two tiers:
|
||||
|
||||
A plugin enables the `host` feature.
|
||||
|
||||
### Build-time ABI metadata
|
||||
|
||||
For API v4 and later the host records two pieces of build-time metadata that
|
||||
affect whether a prebuilt plugin can safely be loaded:
|
||||
|
||||
- `acadrust_source` — the exact git source of the `acadrust` crate the host was
|
||||
built against.
|
||||
- `rustc_version` — the output of `rustc --version` for the compiler that built
|
||||
the host.
|
||||
|
||||
A plugin's `plugin.toml` may declare the same values under `[opencad]`. When
|
||||
either is declared, the host refuses to load the plugin unless it matches the
|
||||
host exactly. This turns the current silent runner crash into a one-line
|
||||
diagnosis such as:
|
||||
|
||||
```
|
||||
Plugin built with rustc 1.96.0, host requires 1.98.0 - rebuild required
|
||||
```
|
||||
|
||||
### `PluginManifest`
|
||||
|
||||
```rust
|
||||
@@ -161,6 +180,10 @@ ocs_plugin_api = { git = "https://github.com/HakanSeven12/OpenCADStudio", featur
|
||||
acadrust = { git = "https://github.com/HakanSeven12/acadrust", branch = "main" }
|
||||
```
|
||||
|
||||
Your release build must also use the same `rustc` as the host. Record it in
|
||||
`plugin.toml` (see below) and pin the toolchain in your CI matrix so every
|
||||
published asset matches the host's compiler.
|
||||
|
||||
```rust
|
||||
// src/lib.rs
|
||||
use ocs_plugin_api::host::{BuiltinPlugin, HostApi};
|
||||
@@ -210,6 +233,8 @@ api_version = 3
|
||||
ribbon_order = 50
|
||||
command_prefixes = ["EX_"]
|
||||
xdata_apps = []
|
||||
# For API v4+, also record the exact rustc used to build the release asset.
|
||||
# rustc_version = "rustc 1.98.0 (hash date)"
|
||||
```
|
||||
|
||||
The full, buildable scaffold is in [`docs/plugin-template/`](plugin-template);
|
||||
|
||||
Reference in new issue
Block a user