Ray Milkey | 8705cce | 2019-01-14 14:05:48 -0800 | [diff] [blame] | 1 | def _impl(ctx): |
| 2 | output = ctx.outputs.deps_files |
| 3 | |
| 4 | dep_list = [] |
| 5 | for dep in ctx.files.deps: |
| 6 | dep_list += [dep.path] |
| 7 | |
| 8 | cmd = [ |
| 9 | "echo %s >> %s" % (",".join(dep_list), output.path), |
| 10 | ] |
| 11 | |
Brett Bergquist | 7385b79 | 2021-01-20 08:30:15 -0500 | [diff] [blame] | 12 | ctx.actions.run_shell( |
Ray Milkey | 8705cce | 2019-01-14 14:05:48 -0800 | [diff] [blame] | 13 | inputs = ctx.files.deps, |
| 14 | outputs = [output], |
| 15 | progress_message = "Generating deps file paths for %s" % ctx.attr.name, |
| 16 | command = ";\n".join(cmd), |
| 17 | ) |
| 18 | |
| 19 | deps_files = rule( |
| 20 | attrs = { |
| 21 | "deps": attr.label_list(allow_files = True), |
| 22 | }, |
| 23 | implementation = _impl, |
| 24 | outputs = {"deps_files": "%{name}-deps-files.txt"}, |
| 25 | ) |