-
-
Notifications
You must be signed in to change notification settings - Fork 643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[internal] Make JvmLockfileRequest
generic
#14201
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,7 +384,8 @@ def test_compile_with_scalac_plugin(rule_runner: RuleRunner) -> None: | |
|
||
scalac_plugin( | ||
name = "acyclic", | ||
artifact = ":acyclic_lib", | ||
# TODO: Support relative addresses. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was always broken, but now we're more eagerly validating the address so it makes a difference. I can try fixing in a followup? We need to use |
||
artifact = "lib:acyclic_lib", | ||
) | ||
|
||
scala_sources( | ||
|
@@ -468,7 +469,8 @@ def test_compile_with_multiple_scalac_plugins(rule_runner: RuleRunner) -> None: | |
scalac_plugin( | ||
name="kind-projector", | ||
plugin_name="kind-projector", | ||
artifact=":kind-projector-lib", | ||
# TODO: Support relative addresses. | ||
artifact="lib:kind-projector-lib", | ||
) | ||
|
||
jvm_artifact( | ||
|
@@ -481,7 +483,8 @@ def test_compile_with_multiple_scalac_plugins(rule_runner: RuleRunner) -> None: | |
scalac_plugin( | ||
name="better-monadic-for", | ||
plugin_name="bm4", | ||
artifact=":better-monadic-for-lib", | ||
# TODO: Support relative addresses. | ||
artifact="lib:better-monadic-for-lib", | ||
) | ||
""" | ||
), | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,4 @@ target( | |
], | ||
) | ||
|
||
python_tests(name="tests", timeout=200) | ||
python_tests(name="tests", timeout=240) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,14 @@ | |
from pants.core.util_rules import config_files, source_files | ||
from pants.core.util_rules.external_tool import rules as external_tool_rules | ||
from pants.engine.fs import Digest, DigestContents | ||
from pants.engine.rules import SubsystemRule, rule | ||
from pants.jvm.goals.lockfile import JvmLockfileRequest | ||
from pants.engine.rules import Get, SubsystemRule, rule | ||
from pants.jvm.goals.lockfile import JvmLockfileRequest, JvmLockfileRequestFromTool | ||
from pants.jvm.goals.lockfile import rules as lockfile_rules | ||
from pants.jvm.resolve import jvm_tool | ||
from pants.jvm.resolve.common import ArtifactRequirements, Coordinate | ||
from pants.jvm.resolve.common import Coordinate | ||
from pants.jvm.resolve.coursier_fetch import rules as coursier_fetch_rules | ||
from pants.jvm.resolve.coursier_setup import rules as coursier_setup_rules | ||
from pants.jvm.resolve.jvm_tool import GatherJvmCoordinatesRequest, JvmToolBase | ||
from pants.jvm.resolve.jvm_tool import JvmToolBase | ||
from pants.jvm.target_types import JvmArtifactTarget | ||
from pants.jvm.util_rules import rules as util_rules | ||
from pants.testutil.rule_runner import PYTHON_BOOTSTRAP_ENV, QueryRule, RuleRunner | ||
|
@@ -39,7 +40,7 @@ class MockJvmToolLockfileSentinel(ToolLockfileSentinel): | |
async def generate_test_tool_lockfile_request( | ||
_: MockJvmToolLockfileSentinel, tool: MockJvmTool | ||
) -> JvmLockfileRequest: | ||
return JvmLockfileRequest.from_tool(tool) | ||
return await Get(JvmLockfileRequest, JvmLockfileRequestFromTool(tool)) | ||
|
||
|
||
def test_jvm_tool_base_extracts_correct_coordinates() -> None: | ||
|
@@ -52,10 +53,10 @@ def test_jvm_tool_base_extracts_correct_coordinates() -> None: | |
*source_files.rules(), | ||
*util_rules(), | ||
*jvm_tool.rules(), | ||
*lockfile_rules(), | ||
generate_test_tool_lockfile_request, | ||
SubsystemRule(MockJvmTool), | ||
QueryRule(JvmLockfileRequest, (MockJvmToolLockfileSentinel,)), | ||
QueryRule(ArtifactRequirements, (GatherJvmCoordinatesRequest,)), | ||
QueryRule(DigestContents, (Digest,)), | ||
], | ||
target_types=[JvmArtifactTarget], | ||
|
@@ -83,16 +84,8 @@ def test_jvm_tool_base_extracts_correct_coordinates() -> None: | |
} | ||
) | ||
lockfile_request = rule_runner.request(JvmLockfileRequest, [MockJvmToolLockfileSentinel()]) | ||
assert sorted(lockfile_request.artifact_inputs) == [ | ||
"//:junit_junit", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One side-effect of this assert here is that we validated that both Maven-style and Address-style artifact specifications were tests. Are we doing this anywhere else? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh sorry, I had on auto-merge. Will make sure the followup PR has tests for this. |
||
"org.hamcrest:hamcrest-core:1.3", | ||
] | ||
|
||
requirements = rule_runner.request( | ||
ArtifactRequirements, [GatherJvmCoordinatesRequest(lockfile_request.artifact_inputs, "")] | ||
) | ||
coordinates = [i.coordinate for i in requirements] | ||
assert sorted(coordinates, key=lambda c: (c.group, c.artifact, c.version)) == [ | ||
coordinates = sorted(i.coordinate for i in lockfile_request.artifacts) | ||
assert coordinates == [ | ||
Coordinate(group="junit", artifact="junit", version="4.13.2"), | ||
Coordinate(group="org.hamcrest", artifact="hamcrest-core", version="1.3"), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm starting to see a lot of
GatherJvmCoordinatesRequest
s with that f-string, is there an opportunity to create a util here to make sure these requests are more easily reused?