From 38914884aeae5a7c3a4df3affcedd008440a5ffe Mon Sep 17 00:00:00 2001 From: Alex Leigh Date: Thu, 4 Jan 2024 17:36:47 -0800 Subject: [PATCH] Fix file paths in generated source jars --- kt_jvm_grpc.bzl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/kt_jvm_grpc.bzl b/kt_jvm_grpc.bzl index af649a54..42e08664 100644 --- a/kt_jvm_grpc.bzl +++ b/kt_jvm_grpc.bzl @@ -20,11 +20,14 @@ def _invoke_generator(ctx, proto_dep, output_dir): progress_message = "Generating Kotlin gRPC extensions for %s" % proto_dep.label, ) +def _map_relative_path(file): + return "{dest}={src}".format(dest = file.tree_relative_path, src = file.path) + def _build_srcjar(ctx, proto_dep, input_dir, source_jar): args = ctx.actions.args() args.add("c") args.add(source_jar.path) - args.add_all(depset([input_dir])) + args.add_all(depset([input_dir]), map_each = _map_relative_path) ctx.actions.run( outputs = [source_jar], inputs = [input_dir], @@ -279,7 +282,7 @@ def _kt_jvm_proto_library_helper_impl(ctx): args = ctx.actions.args() args.add("c") args.add(ctx.outputs.srcjar) - args.add_all([gen_src_dir]) + args.add_all([gen_src_dir], map_each = _map_relative_path) ctx.actions.run( arguments = [args], executable = ctx.executable._zip,