Cleanup WASM bindings generators so they all have a similar interface

PiperOrigin-RevId: 827965451
Change-Id: I657fc4d3a480fbc62124c84fe9ddc0900a91183f
This commit is contained in:
Matija Kecman
2025-11-04 07:31:36 -08:00
committed by Copybara-Service
parent 776fc32eb4
commit 29c1a3a0a5
10 changed files with 78 additions and 109 deletions
+6 -3
View File
@@ -14,7 +14,7 @@
"""Generates Embind bindings for MuJoCo functions."""
from typing import List, Mapping
from typing import List, Mapping, Optional
from introspect import ast_nodes
@@ -76,11 +76,14 @@ class Generator:
return result
def generate(self) -> tuple[str, str]:
def generate(self) -> list[tuple[str, list[str]]]:
"""Generates the bindings file for all functions."""
wrapper_functions = self._generate_wrappers()
function_bindings = self._generate_direct_bindable_functions()
function_bindings += self._generate_wrapper_bindable_functions()
return wrapper_functions, function_bindings
return [
("// {{ WRAPPER_FUNCTIONS }}", [wrapper_functions]),
("// {{ FUNCTION_BINDINGS }}", [function_bindings]),
]