https://pantsbuild.org/ logo
#development
Title
# development
f

fast-nail-55400

02/28/2022, 10:29 PM
I’d like the BSP core rules to take side-effecting parameters like
Workspace
. But declaring them to be a goal rule doesn’t seem like the best fit for
@goal_rule
. Thoughts?
Mainly because then the return type of the BSP rule would have to be a subclass of
Goal
which is not correct since these are not goals.
Should I add a
@side_effecting_rule
decorator?
h

happy-kitchen-89482

02/28/2022, 10:30 PM
The usual pattern is for rules to bundle up a representation of the side effects they want, and for the goal rule to actually do the side effecting
Would that not work here?
f

fast-nail-55400

02/28/2022, 10:30 PM
Because the BSP core rules are invoked via RPC not by CLI goal
The intent is the same. The core rules invoke the language-specific BSP rules and then do the side effects.
The side effect in this case is writing out JVM classfiles from a compilation.
The return type is used for serializing the response sent back to the BSP client.
And these are dataclasses in
pants.bsp.spec.*
which ideally would not have a dependency on
Goal
Added
@_bsp_rule
decorator for now.