github.com/emcfarlane/larking@v0.0.0-20220605172417-1704b45ee6c3/starlib/rules/archive.star (about) 1 load("rule.star", "DefaultInfo", "attr", "attrs", "rule") 2 3 def _tar_impl(ctx): 4 files = set([file for src in ctx.attrs.srcs for file in src[DefaultInfo].files]) 5 print("have files: ", files) 6 srcs = [src for src in files] # to list, should be set? 7 8 out = ctx.actions.archive.tar( 9 name = ctx.attrs.name, 10 strip_prefix = ctx.attrs.strip_prefix, 11 package_dir = ctx.attrs.package_dir, 12 srcs = srcs, 13 ) 14 return [DefaultInfo( 15 files = [out], 16 )] 17 18 tar = rule( 19 impl = _tar_impl, 20 attrs = attrs( 21 strip_prefix = attr.string(), 22 package_dir = attr.string(default = "/"), 23 srcs = attr.label_list(mandatory = True), 24 ), 25 provides = [DefaultInfo], 26 )