Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/notes/2.31.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ Folling the annoucement in in the [2.30.x](https://github.com/pantsbuild/pants/b

Java first party dependency inference logic [now](https://github.com/pantsbuild/pants/pull/22889) correctly identifies unqualified, same-package inner class references.

Updated to use Coursier v2.1.24 by default to pick up a bug fix allowing us to [simplify our code a bit](https://github.com/pantsbuild/pants/pull/22906).

#### Python

A variety of Pex options to support building [native executables
Expand Down
12 changes: 5 additions & 7 deletions src/python/pants/jvm/resolve/coursier_fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,12 @@ def dependencies(
return (
entry,
tuple(
dependency_entry
entries[(d.group, d.artifact, d.classifier)]
for d in entry.dependencies
# The dependency might not be present in the entries due to coursier bug:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not yet confident that the issue has been fixed on the coursier side, just because the one example we had seems not to occur. Can we point to the coursier PR that truly fixes this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cloned down coursier and ran git bisect to find the exact commit that fixed things.

It's this one. PR is this one.

Do you want a comment linking to either of these in the code or were you just asking for a pointer on this PR to the fix from the coursier side?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing the digging! Looking at that change, it makes total sense that this fixes the issue. No need to link to this in the code (especially since the comment would have to say something like "we used to work around this Coursier bug here, and now we don't have to", which is hardly necessary). I just wanted us to be reasonably confident that this issue is indeed fixed.

# https://github.com/coursier/coursier/issues/2884
# As a workaround, if this happens, we want to skip the dependency.
# TODO Drop the check once the bug is fixed.
if (dependency_entry := entries.get((d.group, d.artifact, d.classifier)))
is not None
# Coursier will pass "pom" coords through to us. These coords don't have
# a coords entry, but all of their relevant dependencies have already been taken into account
# and will appear in the dependencies list
if d.classifier != "pom"
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def test_transitive_group_only_excludes(rule_runner: RuleRunner) -> None:


@maybe_skip_jdk_test
def test_missing_entry_for_transitive_dependency(rule_runner: RuleRunner) -> None:
def test_missing_entry_for_transitive_pom_dependency(rule_runner: RuleRunner) -> None:
requirement = ArtifactRequirement(
coordinate=Coordinate(
group="org.apache.hive",
Expand All @@ -713,10 +713,8 @@ def test_missing_entry_for_transitive_dependency(rule_runner: RuleRunner) -> Non
}
missing = coords_of_dependencies - coords_of_entries

# We expect all the dependencies to have an entry, but right now it's not true
# for ("junit", "junit") and ("org.apache.curator", "apache-curator").
# TODO Remove the workaround once the bug is fixed.
assert missing == {("junit", "junit"), ("org.apache.curator", "apache-curator")}
# We expect all the dependencies to have an entry except for entries with a classifier of type "pom"
assert missing == {("org.apache.curator", "apache-curator")}


@maybe_skip_jdk_test
Expand Down
6 changes: 5 additions & 1 deletion src/python/pants/jvm/resolve/coursier_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,12 @@ class CoursierSubsystem(TemplatedExternalTool):
name = "coursier"
help = "A dependency resolver for the Maven ecosystem. (https://get-coursier.io/)"

default_version = "v2.1.6"
default_version = "v2.1.24"
default_known_versions = [
"v2.1.24|macos_arm64 |8f47594eb62dea25af913c8932d1f1d86a3a9c8e1262925b63852635390a3f43|21541383|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.24/cs-aarch64-apple-darwin.gz",
"v2.1.24|linux_arm64 |96b4c7580d253b6999a40e94413ca6c4a9bd2339ecce4754ac31a26d1a12fcbf|21534519|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.24/cs-aarch64-pc-linux.gz",
"v2.1.24|linux_x86_64|d2c0572a17fb6146ea65349b59dd216b38beff60ae22bce6e549867c6ed2eda6|23366878",
"v2.1.24|macos_x86_64|33913cd6b61658035d9e6fe971e919cb0ef1f659aa7bff7deeded963a2d36385|22442034",
"v2.1.6|macos_arm64 |746b3e346fa2c0107fdbc8a627890d495cb09dee4f8dcc87146bdb45941088cf|20829782|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.6/cs-aarch64-apple-darwin.gz",
"v2.1.6|linux_arm64 |33330ca433781c9db9458e15d2d32e5d795de3437771647e26835e8b1391af82|20899290|https://github.com/VirtusLab/coursier-m1/releases/download/v2.1.6/cs-aarch64-pc-linux.gz",
"v2.1.6|linux_x86_64|af7234f8802107f5e1130307ef8a5cc90262d392f16ddff7dce27a4ed0ddd292|20681688",
Expand Down
Loading