You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spent a few hours today unsuccessfully trying to integrate typestate-rs's UML generation into a bazel (or buck2) build.
The challenge is that the extra artifacts containing the UML or dotfile are generated at compile-time by the procedural macro code, but the starlark rules in rules_rust (and prelude for buck2) don't know anything about the extra build-time output. I tried forking or vendoring the rules and modifying them to declare the extra output, but this stuff is so complex I think it would take me days to get working.
Similarly, genrule doesn't have ~any of that logic needed to find the toolchain and build the rust binary. I tried to write a run_binary command that runs the "cargo expand" tool, but then I would need to build and include that tool too in my CICD environment, even if I ~could figure out how to get "run_binary" to find cargo (I couldn't).
I looked briefly at how the procedural macros work, but they're getting compiled to a .so file.
I think a possible way forward would be for typestate-rs to optionally include the UML (and dot) in the generated source file as a static string. Then I could make a build target that just outputs the UML when called, and call that from run_binary.
Anyway, appologies for the noise if nobody has interest in getting this particular feature of this particular library working in this particular build system; just wanted to share an experince. Most of my difficulty stems from being new to both bazel and procedural macros; typestate-rs is working as documented!
The text was updated successfully, but these errors were encountered:
I spent a few hours today unsuccessfully trying to integrate typestate-rs's UML generation into a bazel (or buck2) build.
The challenge is that the extra artifacts containing the UML or dotfile are generated at compile-time by the procedural macro code, but the starlark rules in rules_rust (and prelude for buck2) don't know anything about the extra build-time output. I tried forking or vendoring the rules and modifying them to declare the extra output, but this stuff is so complex I think it would take me days to get working.
Similarly, genrule doesn't have ~any of that logic needed to find the toolchain and build the rust binary. I tried to write a run_binary command that runs the "cargo expand" tool, but then I would need to build and include that tool too in my CICD environment, even if I ~could figure out how to get "run_binary" to find cargo (I couldn't).
I looked briefly at how the procedural macros work, but they're getting compiled to a .so file.
I think a possible way forward would be for typestate-rs to optionally include the UML (and dot) in the generated source file as a static string. Then I could make a build target that just outputs the UML when called, and call that from run_binary.
Anyway, appologies for the noise if nobody has interest in getting this particular feature of this particular library working in this particular build system; just wanted to share an experince. Most of my difficulty stems from being new to both bazel and procedural macros; typestate-rs is working as documented!
The text was updated successfully, but these errors were encountered: