1load("//bazel/rules:device_test.bzl", "DeviceEnvironment") 2 3def _local_device_impl(ctx): 4 ctx.actions.expand_template( 5 template = ctx.file._source_script, 6 output = ctx.outputs.out, 7 is_executable = True, 8 ) 9 10 return DeviceEnvironment( 11 runner = depset([ctx.outputs.out]), 12 data = ctx.runfiles(files = [ctx.outputs.out]), 13 ) 14 15local_device = rule( 16 attrs = { 17 "_source_script": attr.label( 18 default = "//bazel/rules/device:single_local_device.sh", 19 allow_single_file = True, 20 ), 21 "out": attr.output(mandatory = True), 22 }, 23 implementation = _local_device_impl, 24) 25