From a33194aa41fdd9b61440cb7da346fef3c6df52dd Mon Sep 17 00:00:00 2001 From: Krish Narukulla Date: Sat, 10 Dec 2022 15:35:58 -0600 Subject: [PATCH] expand the maven coordinates template from variables --- private/rules/maven_bom_fragment.bzl | 4 +++- private/rules/pom_file.bzl | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/private/rules/maven_bom_fragment.bzl b/private/rules/maven_bom_fragment.bzl index 9c3c2d263..97e980cae 100644 --- a/private/rules/maven_bom_fragment.bzl +++ b/private/rules/maven_bom_fragment.bzl @@ -12,9 +12,11 @@ MavenBomFragmentInfo = provider( ) def _maven_bom_fragment_impl(ctx): + # Expand maven coordinates for any variables to be replaced. + coordinates = ctx.attr.maven_coordinates.format(**ctx.var) return [ MavenBomFragmentInfo( - coordinates = ctx.attr.maven_coordinates, + coordinates = coordinates, artifact = ctx.file.artifact, srcs = ctx.file.src_artifact, javadocs = ctx.file.javadoc_artifact, diff --git a/private/rules/pom_file.bzl b/private/rules/pom_file.bzl index 1ca74f2ce..1cea8486a 100644 --- a/private/rules/pom_file.bzl +++ b/private/rules/pom_file.bzl @@ -8,9 +8,10 @@ def _pom_file_impl(ctx): info = ctx.attr.target[MavenInfo] + coordinates = info.coordinates.format(**ctx.var) out = generate_pom( ctx, - coordinates = info.coordinates, + coordinates = coordinates, versioned_dep_coordinates = sorted(info.maven_deps.to_list()), pom_template = ctx.file.pom_template, out_name = "%s.xml" % ctx.label.name,