Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions .opencode/worktree-session-state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"sessions": {
"ses_185625182ffei4IDQBfneIHawo": {
"sessionId": "ses_185625182ffei4IDQBfneIHawo",
"createdAt": 1780173614723
},
"ses_185623f9cffe4Ux424H8yr1LYq": {
"sessionId": "ses_185623f9cffe4Ux424H8yr1LYq",
"createdAt": 1780173619302
},
"ses_18550fae0ffevhMhhOMbudg3eX": {
"sessionId": "ses_18550fae0ffevhMhhOMbudg3eX",
"createdAt": 1780174751013
},
"ses_1852bdcfeffelMj8t64ptTeNJE": {
"sessionId": "ses_1852bdcfeffelMj8t64ptTeNJE",
"createdAt": 1780177183492
},
"ses_184b18dacffergaRkgNEGiCvGE": {
"sessionId": "ses_184b18dacffergaRkgNEGiCvGE",
"createdAt": 1780185199193
},
"ses_1846bf0acffeGse1QCEIyVMxJQ": {
"sessionId": "ses_1846bf0acffeGse1QCEIyVMxJQ",
"createdAt": 1780189761365
},
"ses_1846bf089ffeIpDb4LHARZcsHJ": {
"sessionId": "ses_1846bf089ffeIpDb4LHARZcsHJ",
"createdAt": 1780189761401
},
"ses_184254d5effeuyLyyfs01FGPJ3": {
"sessionId": "ses_184254d5effeuyLyyfs01FGPJ3",
"createdAt": 1780194390692
},
"ses_184254d47ffe2xbYNf2Fi98L33": {
"sessionId": "ses_184254d47ffe2xbYNf2Fi98L33",
"createdAt": 1780194390717
},
"ses_183d032f3ffeTyPndImwLR3kx5": {
"sessionId": "ses_183d032f3ffeTyPndImwLR3kx5",
"createdAt": 1780199968015
},
"ses_183d032d1ffeV7u2rwBlJiEVSx": {
"sessionId": "ses_183d032d1ffeV7u2rwBlJiEVSx",
"createdAt": 1780199968057
},
"ses_183d032a7ffeAp2je1CYFC6wSJ": {
"sessionId": "ses_183d032a7ffeAp2je1CYFC6wSJ",
"createdAt": 1780199968091
},
"ses_183ae4671ffeWyKPFTTo6C6tRK": {
"sessionId": "ses_183ae4671ffeWyKPFTTo6C6tRK",
"createdAt": 1780202191249
}
}
}
14 changes: 2 additions & 12 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,13 @@
"isDefault": true
}
},
{
"label": "PaketUpdate",
"command": "dotnet",
"args": ["paket", "update", "-g", "git", "--no-install"]
},
{
"label": "UpdateBuild",
"dependsOn" :[ "PaketUpdate" ,"Build" ],
"dependsOrder": "sequence"
"dependsOn": ["Build"]
},
{
"label": "UpdateBuildDebug",
"dependsOn": [
"PaketUpdate",
"BuildDebug"
],
"dependsOrder": "sequence"
"dependsOn": ["BuildDebug"]
}
]
}
88 changes: 65 additions & 23 deletions build/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,56 @@ let cwtoolsProjectName = "Main.fsproj"
let cwtoolsProjectPath = "src/Main/Main.fsproj"
let releaseDir = "release"

// The server is now the Rust LSP server (cwtools-rs), not the F# Main.fsproj.
// It lives in the sibling `cwtools` repo and builds to a single standalone binary
// that the extension launches over stdio (same contract as the old F# server).
let rustWorkspace = "../cwtools/cwtools-rs"
let rustServerBinName =
if Environment.isWindows then "cwtools-server.exe" else "cwtools-server"
let rustServerBin = rustWorkspace </> "target/release" </> rustServerBinName
// The extension's findServerExe() looks here FIRST (bin/server/cwtools-server/<exe>);
// the old bin/server/<platform>/"CWTools Server" path is only a legacy fallback.
// Deploy to the path the client actually loads.
let serverOutDir = releaseDir </> "bin/server/cwtools-server"
let deployedServerName = rustServerBinName

