https://pantsbuild.org/ logo
#general
Title
# general
h

high-yak-85899

05/20/2022, 5:23 AM
I'm having some odd rule behavior that I'd appreciate some eyes on when folks have a minute
1
I've got this
Copy code
@engine_rules.rule
async def push_pex_binary(request: subsystem.PublishPexBinaryRequest,
                          jfrog_cli: subsystem.JfrogCliTool,
                          publish_options: subsystem.PexPublishOptions
                          ) -> publish.PublishProcesses:

    downloaded_jfrog_cli = await engine_rules.Get(
        external_tool.DownloadedExternalTool,
        external_tool.ExternalToolRequest,
        jfrog_cli.get_request(platform.Platform.current))
When I run my publish goal, I get
Copy code
Get(DownloadedExternalTool, ExternalToolRequest, ExternalToolRequest(download_file_request=DownloadFile(url='<https://releases.jfrog.io/artifactory/jfrog-cli/v2-jf/2.16.4/jfrog-cli-linux-amd64/jf>', expected_digest=FileDigest('c60df099530a23c4da446982cd4b91034d93bb79bb684e43d6b705517d42008c', 21741923)), exe='./jf')) was not detected in your @rule body at rule compile time. Was the `Get` constructor called in a separate function, or perhaps dynamically? If so, it must be inlined into the @rule body.
Having a hard time making sense of it since I'm not sure what it means to not be detected at compile time
c

curved-television-6568

05/20/2022, 5:53 AM
All your await Get’s must be done directly in your @rule bodies (or from a @rule_helper)
h

high-yak-85899

05/20/2022, 5:55 AM
I feel like that's what I'm doing? Trying to follow the examples from https://www.pantsbuild.org/docs/rules-api-installing-tools
Okay I got it to work. I have a habit from python google style guide to import modules only and not classes and functions, but I think that messes with Pants engine behavior.
Once I changed to this, it worked
Copy code
downloaded_jfrog_cli = await Get(DownloadedExternalTool,
                                     ExternalToolRequest,
                                     jfrog_cli.get_request(
                                         platform.Platform.current))
5 Views