Skip to content

Commit

Permalink
Expose all label-classifiers to let consumer decide what to do
Browse files Browse the repository at this point in the history
  • Loading branch information
dmivankov committed Jan 18, 2022
1 parent 6a178d7 commit 960a32f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions coursier.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -475,8 +475,7 @@ def _pinned_coursier_fetch_impl(repository_ctx):
for artifact in dep_tree["dependencies"]:
if artifact.get("url") != None:
http_file_repository_name = escape(artifact["coord"])
if not get_classifier(artifact["coord"]) == "sources":
maven_artifacts.extend(["@%s//:%s" % (repository_ctx.attr.name, escape(strip_packaging_and_classifier(artifact["coord"])))])
maven_artifacts.extend([artifact])
http_files.extend([
" http_file(",
" name = \"%s\"," % http_file_repository_name,
Expand All @@ -500,7 +499,16 @@ def _pinned_coursier_fetch_impl(repository_ctx):

http_files.extend(_get_jq_http_files())

http_files.extend(["maven_artifacts = [%s]" % (",".join(["\"%s\"" % s for s in maven_artifacts]))])
http_files.extend([
"maven_artifacts = [%s]" % (",".join([
"struct(label = \"%s\", classifier = \"%s\")" %
(
"@%s//:%s" % (repository_ctx.attr.name, escape(strip_packaging_and_classifier(artifact["coord"]))),
get_classifier(artifact["coord"]),
)
for artifact in maven_artifacts
])),
])

repository_ctx.file("defs.bzl", "\n".join(http_files), executable = False)
repository_ctx.file(
Expand Down

0 comments on commit 960a32f

Please sign in to comment.