Skip to content

Commit 34632c2

Browse files
refactor(Mountain): Standardize sidecar naming to SideCar and implement Binary staging
- Renamed `SidecarIdentifier` to `SideCarIdentifier` in all DTOs (CustomDocumentStateDTO, ProviderRegistrationDTO, WebViewStateDTO) and provider implementations (CommandProvider, DebugProvider, DocumentProvider, IPCProvider, LanguageFeatureProvider, StatusBarProvider, TerminalProvider, WebViewProvider) to ensure consistent naming across the Mountain backend - Updated README.md diagram to change "CocoonSidecar" to "CocoonSideCar" - Added new `Binary/` directory with README.md explaining its role in staging sidecar executables during build, and .gitignore to exclude contents from version control - Regenerated gRPC code (vine_ipc.rs) to reflect naming changes in protocol - Deleted build artifacts (executables/installers) as they should not be version controlled This refactoring enhances consistency in the IPC layer (Vine) and state management (AppState), while the Binary staging directory streamlines Tauri bundling by providing a transient location for sidecar executables, as described in the project's build strategy. The changes maintain compatibility with existing workflows like extension registration and command execution.
1 parent 3c348f0 commit 34632c2

38 files changed

Lines changed: 1065 additions & 892 deletions

File tree

Binary/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*
2+
!/.gitkeep
3+
!/README.md

Binary/.gitkeep

Whitespace-only changes.

