Hey Pants Team, curious if there's a way to have t...
# general
r
Hey Pants Team, curious if there's a way to have the BUILD files changed as input to a
goal_rule
. Using
targets: Targets
doesn't seem to include BUILD files.
āœ… 1
b
Specs
? And filter the file specs to
BUILD
files?
r
use case you can run
./pants my-goal app/BUILD
and we can inspect the options on that file
b
oh, well you can certainly get the
BUILD
contents. Getting the semantic contents may be a different affair (post-macro targets/fields/etc...)
r
yeah at this point I just want the input to show in the plugin goal right now it's just
Copy code
12:22:21.29 [INFO] stdout: "Targets([])"
b
Copy code
files = await Get(SpecsPaths, Specs, specs)
and then
Copy code
specified_build_files = FilespecMatcher(
            includes=[os.path.join("**", p) for p in build_file_options.patterns],
            excludes=build_file_options.ignores,
        ).matches(files)
I think that ought to get you the
BUILD
files generically
šŸ‘ 1
Including referencing the build file patterns
r
that looks like the right path but how do we accept that as input to the plugin?
like right now we don't know which BUILD file to inspect
b
Combine with
--changed-since
?
r
so you're saying
/pants my-goal --changed-since=origin/master app/BUILD
?
we provide spec files in CI and still not sure how we can detect that a
app/BUILD
was provided as input to the goal
b
ā€¢ Make
my-goal
take in
Specs
and filter just to
BUILD
files using the above code ā€¢ Run it using
./pants --changed-since my-goal
šŸ‘€ 1
There's probably a way to make it with with "changed since specs" or something but thats beyond me šŸ™‚
r
Copy code
targets: Targets,
    spec: Specs,
seeing some rule graph errors
b
Do you also want
targets
?
r
ahhhh I see we can't have both it's either or
cool then we can take those specs and get more details
b
You can use
specs
to get `targets`:
Copy code
Get(
        FilteredTargets,
        Specs,
        specs,
    )
r
this is perfect thank you @bitter-ability-32190 this was very helpful
b
šŸ™Œ