From 9129df7ab3249d02fc04c1197d708e04b292d797 Mon Sep 17 00:00:00 2001 From: Xiaoyi Shi Date: Thu, 20 Aug 2020 23:36:36 +0800 Subject: [PATCH] remove implict_output --- rules/implicit_output/BUILD | 9 --------- rules/implicit_output/hash.bzl | 37 ---------------------------------- 2 files changed, 46 deletions(-) delete mode 100644 rules/implicit_output/BUILD delete mode 100644 rules/implicit_output/hash.bzl diff --git a/rules/implicit_output/BUILD b/rules/implicit_output/BUILD deleted file mode 100644 index 3ef825ce..00000000 --- a/rules/implicit_output/BUILD +++ /dev/null @@ -1,9 +0,0 @@ -load(":hash.bzl", "hashes") - -# To get the md5 sum, run: -# `bazel build //implicit_output:build_hash.md5sum` -# If you use `//implicit_output:build_hash`, you will get only the sha256. -hashes( - name = "build_hash", - src = "BUILD", -) diff --git a/rules/implicit_output/hash.bzl b/rules/implicit_output/hash.bzl deleted file mode 100644 index c98c9fd0..00000000 --- a/rules/implicit_output/hash.bzl +++ /dev/null @@ -1,37 +0,0 @@ -def _impl(ctx): - # Create actions to generate the three output files. - # Actions are run only when the corresponding file is requested. - - ctx.actions.run_shell( - outputs = [ctx.outputs.md5], - inputs = [ctx.file.src], - command = "md5sum {} > {}".format(ctx.file.src.path, ctx.outputs.md5.path), - ) - - ctx.actions.run_shell( - outputs = [ctx.outputs.sha1], - inputs = [ctx.file.src], - command = "sha1sum {} > {}".format(ctx.file.src.path, ctx.outputs.sha1.path), - ) - - ctx.actions.run_shell( - outputs = [ctx.outputs.sha256], - inputs = [ctx.file.src], - command = "sha256sum {} > {}".format(ctx.file.src.path, ctx.outputs.sha256.path), - ) - - # By default (if you run `bazel build` on this target, or if you use it as a - # source of another target), only the sha256 is computed. - return DefaultInfo(files = depset([ctx.outputs.sha256])) - -hashes = rule( - implementation = _impl, - attrs = { - "src": attr.label(mandatory = True, allow_single_file = True), - }, - outputs = { - "md5": "%{name}.md5", - "sha1": "%{name}.sha1", - "sha256": "%{name}.sha256", - }, -)