1def _single_file_impl(ctx): 2 return DefaultInfo( 3 files = depset(ctx.files.src), 4 ) 5 6single_file = rule( 7 implementation = _single_file_impl, 8 attrs = { 9 "src": attr.label( 10 allow_single_file = True, 11 ), 12 }, 13) 14 15# fdo_profile is a temporary wrapper of native.fdo_profile to remove hard-coded 16# "<name>.afdo" pattern when getting the profile path in cc_library_shared macro 17# TODO(b/267229066): Remove fdo_profile after long-term solution for afdo is 18# implemented in Bazel 19def fdo_profile(name, profile, **kwargs): 20 single_file( 21 name = name + "_file", 22 src = profile, 23 **kwargs 24 ) 25 native.fdo_profile( 26 name = name, 27 profile = name + "_file", 28 **kwargs 29 ) 30