Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4d145c3
test: reproduce standalone Rust-static support and provider-order gap…
zackees Nov 19, 2026
ed76202
build: share real native support and Rust-first provider selection (R…
zackees Nov 19, 2026
234f1f0
build: preserve optional and conditional native dependency selection …
zackees Nov 19, 2026
187103c
test: keep shared support regression beside its adapter contract (Ref…
zackees Nov 19, 2026
30333a3
style: apply rustfmt ordering to the support regression module (Refs …
zackees Nov 19, 2026
7771049
build: preserve declared DSO binding outside MSVC imports (Refs #5219)
zackees Nov 19, 2026
8a2a90a
build: let native fixture imports inherit their support owners (Refs …
zackees Nov 19, 2026
8f0175d
build: demand-link each real logger provider independently (Refs #5219)
zackees Nov 19, 2026
8d8afef
test(build): reproduce lazy native support callbacks into Rust (Refs …
zackees Nov 19, 2026
f86ce0c
build: preserve callbacks from lazy support into Rust (Refs #5219)
zackees Nov 19, 2026
b666a5e
test(build): reproduce nested Rust and native archive callbacks (Refs…
zackees Nov 19, 2026
c443366
build: resolve the Rust and native support archive component to compl…
zackees Nov 19, 2026
dd88990
build: retain the direct support edge in rescan groups (Refs #5219)
zackees Nov 19, 2026
bed8341
style: keep upstream registration footer formatted (Refs #5219)
zackees Nov 19, 2026
0a53a22
build: preserve fixture-owned adapter compile definitions (Refs #5219)
zackees Nov 19, 2026
b4aefd6
test(ci): cover every Rust-static consumer in native Tier 2 link mode…
zackees Nov 19, 2026
0b529ea
test(build): reject mixed static and DLL providers on MSVC (Refs #5219)
zackees Nov 19, 2026
00dc7eb
test(build): preserve lazy fixture providers without eager runtime ca…
zackees Nov 19, 2026
011ac4d
build: isolate the MSVC Rust-static component from OBS DLL imports (R…
zackees Nov 19, 2026
b94b6af
test(build): keep inactive Rust consumers on their DLL provider (Refs…
zackees Nov 19, 2026
0e08143
build: preserve inactive conditional DLL consumers and adapters (Refs…
zackees Nov 19, 2026
2314311
test(build): reproduce missing Windows support in independent CMake c…
zackees Nov 19, 2026
8e0461e
build: inherit physical Windows facts in independent support projects…
zackees Nov 19, 2026
192b111
style: format the extracted encoder weak-reference unit (Refs #5219)
zackees Nov 19, 2026
d5fa009
build: share newly merged output and indexbuffer adapters (Refs #5219)
zackees Nov 19, 2026
d950232
test(build): expect shared output support in private fixture metadata…
zackees Nov 19, 2026
2b0c9c7
test(ci): expect shared output adapter in portability inventory (Refs…
zackees Nov 19, 2026
f1f3eb3
build: retain adapters from newly merged name and shader swaps (Refs …
zackees Nov 19, 2026
c3c1ef1
build: retain master audio-capture adapter in shared support (Refs #5…
zackees Nov 19, 2026
bf0b49d
build: share the newly merged video-unmap output adapter (Refs #5219)
zackees Nov 19, 2026
8a33d34
GREEN: restore service lookup in shared Rust-static link support (Ref…
zackees Nov 19, 2026
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
48 changes: 42 additions & 6 deletions ci/cmocka_link_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,46 @@
TRIPLES = {"win-x64": "x86_64-pc-windows-msvc", "mac-arm64": "aarch64-apple-darwin"}


def discover_targets(reply: Path) -> list[str]:
def configured_targets(reply: Path) -> list[dict]:
indexes = sorted(reply.glob("index-*.json"))
if not indexes:
raise FileNotFoundError(f"No CMake file-api reply in {reply}")
index = json.loads(indexes[-1].read_text())
model = json.loads((reply / index["reply"]["codemodel-v2"]["jsonFile"]).read_text())
targets = [json.loads((reply / target["jsonFile"]).read_text())
for target in model["configurations"][0]["targets"]]
rust = sorted(t["name"] for t in targets if t["type"] == "EXECUTABLE" and t["name"].endswith("_rust"))
return [json.loads((reply / target["jsonFile"]).read_text())
for target in model["configurations"][0]["targets"]]


def links_rust_archive(target: dict) -> bool:
# Imported Corrosion archives do not have codemodel target entries.
return any(Path(part["fragment"].strip('"')).name in ("libobs_rust.lib", "liblibobs_rust.a")
for part in target.get("link", {}).get("commandFragments", []))


def validate_msvc_providers(reply: Path) -> None:
for target in configured_targets(reply):
if target["type"] != "EXECUTABLE" or not links_rust_archive(target):
continue
if any(Path(part["fragment"].strip('"')).name == "obs.lib"
for part in target.get("link", {}).get("commandFragments", [])):
raise ValueError(f"{target['name']}: standalone Rust/support must not mix with obs.dll's full import library")


def discover_targets(reply: Path) -> list[str]:
targets = configured_targets(reply)
by_id = {t.get("id", t["name"]): t for t in targets}

def uses_rust(target: dict, visited: frozenset[str] = frozenset()) -> bool:
name = target["name"]
if name == "libobs_rust-static":
return True
if name in visited or target["type"] in ("SHARED_LIBRARY", "MODULE_LIBRARY"):
return False
return any(uses_rust(by_id[dep["id"]], visited | {name})
for dep in target.get("dependencies", []) if dep["id"] in by_id)

rust = sorted(t["name"] for t in targets if t["type"] == "EXECUTABLE"
and (t["name"].endswith("_rust") or uses_rust(t) or links_rust_archive(t)))
if not rust or not any(t["name"] == "libobs-cross-shared" and t["type"] == "SHARED_LIBRARY" for t in targets):
raise ValueError("Tier 2 cross-link inventory needs Rust executables and hybrid libobs")
return ["libobs-cross-shared", *rust]
Expand Down Expand Up @@ -94,7 +125,12 @@ def cache_env(work: Path, tools: Path | None = None) -> dict[str, str]:


def build_targets(alias: str, work: Path, jobs: int, env: dict[str, str]) -> None:
targets = discover_targets(work / ".cmake/api/v1/reply")
reply = work / ".cmake/api/v1/reply"
targets = discover_targets(reply)
if alias == "win-x64":
# LLD and native LINK resolve late archive members differently. Enforce
# the component boundary even when LLD happens to accept an import mix.
validate_msvc_providers(reply)
(work / "link-targets.json").write_text(json.dumps(targets, indent=2) + "\n")
print(f"Tier 2 {alias}: linking hybrid libobs and {len(targets) - 1} Rust fixtures ({jobs} Ninja workers)", flush=True)
subprocess.run(["cmake", "--build", str(work), "--parallel", str(jobs), "--target", *targets,
Expand Down Expand Up @@ -136,7 +172,7 @@ def _link(alias: str, work: Path, jobs: int, env: dict[str, str]) -> None:
configured = time.monotonic()
subprocess.run(["cmake", "-S", str(ROOT), "-B", str(work), "-G", "Ninja",
f"-DOBS_CROSS_TARGET={alias}", "-DOBS_CROSS_LINK=ON", "-DOBS_CROSS_TIER2=ON",
"-DCMAKE_BUILD_TYPE=Release", f"-DRust_CARGO={wrappers / 'cargo'}",
"-DCMAKE_BUILD_TYPE=RelWithDebInfo", f"-DRust_CARGO={wrappers / 'cargo'}",
f"-DRust_COMPILER={wrappers / 'rustc'}", f"-DRust_CARGO_TARGET={target}",
"-DOBS_TEST_SANITIZE_PER_TARGET=OFF",
f"-DCMAKE_C_COMPILER_LAUNCHER={env['CMAKE_C_COMPILER_LAUNCHER']}",
Expand Down
36 changes: 32 additions & 4 deletions ci/test_cmocka_link_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def test_each_alias_builds_the_full_inventory_at_the_cpu_budget(self):
with self.subTest(alias=alias), tempfile.TemporaryDirectory() as temporary:
work = Path(temporary)
with mock.patch.object(cmocka_link_check, "discover_targets", return_value=inventory), \
mock.patch.object(cmocka_link_check, "validate_msvc_providers"), \
mock.patch.object(cmocka_link_check.subprocess, "run") as run:
cmocka_link_check.build_targets(alias, work, 3, {})
args = run.call_args.args[0]
Expand All @@ -84,6 +85,7 @@ def test_alias_link_failures_propagate(self):
work = Path(temporary)
failure = subprocess.CalledProcessError(1, ["cmake", "--build"])
with mock.patch.object(cmocka_link_check, "discover_targets", return_value=["libobs-cross-shared", "test_existing_rust"]), \
mock.patch.object(cmocka_link_check, "validate_msvc_providers"), \
mock.patch.object(cmocka_link_check.subprocess, "run", side_effect=failure):
with self.assertRaises(subprocess.CalledProcessError):
cmocka_link_check.build_targets(alias, work, 2, {})
Expand Down Expand Up @@ -113,21 +115,47 @@ def test_cache_is_fresh_and_cannot_inherit_relaxed_or_remote_policy(self):


class DiscoveryTest(unittest.TestCase):
def test_msvc_rejects_full_dll_imports_beside_the_rust_archive(self):
with tempfile.TemporaryDirectory() as temporary:
reply = Path(temporary)
target = {"name": "fixture", "type": "EXECUTABLE", "link": {"commandFragments": [
{"fragment": "libobs_rust.lib", "role": "libraries"},
{"fragment": '"/build/obs.lib"', "role": "libraries"},
]}}
(reply / "fixture.json").write_text(json.dumps(target))
(reply / "codemodel.json").write_text(json.dumps({"configurations": [{
"targets": [{"name": "fixture", "jsonFile": "fixture.json"}]}]}))
(reply / "index-1.json").write_text(json.dumps({"reply": {
"codemodel-v2": {"jsonFile": "codemodel.json"}}}))
with self.assertRaisesRegex(ValueError, "must not mix"):
cmocka_link_check.validate_msvc_providers(reply)
target["link"]["commandFragments"].pop()
(reply / "fixture.json").write_text(json.dumps(target))
cmocka_link_check.validate_msvc_providers(reply)

def test_uses_generated_target_types_and_names_not_source_regexes(self):
with tempfile.TemporaryDirectory() as temporary:
reply = Path(temporary)
refs = []
for name, kind in (("test_existing_rust", "EXECUTABLE"),
("test_new_steps_rust", "EXECUTABLE"),
("test_plain", "EXECUTABLE"), ("support_rust", "STATIC_LIBRARY"),
("test_plain", "EXECUTABLE"), ("support_rust", "STATIC_LIBRARY"),
("test_hotkey_background_enum", "EXECUTABLE"),
("test_video_level_queries", "EXECUTABLE"),
("libobs_rust-static", "STATIC_LIBRARY"),
("libobs-cross-shared", "SHARED_LIBRARY")):
filename = name + ".json"
(reply / filename).write_text(json.dumps({"name": name, "type": kind}))
refs.append({"name": name, "jsonFile": filename})
target = {"id": name, "name": name, "type": kind}
if name == "test_hotkey_background_enum":
target["dependencies"] = [{"id": "libobs_rust-static"}]
if name == "test_video_level_queries":
target["link"] = {"commandFragments": [{"fragment": '"/build/libobs_rust.lib"', "role": "libraries"}]}
(reply / filename).write_text(json.dumps(target))
refs.append({"id": name, "name": name, "jsonFile": filename})
(reply / "codemodel.json").write_text(json.dumps({"configurations": [{"targets": refs}]}))
(reply / "index-1.json").write_text(json.dumps({"reply": {"codemodel-v2": {"jsonFile": "codemodel.json"}}}))
self.assertEqual(cmocka_link_check.discover_targets(reply),
["libobs-cross-shared", "test_existing_rust", "test_new_steps_rust"])
["libobs-cross-shared", "test_existing_rust", "test_hotkey_background_enum", "test_new_steps_rust", "test_video_level_queries"])

def test_existing_reply_without_rust_executables_fails_closed(self):
with tempfile.TemporaryDirectory() as temporary:
Expand Down
3 changes: 2 additions & 1 deletion ci/test_native_b2_portability.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ def test_scene_archive_consumers_supply_getter_logging(self):
# pulled by these pure rule tests (#3891, Windows LNK2019).
graph = json.loads((ROOT / "test/cmocka/build/test-graph.json").read_text())
stub = "test/cmocka/scene-getter-log-link-stub.c"
support = json.loads((ROOT / "test/cmocka/build/rust-static-support.json").read_text())
self.assertIn("test/cmocka/output-starting-queries-link-support.c", support["sources"])
for name in ("test_scene_audio_window_steps_rust", "test_scene_render_plan_steps_rust"):
with self.subTest(name=name):
self.assertEqual(graph["targets"][name]["sources"], [
Expand All @@ -244,7 +246,6 @@ def test_scene_archive_consumers_supply_getter_logging(self):
"test/cmocka/source-update-properties-link-support.c",
"test/cmocka/weak-object-identity-link-stub.c",
"libobs/build/libobs.image-decode-adapter+.h.c",
"test/cmocka/output-starting-queries-link-support.c",
])

def test_portal_app_id_getter_uses_live_hotkey_adapters(self):
Expand Down
Loading
Loading