Skip to content

Commit 2b50713

Browse files
committed
good stuff
1 parent 829b25c commit 2b50713

53 files changed

Lines changed: 1638 additions & 38 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ env/
1515

1616
# Rust build artifacts
1717
native/target/
18+
19+
# E2E run artifacts (screenshots, logs, reports)
20+
tools/e2e/artifacts/

‎LuaRules/Gadgets/ui_chonsole_load.lua‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
-- Copy this file to both the luaui/widgets and the luarules/gadgets folders
44

55
-- Set this line to the Chonsole installation folder
6+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then return false end
7+
68
CHONSOLE_FOLDER = "libs_sb/chonsole"
79

810
-- Do NOT modify the following lines

‎LuaUI/widgets/api_chilifx.lua‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
2+
return false
3+
end
4+
15
function widget:GetInfo()
26
return {
37
name = "ChiliFX",
@@ -17,11 +21,6 @@ LCS = LCS()
1721
CHILILFX_DIR = "libs_sb/chilifx/chilifx/"
1822

1923
function widget:Initialize()
20-
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
21-
widgetHandler:RemoveWidget(widget)
22-
return
23-
end
24-
2524
ChiliFX = VFS.Include(CHILILFX_DIR .. "core.lua", nil)
2625

2726
WG.ChiliFX = ChiliFX()

‎LuaUI/widgets/api_chotify.lua‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
2+
return false
3+
end
4+
15
function widget:GetInfo()
26
return {
37
name = "Chotify",
@@ -17,10 +21,6 @@ LCS = LCS()
1721
CHOTIFY_DIR = "libs_sb/chotify/chotify/"
1822

1923
function widget:Initialize()
20-
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
21-
widgetHandler:RemoveWidget(widget)
22-
return
23-
end
2424
if not WG.ChiliFX then
2525
Spring.Log("Chotify", LOG.ERROR, "Missing ChiliFX")
2626
widgetHandler:RemoveWidget(widget)

‎LuaUI/widgets/api_sb_chili.lua‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
--------------------------------------------------------------------------------
22
--------------------------------------------------------------------------------
33

4+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
5+
return false
6+
end
7+
48
function widget:GetInfo()
59
return {
610
name = "Chili Framework (SpringBoard)",
@@ -41,10 +45,6 @@ THEME_DIRNAME = LUA_DIRNAME .. "Configs/chili/themes/"
4145
--------------------------------------------------------------------------------
4246

4347
function widget:Initialize()
44-
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
45-
widgetHandler:RemoveWidget(widget)
46-
return
47-
end
4848
Chili = VFS.Include(CHILI_DIRNAME .. "core.lua", nil, VFS.RAW_FIRST)
4949

5050
screen0 = Chili.Screen:New{}

‎LuaUI/widgets/dbg_dev_console.lua‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@
66
-- Put it on a repository, load it like other libs
77
-- Fix fontsize changing on select
88
-- Pop up on new warning (option)
9-
-- Button to upload log (using the connector)
10-
-- Scrollbar should have a constant height (it can be too small if there's a lot of text)
11-
12-
function widget:GetInfo()
9+
-- Button to upload log (using the connector)
10+
-- Scrollbar should have a constant height (it can be too small if there's a lot of text)
11+
12+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
13+
return false
14+
end
15+
16+
function widget:GetInfo()
1317
return {
1418
name = 'Developer Console',
1519
desc = 'Displays useful information for developers',
@@ -445,11 +449,10 @@ function widget:TextCommand(command)
445449
end
446450

447451
function widget:Initialize()
448-
Spring.SendCommands('console 0')
449-
if Spring.GetGameRulesParam("gameMode") == "play"
450-
or Spring.GetGameRulesParam("sb_ui") ~= "chili" then
451-
widgetHandler:RemoveWidget(self)
452-
return
452+
Spring.SendCommands('console 0')
453+
if Spring.GetGameRulesParam("gameMode") == "play" then
454+
widgetHandler:RemoveWidget(self)
455+
return
453456
end
454457
Chili = WG.SBChili or WG.Chili
455458
screen = Chili.Screen0
@@ -481,8 +484,8 @@ function widget:GetConfigData()
481484
return cfg
482485
end
483486

484-
function widget:SetConfigData(data)
485-
for k, v in pairs(data) do
487+
function widget:SetConfigData(data)
488+
for k, v in pairs(data) do
486489
cfg[k] = v
487490
end
488491

‎LuaUI/widgets/gui_chili_selections_and_cursortip.lua‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
--TODO investigate Chili-Error in `Chili Selections & CursorTip`:2435 : [string "LuaUI/Widgets/chili/controls/control.lua"]:897: attempt to index field 'parent' (a nil value). (This bug is many months old. This TODO is written on 18 October 2013). See end of file for longer stacktrace.
22
--------------------------------------------------------------------------------
3+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
4+
return false
5+
end
6+
37
function widget:GetInfo()
48
return {
59
name = "Chili Selections & CursorTip",
@@ -2397,8 +2401,7 @@ function widget:ViewResize(vsx, vsy)
23972401
end
23982402

23992403
function widget:Initialize()
2400-
if Spring.GetGameRulesParam("sb_gameMode") == "play"
2401-
or Spring.GetGameRulesParam("sb_ui") ~= "chili" then
2404+
if Spring.GetGameRulesParam("sb_gameMode") == "play" then
24022405
widgetHandler:RemoveWidget(widget)
24032406
return
24042407
end

‎LuaUI/widgets/sb_ui_chonsole_load.lua‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@
33
-- Copy this file to both the luaui/widgets and the luarules/gadgets folders
44

55
-- Set this line to the Chonsole installation folder
6+
if Spring.GetGameRulesParam("sb_ui") ~= "chili" then
7+
return false
8+
end
9+
610
CHONSOLE_FOLDER = "libs_sb/chonsole"
711

812
-- Do NOT modify the following lines
913
if Script.GetName() == "LuaUI" then
10-
VFS.Include(CHONSOLE_FOLDER .. "/luaui/widgets/ui_chonsole.lua", nil, VFS.DEF_MODE)
14+
VFS.Include(CHONSOLE_FOLDER .. "/luaui/widgets/ui_chonsole.lua", nil, VFS.DEF_MODE)
1115
elseif Script.GetName() == "LuaRules" then
12-
VFS.Include(CHONSOLE_FOLDER .. "/luarules/gadgets/ui_chonsole.lua", nil, VFS.DEF_MODE)
16+
VFS.Include(CHONSOLE_FOLDER .. "/luarules/gadgets/ui_chonsole.lua", nil, VFS.DEF_MODE)
1317
end

‎docs/porting/todo.md‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,4 +490,30 @@ devconsole does this:
490490
}
491491
```
492492

493-
realistically, most of it is stuff (at least bottom with selection and copy) that rmlui/engine should be doing, and not per UI components
493+
realistically, most of it is stuff (at least bottom with selection and copy) that rmlui/engine should be doing, and not per UI components
494+
495+
# 27. update rust & pthon packages (pyproject is outdated)
496+
497+
do this once we've fully migrated everything from rust-wip here
498+
499+
# 28. (optional) Always-on control server — remove the `SBC_CONTROL_FILE` gate
500+
501+
The control server (`native/src/sbc/control/`) is currently gated behind the `SBC_CONTROL_FILE` env var and wrapped in `Option<ControlServer>`. It only starts when the e2e harness sets that var. But the control server is meant for both e2e testing and programmatic control (Blender-style Python API equivalent), so it should always be running.
502+
503+
**What needs to happen:**
504+
- Add an engine binding to expose the write dir to native modules (there is no Rust-side `get_write_dir()` — the Lua side gets it from the launcher via the `_sl_write_path` mod option, but the launcher is going away). The engine knows its write dir internally (`dataDirLocater.GetWriteDirPath()` in C++, set via `--write-dir`), it's just not wired into the native plugin API.
505+
- Default the discovery file to `<write_dir>/control.json` so the server can start without external configuration.
506+
- `SBC_CONTROL_FILE` becomes an optional override for the discovery path, not a gate.
507+
- Remove the `Option` wrapper — `ControlServer` is always present.
508+
509+
# 29. Failable callouts
510+
511+
I see a ton of callouts that return result. Is this all senseless?
512+
My guess is they can only really return Errors for the first moment that they're not initialized.
513+
This is done at plugin boot so it's a great disservice to 99% of the code to have to test this everywhere.
514+
515+
```rs
516+
let direction = camera
517+
.get_camera_direction()
518+
.map_err(|err| ControlError::failed(format!("get_camera_direction: {err:?}")))?;
519+
```

‎justfile‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set dotenv-load
44
# Engine paths come from .env (see .env.example) — never hardcode personal paths.
55
engine_build_dir := env_var_or_default("SBC_ENGINE_BUILD_DIR", "")
66
engine_rust_dir := env_var_or_default("SBC_ENGINE_RUST_DIR", "")
7+
tool_pythonpath := "build:tools"
78

89
# Show available recipes.
910
[private]
@@ -91,3 +92,38 @@ verify-native: lint test-unit build-native
9192
[group('run')]
9293
run: build-native
9394
bash tools/dev/launch.sh
95+
96+
# Run black-box UI E2E tests. The native plugin is rebuilt first.
97+
[group('test')]
98+
test-e2e target="all" *args: build-native
99+
PYTHONPATH="{{tool_pythonpath}}" uv run --locked sbc-e2e run "{{target}}" {{args}}
100+
101+
# List every reference image and whether it is approved or still ai-reviewed.
102+
[group('test')]
103+
goldens-status:
104+
@PYTHONPATH="{{tool_pythonpath}}" uv run --locked sbc-e2e goldens-status
105+
106+
# Where a case's last captures differ from its goldens, marked in magenta.
107+
[group('test')]
108+
goldens-diff case *args:
109+
@PYTHONPATH="{{tool_pythonpath}}" uv run --locked sbc-e2e goldens-diff "{{case}}" {{args}}
110+
111+
# Approve a case's reference images (the human OK): `just goldens-approve developer-console`.
112+
[group('test')]
113+
goldens-approve case *shots:
114+
PYTHONPATH="{{tool_pythonpath}}" uv run --locked sbc-e2e approve-goldens "{{case}}" {{shots}}
115+
116+
# Path of the most recent e2e run, optionally for one target: `just e2e-dir developer-console`.
117+
[group('test')]
118+
e2e-dir target="":
119+
@ls -dt artifacts/ui-e2e/*{{target}}* | head -1
120+
121+
# Grep the most recent run's engine log.
122+
[group('test')]
123+
e2e-log target pattern:
124+
@grep -o ".\{0,20\}{{pattern}}.\{0,120\}" "$(ls -dt artifacts/ui-e2e/*{{target}}* | head -1)/infolog.txt" || echo "no match"
125+
126+
# Open the most recent run's screenshots dir.
127+
[group('test')]
128+
e2e-shots target="":
129+
@ls "$(ls -dt artifacts/ui-e2e/*{{target}}* | head -1)/screens"

0 commit comments

Comments
 (0)