bazel/protos.bzl
def _protos_impl(ctx):
    """Rule to copy all protos to a single output directory."""
    proto_files = []
    for dep in ctx.attr.deps:
        proto_files.extend(dep[ProtoInfo].transitive_sources.to_list())

    outputs = []
    for f in proto_files:
        short_path = _get_real_short_path(f)
        out = ctx.actions.declare_file(short_path)
        outputs.append(out)
        ctx.actions.run_shell(
            outputs = [out],
            inputs = depset([f]),
            arguments = [f.path, out.path],
            command = "cp $1 $2",
        )
    return [
        DefaultInfo(
            files = depset(outputs),
            data_runfiles = ctx.runfiles(files = outputs),
        ),
    ]
Rule to copy all protos to a single output directory.
Rule to copy all protos to a single output directory.
Rule to copy all protos to a single output directory .
def _protos_impl(ctx):
    proto_files = []
    for dep in ctx.attr.deps:
        proto_files.extend(dep[ProtoInfo].transitive_sources.to_list())
    outputs = []
    for f in proto_files:
        short_path = _get_real_short_path(f)
        out = ctx.actions.declare_file(short_path)
        outputs.append(out)
        ctx.actions.run_shell(
            outputs = [out],
            inputs = depset([f]),
            arguments = [f.path, out.path],
            command = "cp $1 $2",
        )
    return [
        DefaultInfo(
            files = depset(outputs),
            data_runfiles = ctx.runfiles(files = outputs),
        ),
    ]
def _protos_impl ( ctx ) : proto_files = [ ] for dep in ctx . attr . deps : proto_files . extend ( dep [ ProtoInfo ] . transitive_sources . to_list ( ) ) outputs = [ ] for f in proto_files : short_path = _get_real_short_path ( f ) out = ctx . actions . declare_file ( short_path ) outputs . append ( out ) ctx . actions . run_shell ( outputs = [ out ] , inputs = depset ( [ f ] ) , arguments = [ f . path , out . path ] , command = "cp $1 $2" , ) return [ DefaultInfo ( files = depset ( outputs ) , data_runfiles = ctx . runfiles ( files = outputs ) , ) , ]
Rule to copy all protos to a single output directory.
Rule to copy all protos to a single output directory .
"""Rule to copy all protos to a single output directory."""
ctx