Skip to content

Ensure that the pom classifier isn't always downloaded#1251

Merged
shs96c merged 5 commits into
bazel-contrib:masterfrom
shs96c:poms-and-jars
Sep 18, 2024
Merged

Ensure that the pom classifier isn't always downloaded#1251
shs96c merged 5 commits into
bazel-contrib:masterfrom
shs96c:poms-and-jars

Conversation

@shs96c
Copy link
Copy Markdown
Collaborator

@shs96c shs96c commented Sep 17, 2024

Closes #1250

Comment thread private/rules/coursier.bzl Outdated
This reverts commit 213ac8f.

Turns out that we can't use skylib here.
@shs96c shs96c merged commit 8388bef into bazel-contrib:master Sep 18, 2024
@shs96c shs96c deleted the poms-and-jars branch September 18, 2024 13:04
airlock-confluentinc Bot pushed a commit to confluentinc/rules_jvm_external that referenced this pull request Sep 19, 2024
@honnix
Copy link
Copy Markdown
Contributor

honnix commented Oct 11, 2024

Not exactly sure how it happens, but I think this change results in duplicated symlink creation, which obviously fails. It seems duplicated entries appear in amended_deps.

@honnix
Copy link
Copy Markdown
Contributor

honnix commented Oct 11, 2024

I tried this patch and it worked:

diff --git a/private/rules/coursier.bzl b/private/rules/coursier.bzl
index 530a90b..28e3746 100644
--- a/private/rules/coursier.bzl
+++ b/private/rules/coursier.bzl
@@ -954,6 +954,8 @@ def rewrite_files_attribute_if_necessary(repository_ctx, dep_tree):
         # `pinned_maven_install`. Oh well, let's just do this the manual way.
         if dep["file"].endswith(".pom"):
             jar_path = dep["file"].removesuffix(".pom") + ".jar"
+            if is_dep(jar_path, amended_deps):
+                continue
             if repository_ctx.path(jar_path).exists:
                 dep["file"] = jar_path
 
@@ -963,6 +965,12 @@ def rewrite_files_attribute_if_necessary(repository_ctx, dep_tree):
 
     return dep_tree
 
+def is_dep(jar_path, deps):
+    for dep in reversed(deps):
+        if jar_path == dep.get("file", None):
+            return True
+    return False
+
 def remove_prefix(s, prefix):
     if s.startswith(prefix):
         return s[len(prefix):]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Attempting to resolve com.github.spotbugs:spotbugs:4.7.0 with the coursier resolver does not result in binaries being available

3 participants