diff --git a/docs/notes/2.31.x.md b/docs/notes/2.31.x.md index 1d41833b5de..4b84c52f3a2 100644 --- a/docs/notes/2.31.x.md +++ b/docs/notes/2.31.x.md @@ -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 diff --git a/src/python/pants/jvm/resolve/coursier_fetch.py b/src/python/pants/jvm/resolve/coursier_fetch.py index b30f769bd43..78b65d32e9f 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch.py +++ b/src/python/pants/jvm/resolve/coursier_fetch.py @@ -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: - # 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" ), ) diff --git a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py index c84a03fb164..68204e3a0e1 100644 --- a/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py +++ b/src/python/pants/jvm/resolve/coursier_fetch_integration_test.py @@ -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", @@ -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 diff --git a/src/python/pants/jvm/resolve/coursier_setup.py b/src/python/pants/jvm/resolve/coursier_setup.py index 5e291f4fac6..c9dba5c3ab6 100644 --- a/src/python/pants/jvm/resolve/coursier_setup.py +++ b/src/python/pants/jvm/resolve/coursier_setup.py @@ -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",