plain-author-67175
11/13/2024, 9:27 AMpants generate-lockfiles --resolve=<resolve>
2. pants export --resolve=<resolve>
with a single pants init --resolve=<resolve>
goal. I have gone through the plugins docs/ tutorial and the source, but I can't figure out how to manipulate the inputs to a goal like Get(GenerateLockfilesGoal, <inputT>, <input>)
or Get(Export, <inputT>, <input>)
. Simply calling Get(Export)
without any inputs works because it uses --export-resolve=
argument. Am I going in the wrong direction?elegant-florist-94385
11/13/2024, 12:08 PMpants generate-lockfiles export --resolve=<resolve>
(not 100% sure, but I think this should work.
So you could create an alias like
init = generate-lockfiles export
and then pants init --resolve=<resolve>
should workcurved-television-6568
11/13/2024, 12:50 PMpants <goal> --option-name
is a shortcut for the <goal>-option-name
option, i.e. equiv. to pants <goal> --<goal>-option-name
in other words, you need to provide resolve to both goals,
pants generate-lockfiles export --generate-lockfiles-resolve=... --export-resolve=...
using cli alias here is clever, but I don't see a way to avoid having to provide the resolve option twice unfortunately. (unless using a hack involving .pants.bootstrap
involving env vars or parsing cli args manually)plain-author-67175
11/13/2024, 4:41 PMplain-author-67175
11/13/2024, 4:47 PMgoal_rule
?
My thought was that I would create a new init
goal that takes a --resolve
argument and then use that argument to invoke generate-lockfiles
and export
goals programmatically. So, something like:
class InitSubsystem(GoalSubsystem):
name = "init"
help = "Initialize the project environment"
resolve = StrOption(default="root", help="Default resolve to export")
class Init(Goal):
subsystem_cls = InitSubsystem
environment_behavior = Goal.EnvironmentBehavior.LOCAL_ONLY
@goal_rule
async def init(
init_subsystem: InitSubsystem, build_root: BuildRoot, dist_dir: DistDir, export_subsys: ExportSubsystem
) -> Init:
await Get(GenerateLockfilesGoal, ...)
await Get(Export, ...)
return Init(exit_code=1)
def rules():
return collect_rules()
I just can't figure out how to trigger the two required goals.curved-television-6568
11/13/2024, 5:29 PMawait Effect(Export)
also, this must be invoked from your goal_rule
not just any regular rule
.curved-television-6568
11/13/2024, 5:30 PMplain-author-67175
11/13/2024, 5:53 PMawait Effect(Export)
, couldn't figure out how. I feel like I am missing something obvious, it can't be that hard to mutate/ create configuration, can it? After all, some form of this would be needed for testing, right?