hundreds-father-404
10/08/2020, 12:02 AMit’s the output type of the rule function that determines how it hooks into goals, right?Yeah, more or less. For hooking into prebuilt rules, it’s based on: 1) Registering a
UnionRule
for your request type so that Pants knows to use your plugin. Unions are how we do polymorphism with the engine.
2) Creating a rule that takes your request type as input, and returns the uniform BuiltPackage
--
Oh, good point on not creating an actual file…There’s a way to return an empty BuiltPackage
, though, we can work around that easily if desired.
Outside of that wonkiness with not creating a file, do you think using the package
goal would make sense? Would you rather do ./pants package path/to/Dockerfile
or a new goal like ./pants docker path/to/Dockerfile
? Either are valid.
--
how do i get access to a build directory?Do you mean how do you read from pre-existing files? If so,
PathGlobs
, which is documented on the “file system” page
If you instead mean a directory for where to run your process, whenever you run a Process
, it runs in a chroot automatically, with only the input files you specified. This allows for hermetic builds.