Binary/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<table><tr>
2+
<td colspan="1"> <h3 align="center"> <picture>
3+
<source media="(prefers-color-scheme: dark)" srcset="https://PlayForm.Cloud/Dark/Image/GitHub/Land.svg">
4+
<source media="(prefers-color-scheme: light)" srcset="https://PlayForm.Cloud/Image/GitHub/Land.svg">
5+
<img width="28" alt="Land Logo" src="https://PlayForm.Cloud/Image/GitHub/Land.svg">
6+
</picture> </h3> </td> <td colspan="3" valign="top"> <h3 align="center"> Mountain Binaries 📦
7+
</h3> </td>
8+
</tr></table>
9+
10+
---
11+
12+
# **Mountain Binaries** 📦 Staged Executables for Bundling
13+
14+
This directory, `Binary/`, serves as a temporary staging area for executables
15+
that are dynamically selected and prepared by the `Build.rs` orchestrator. It is
16+
essential for managing different application "flavours" that bundle specific
17+
sidecar runtimes.
18+
19+
## Purpose and Workflow
20+
21+
The Land Code Editor is designed to support different underlying runtimes for
22+
its extension host, such as various versions of Node.js. It would be inefficient
23+
and create bloated installers to bundle every possible runtime into a single
24+
application.
25+
26+
To solve this, the `Binary/` directory is used as part of a "just-in-time"
27+
bundling process:
28+
29+
1. **Selection:** During the build process, the `Build.rs` script determines
30+
which specific sidecar version is needed (e.g., `Node.js v22`) based on the
31+
build arguments (`--node-version`).
32+
2. **Staging:** The script copies the selected executable from the main
33+
`SideCar/` repository (where all versions are stored) into this `Binary/`
34+
directory. The copied file is always given a consistent, predictable name
35+
(e.g., `node.exe` on Windows or `node` on Unix).
36+
3. **Bundling:** The `tauri.conf.json` is dynamically configured to point its
37+
`bundle.externalBin` to this staged file (e.g., `bin/node`). The Tauri
38+
bundler then includes this single executable in the final application
39+
installer.
40+
4. **Cleanup:** After the Tauri build is complete, the `Build.rs` script
41+
automatically cleans up this directory, removing the temporary binary.
42+
43+
This ensures that the final application installer is lean and contains only the
44+
one required sidecar runtime, while the source code remains clean and doesn't
45+
need to be polluted with temporary files.
46+
47+
> [!IMPORTANT] This directory is managed automatically by the build system. Its
48+
> contents are transient and **should not be committed to version control**. It
49+
> should be included in your project's `.gitignore` file.
50+
51+
---
52+
53+
**Parent Project**: [`Mountain`](https://github.com/CodeEditorLand/Mountain/tree/Current/README.md) | **Related Directory**:
54+
[`SideCar`](https://github.com/CodeEditorLand/SideCar/tree/Current/README.md)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,14 @@ graph LR
111111
112112
subgraph "Clients"
113113
WindUI["Wind/Sky User Interface (WebView)"]:::wind
114-
CocoonSidecar["Cocoon Extension Host (Node.js)"]:::cocoon
114+
CocoonSideCar["Cocoon Extension Host (Node.js)"]:::cocoon
115115
end
116116
117117
TauriRuntime -- Hosts --> WindUI
118118
WindUI -- Tauri Command --> TrackDispatcher
119119
TrackDispatcher -- Tauri Events --> WindUI
120120
121-
VinegRPC -- gRPC Protocol <--> CocoonSidecar; class VinegRPC,CocoonSidecar IPC
121+
VinegRPC -- gRPC Protocol <--> CocoonSideCar; class VinegRPC,CocoonSideCar IPC
122122
VinegRPC -- Forwards requests to --> TrackDispatcher
123123
124124
NativeHandlers -- Implements traits from --> CommonCrate

Source/ApplicationState/DTO/CustomDocumentStateDTO.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub struct CustomDocumentStateDTO {
2727

2828
/// The identifier of the sidecar process where the custom editor provider
2929
/// lives.
30-
pub SidecarIdentifier:String,
30+
pub SideCarIdentifier:String,
3131

3232
/// A flag indicating if the document is currently editable by the user.
3333
pub IsEditable:bool,

Source/ApplicationState/DTO/ProviderRegistrationDTO.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub struct ProviderRegistrationDTO {
2626
pub Selector:Value,
2727

2828
/// The identifier of the sidecar process that hosts this provider's logic.
29-
pub SidecarIdentifier:String,
29+
pub SideCarIdentifier:String,
3030

3131
/// The identifier of the extension that contributed this provider.
3232
pub ExtensionIdentifier:Value,

Source/ApplicationState/DTO/WebViewStateDTO.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub struct WebViewStateDTO {
3333
pub PanelOptions: Value,
3434

3535
/// The identifier of the sidecar process that owns this WebView.
36-
pub SidecarIdentifier:String,
36+
pub SideCarIdentifier:String,
3737

3838
/// The identifier of the extension that owns this WebView.
3939
pub ExtensionIdentifier:String,

Source/Environment/CommandProvider.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ pub enum CommandHandler<R:Runtime + 'static> {
4343
),
4444

4545
/// A command implemented in an extension and proxied to a sidecar.
46-
Proxied { SidecarIdentifier:String, CommandIdentifier:String },
46+
Proxied { SideCarIdentifier:String, CommandIdentifier:String },
4747
}
4848

4949
impl<R:Runtime> Clone for CommandHandler<R> {
5050
fn clone(&self) -> Self {
5151
match self {
5252
Self::Native(f) => Self::Native(*f),
5353

54-
Self::Proxied { SidecarIdentifier, CommandIdentifier } => {
54+
Self::Proxied { SideCarIdentifier, CommandIdentifier } => {
5555
Self::Proxied {
56-
SidecarIdentifier:SidecarIdentifier.clone(),
56+
SideCarIdentifier:SideCarIdentifier.clone(),
5757

5858
CommandIdentifier:CommandIdentifier.clone(),
5959
}
@@ -95,17 +95,17 @@ impl CommandExecutor for MountainEnvironment {
9595
})
9696
},
9797

98-
Some(CommandHandler::Proxied { SidecarIdentifier, CommandIdentifier: ProxiedCommandIdentifier }) => {
98+
Some(CommandHandler::Proxied { SideCarIdentifier, CommandIdentifier: ProxiedCommandIdentifier }) => {
9999
debug!(
100100
"[CommandProvider] Executing PROXIED command '{}' on sidecar '{}'.",
101-
CommandIdentifier, SidecarIdentifier
101+
CommandIdentifier, SideCarIdentifier
102102
);
103103

104104
let RPCParameters = json!([ProxiedCommandIdentifier, Argument]);
105105

106106
let RPCMethod = format!("{}$ExecuteContributedCommand", ProxyTarget::ExtHostCommands.GetTargetPrefix());
107107

108-
Client::SendRequest(&SidecarIdentifier, RPCMethod, RPCParameters, 30000)
108+
Client::SendRequest(&SideCarIdentifier, RPCMethod, RPCParameters, 30000)
109109
.await
110110
.map_err(|e| CommonError::IPCError { Description:e.to_string() })
111111
},
@@ -119,10 +119,10 @@ impl CommandExecutor for MountainEnvironment {
119119
}
120120

121121
/// Registers a command contributed by a sidecar process.
122-
async fn RegisterCommand(&self, SidecarIdentifier:String, CommandIdentifier:String) -> Result<(), CommonError> {
122+
async fn RegisterCommand(&self, SideCarIdentifier:String, CommandIdentifier:String) -> Result<(), CommonError> {
123123
info!(
124124
"[CommandProvider] Registering PROXY command '{}' from sidecar '{}'",
125-
CommandIdentifier, SidecarIdentifier
125+
CommandIdentifier, SideCarIdentifier
126126
);
127127

128128
let mut Registry = self
@@ -133,14 +133,14 @@ impl CommandExecutor for MountainEnvironment {
133133

134134
Registry.insert(
135135
CommandIdentifier.clone(),
136-
CommandHandler::Proxied { SidecarIdentifier, CommandIdentifier },
136+
CommandHandler::Proxied { SideCarIdentifier, CommandIdentifier },
137137
);
138138

139139
Ok(())
140140
}
141141

142142
/// Unregisters a previously registered command.
143-
async fn UnregisterCommand(&self, _SidecarIdentifier:String, CommandIdentifier:String) -> Result<(), CommonError> {
143+
async fn UnregisterCommand(&self, _SideCarIdentifier:String, CommandIdentifier:String) -> Result<(), CommonError> {
144144
info!("[CommandProvider] Unregistering command '{}'", CommandIdentifier);
145145

146146
self.ApplicationState

Source/Environment/DebugProvider.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl DebugService for MountainEnvironment {
4242

4343
_ProviderHandle:u32,
4444

45-
_SidecarIdentifier:String,
45+
_SideCarIdentifier:String,
4646
) -> Result<(), CommonError> {
4747
// TODO: Store this registration in ApplicationState
4848
info!(
@@ -60,7 +60,7 @@ impl DebugService for MountainEnvironment {
6060

6161
_FactoryHandle:u32,
6262

63-
_SidecarIdentifier:String,
63+
_SideCarIdentifier:String,
6464
) -> Result<(), CommonError> {
6565
// TODO: Store this registration in ApplicationState
6666
info!(
@@ -87,7 +87,7 @@ impl DebugService for MountainEnvironment {
8787
info!("[DebugProvider] Resolving debug configuration...");
8888

8989
let ResolvedConfig = IPCProvider
90-
.SendRequestToSidecar(
90+
.SendRequestToSideCar(
9191
"cocoon-main".into(),
9292
"$resolveDebugConfiguration".into(),
9393
json!([DebugType, Configuration]),
@@ -99,7 +99,7 @@ impl DebugService for MountainEnvironment {
9999
info!("[DebugProvider] Creating debug adapter descriptor...");
100100

101101
let Descriptor = IPCProvider
102-
.SendRequestToSidecar(
102+
.SendRequestToSideCar(
103103
"cocoon-main".into(),
104104
"$createDebugAdapterDescriptor".into(),
105105
json!([DebugType, &ResolvedConfig]),

Source/Environment/DocumentProvider.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ impl DocumentProvider for MountainEnvironment {
9494
let IPCProvider:Arc<dyn IPCProvider> = self.Require();
9595

9696
let RpcResult = IPCProvider
97-
.SendRequestToSidecar(
97+
.SendRequestToSideCar(
9898
// In a multi-host world, we'd look this up
9999
"cocoon-main".to_string(),
100100
"$provideTextDocumentContent".to_string(),
@@ -305,7 +305,7 @@ async fn NotifyModelAdded(Environment:&MountainEnvironment, DocumentStateDTO:&Va
305305
let IPCProvider:Arc<dyn IPCProvider> = Environment.Require();
306306

307307
if let Err(e) = IPCProvider
308-
.SendNotificationToSidecar("cocoon-main".to_string(), "$acceptModelAdded".to_string(), Payload)
308+
.SendNotificationToSideCar("cocoon-main".to_string(), "$acceptModelAdded".to_string(), Payload)
309309
.await
310310
{
311311
error!("[DocumentProvider] Failed to send $acceptModelAdded for {}: {}", URIString, e);
@@ -325,7 +325,7 @@ async fn NotifyModelChanged(Environment:&MountainEnvironment, URI:&Url, NewVersi
325325
let IPCProvider:Arc<dyn IPCProvider> = Environment.Require();
326326

327327
if let Err(e) = IPCProvider
328-
.SendNotificationToSidecar("cocoon-main".to_string(), "$acceptModelChanged".to_string(), Payload)
328+
.SendNotificationToSideCar("cocoon-main".to_string(), "$acceptModelChanged".to_string(), Payload)
329329
.await
330330
{
331331
error!("[DocumentProvider] Failed to send $acceptModelChanged for {}: {}", URI, e);
@@ -343,7 +343,7 @@ async fn NotifyModelSaved(Environment:&MountainEnvironment, URI:&Url) {
343343
let IPCProvider:Arc<dyn IPCProvider> = Environment.Require();
344344

345345
if let Err(e) = IPCProvider
346-
.SendNotificationToSidecar("cocoon-main".to_string(), "$acceptModelSaved".to_string(), Payload)
346+
.SendNotificationToSideCar("cocoon-main".to_string(), "$acceptModelSaved".to_string(), Payload)
347347
.await
348348
{
349349
error!("[DocumentProvider] Failed to send $acceptModelSaved for {}: {}", URI, e);
@@ -361,7 +361,7 @@ pub async fn NotifyModelRemoved(Environment:&MountainEnvironment, URI:&Url) {
361361
let IPCProvider:Arc<dyn IPCProvider> = Environment.Require();
362362

363363
if let Err(e) = IPCProvider
364-
.SendNotificationToSidecar("cocoon-main".to_string(), "$acceptModelRemoved".to_string(), Payload)
364+
.SendNotificationToSideCar("cocoon-main".to_string(), "$acceptModelRemoved".to_string(), Payload)
365365
.await
366366
{
367367
error!("[DocumentProvider] Failed to send $acceptModelRemoved for {}: {}", URI, e);

0 commit comments

Comments
 (0)