1"""Supporting code for tests.""" 2 3def _gen_directory_impl(ctx): 4 out = ctx.actions.declare_directory(ctx.label.name) 5 6 ctx.actions.run_shell( 7 outputs = [out], 8 command = """ 9echo "# Hello" > {outdir}/index.md 10""".format( 11 outdir = out.path, 12 ), 13 ) 14 15 return [DefaultInfo(files = depset([out]))] 16 17gen_directory = rule( 18 implementation = _gen_directory_impl, 19) 20