+
Skip to content

Improve tooling #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Jul 12, 2025
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- uses: actions/setup-node@v4
with:
node-version: 18
Expand All @@ -27,7 +27,7 @@ jobs:
- name: Test
run: /bin/sh ./build.sh DryRelease
- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: cwtools-vscode-pipeline.vsix
path: temp/*.vsix
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,6 @@ nupkgs/
.ionide/
.vscode-test/
.fake
.ionide
.ionide
*.user
cwtools.local.props
15 changes: 15 additions & 0 deletions .vscode-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/** @type {import('@vscode/test-cli').TestConfig} */
module.exports = {
vscode: 'stable',
extensionDevelopmentPath: "release",
extensionTestsEnv: { NODE_ENV: 'test' },
extensionTestsPath: './out/client/test/suite',
files: './out/client/test/suite/**/*.test.js',
launchArgs: [
// Sample workspace the tests expect
'./client/test/sample mod',
// Bring the file under test into the workspace
'./client/test/sample mod/events/irm.txt'
]
// workplaceFolder: "D:\Synced\Git\Personal\cwtools-vscode\client\test\sample mod"
}
93 changes: 41 additions & 52 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,38 @@
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}",
"processName": "CWTools Server.exe",
"symbolOptions": {
"searchPaths": ["${workspaceFolder}/out/server/local"],
"searchPaths": ["${workspaceFolder}/release/bin/server/win-x64","${workspaceFolder}/release/bin/server/linux-x64","${workspaceFolder}/release/bin/server/osx-x64" ],
"searchMicrosoftSymbolServer": true
},
"justMyCode": false
"preLaunchTask": "Wait For Process",
"presentation": {
"hidden": true
}
},
{
"name": "Extension",
"type": "extensionHost",
"name": "Extension Tests (CLI)",
"type": "node",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"F:\\Games\\Steam\\steamapps\\common\\Stellaris", "--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/out/**/*.js"
],
"preLaunchTask": "npm: watch"
"program": "${workspaceFolder}/node_modules/@vscode/test-cli/bin/vscode-test",
"args": ["-c", "${workspaceFolder}/.vscode-test.js"],
"cwd": "${workspaceFolder}"
},
{
"name": "Extension Tests",
"preLaunchTask": "UpdateBuildDebug",
"name": "Quick update, Build and Launch Extension (Debug)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/client/test/sample mod",
"${workspaceFolder}/client/test/sample mod/events/irm.txt",
"--extensionDevelopmentPath=${workspaceFolder}",
"--extensionTestsPath=${workspaceFolder}/out/client/test/suite"
"D:\\Games\\Steam\\steamapps\\common\\Stellaris",
"--extensionDevelopmentPath=${workspaceRoot}/release"
],
"outFiles": [
"${workspaceFolder}/out/client/test/**/*.js"
]
},
{
"preLaunchTask": "Build",
"name": "Quick Build and Launch Extension",
"type": "extensionHost",
"runtimeExecutable": "${execPath}",
"args": ["D:\\Games\\Steam\\steamapps\\common\\Stellaris", "--extensionDevelopmentPath=${workspaceRoot}/release" ],
"stopOnEntry": false,
"request": "launch",
"sourceMaps": false
"request": "launch",
"sourceMaps": false,
"presentation": {
"hidden": true
}
},
{
"preLaunchTask": "UpdateBuild",
Expand All @@ -64,29 +52,30 @@
"--extensionDevelopmentPath=${workspaceRoot}/release"
],
"request": "launch",
"sourceMaps": false
"sourceMaps": false,
"presentation": {
"hidden": true
}
},
],
"compounds": [
{
"preLaunchTask": "UpdateBuildLocal",
"name": "Quick update, Build and Launch Extension (Local)",
"type": "extensionHost",
"runtimeExecutable": "${execPath}",
"args": [
"D:\\Games\\Steam\\steamapps\\common\\Stellaris",
"--extensionDevelopmentPath=${workspaceRoot}/release"
],
"request": "launch",
"sourceMaps": false
"name": "Debug cwtools",
"configurations": ["Quick update, Build and Launch Extension (Debug)", ".NET Core Attach"],
"presentation": {
"group": "Full",
"order": 2
}
},
{
"name": "Launch Only",
"type": "extensionHost",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}/release" ],
"stopOnEntry": false,
"request": "launch",
"sourceMaps": false,

{
"name": "Run cwtools (optimised)",
"configurations": [
"Quick update, Build and Launch Extension"
],
"presentation": {
"group": "Full",
"order": 1
}
}
]
}
50 changes: 47 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Wait For Process",
"type": "shell",
"problemMatcher": [],
// --- Linux & macOS Command ---
"linux": {
"command": "echo 'Waiting for process to start...'; while ! pgrep -f 'CWTools Server'; do sleep 1; done; echo 'Process found. Continuing!'"
},
"osx": {
"command": "echo 'Waiting for process to start...'; while ! pgrep -f 'CWTools Server'; do sleep 1; done; echo 'Process found. Continuing!'"
},
// --- Windows Command (using PowerShell) ---
"windows": {
"command": "echo 'Waiting for process to start...'; while (-not (Get-Process -Name 'CWTools Server' -ErrorAction SilentlyContinue)) { Start-Sleep -Seconds 1 }; echo 'Process found. Continuing!'"
}
},
{
"type": "npm",
"script": "watch-client",
Expand Down Expand Up @@ -30,6 +46,20 @@
"isDefault": true
}
},
{
"command": "${workspaceRoot}/build.sh",
"windows": {
"command": "${workspaceRoot}/build.cmd"
},
"label": "BuildLocalDebug",
"args": [
"QuickBuildLocalDebug"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"command": "${workspaceRoot}/build.sh",
"windows": {
Expand All @@ -44,21 +74,35 @@
"isDefault": true
}
},
{
"command": "${workspaceRoot}/build.sh",
"windows": {
"command": "${workspaceRoot}/build.cmd"
},
"label": "BuildDebug",
"args": [
"QuickBuildDebug"
],
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "PaketUpdate",
"command": "dotnet",
"args": ["paket", "update", "-g", "git"]
"args": ["paket", "update", "-g", "git", "--no-install"]
},
{
"label": "UpdateBuild",
"dependsOn" :[ "PaketUpdate" ,"Build" ],
"dependsOrder": "sequence"
},
{
"label": "UpdateBuildLocal",
"label": "UpdateBuildDebug",
"dependsOn": [
"PaketUpdate",
"BuildLocal"
"BuildDebug"
],
"dependsOrder": "sequence"
}
Expand Down
15 changes: 15 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Contributing

To use a local cwtools git repo, create a file called `cwtools.local.props` containing:

```xml
<Project>
<PropertyGroup>
<!-- turn on the local path and define where cwtools lives -->
<UseLocalCwtools Condition="'$(UseLocalCwtools)' == ''">>True</UseLocalCwtools>
<CwtoolsPath>../../../cwtools/cwtools/cwtools.fsproj</CwtoolsPath>
</PropertyGroup>
</Project>
```

And amend the path to your repo. The default assumes it's adjacent to this repo.
10 changes: 10 additions & 0 deletions build.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def main [profile? : string] {

dotnet tool restore
dotnet paket restore
let exit_code = $env.LAST_EXIT_CODE
if $exit_code != 0 {
exit $exit_code
}
dotnet run --project build -- -t ($profile | default "QuickBuild")
}
Loading
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载