let buildAndDeployRustServer () =
run "cargo" "build --release -p cwtools_lsp" rustWorkspace
// Clean the server dir so stale F# .NET files (hostfxr, *.dll, *.deps.json)
// don't linger next to the standalone Rust binary.
Shell.cleanDir serverOutDir
let dest = serverOutDir </> deployedServerName
System.IO.File.Copy(rustServerBin, dest, true)
if Environment.isUnix then
System.IO.File.SetUnixFileMode(
dest,
UnixFileMode.UserRead ||| UnixFileMode.UserWrite ||| UnixFileMode.UserExecute
||| UnixFileMode.GroupRead ||| UnixFileMode.GroupExecute
||| UnixFileMode.OtherRead ||| UnixFileMode.OtherExecute
)

// The original F# language server (src/Main/Main.fsproj), deployed alongside the
// Rust one so the extension's `cwtools.engine` setting can switch between them.
// The extension's serverExeForEngine('fsharp') loads it from this platform path.
// Builds against the in-repo F# CWTools by default (cwtools.local.props
// UseLocalCwtools=True), so the fallback engine tracks the F# ground truth.
let fsharpServerOutDir = releaseDir </> "bin/server" </> platformShortCode

let buildAndDeployFSharpServer (release: bool) =
DotNet.build
(fun b ->
{ b with
OutputPath = Some fsharpServerOutDir
Configuration =
if release then
DotNet.BuildConfiguration.Release
else
DotNet.BuildConfiguration.Debug
MSBuildParams =
{ MSBuild.CliArguments.Create() with
DisableInternalBinLog = true } })
cwtoolsProjectPath

// --------------------------------------------------------------------------------------
// Build the Generator project and run it
// --------------------------------------------------------------------------------------
Expand Down Expand Up @@ -196,29 +246,21 @@ let initTargets () =
{ MSBuild.CliArguments.Create() with
DisableInternalBinLog = true } }

Target.create "BuildServer"
<| fun _ ->
if File.exists (releaseDir </> "bin/server" </> platformShortCode </> "hostfxr.dll") then
Shell.cleanDir "./release/bin"
else
()

DotNet.build (buildParams true) cwtoolsProjectPath

Target.create "BuildServerDebug"
<| fun _ ->
if File.exists (releaseDir </> "bin/server" </> platformShortCode </> "hostfxr.dll") then
Shell.cleanDir "./release/bin"
else
()

DotNet.build (buildParams false) cwtoolsProjectPath

Target.create "PublishServer"
<| fun _ ->
DotNet.publish (publishParams "win-x64") cwtoolsProjectPath
DotNet.publish (publishParams "linux-x64") cwtoolsProjectPath
DotNet.publish (publishParams "osx-x64") cwtoolsProjectPath
// Dev/local builds deploy BOTH engines so `cwtools.engine` can switch between
// them without a rebuild. Cross-platform packaging of the F# server in the
// released vsix (PublishServer) is a separate step and stays Rust-only below.
Target.create "BuildServer" <| fun _ ->
buildAndDeployRustServer ()
buildAndDeployFSharpServer true

Target.create "BuildServerDebug" <| fun _ ->
buildAndDeployRustServer ()
buildAndDeployFSharpServer false

// Rust-first: packaging deploys the Rust server for the current platform.
// (Cross-compiling the Rust server for win/osx from one host is a separate
// step; these branches build/run the Rust server only.)
Target.create "PublishServer" <| fun _ -> buildAndDeployRustServer ()

Target.create "BuildClient" (fun _ ->
match ProcessUtils.tryFindFileOnPath "npx" with
Expand Down
Loading