Repository: incubator-wave Updated Branches: refs/heads/wavy 5ea16aa7b -> 9bddff291
add custom rules for Apache Rat Project: http://git-wip-us.apache.org/repos/asf/incubator-wave/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-wave/commit/9bddff29 Tree: http://git-wip-us.apache.org/repos/asf/incubator-wave/tree/9bddff29 Diff: http://git-wip-us.apache.org/repos/asf/incubator-wave/diff/9bddff29 Branch: refs/heads/wavy Commit: 9bddff291afcd500f863632fd7d97e8823084ae8 Parents: 5ea16aa Author: wisebaldone <wisebald...@apache.org> Authored: Fri Apr 29 22:44:57 2016 +1000 Committer: wisebaldone <wisebald...@apache.org> Committed: Fri Apr 29 22:44:57 2016 +1000 ---------------------------------------------------------------------- .gitignore | 2 +- BUILD | 1 - WORKSPACE | 3 +++ rat.bzl | 47 ++++++++++++++++++++++++++++++++++++++++++++++ website/.rat-excludes | 6 ++++++ website/BUILD | 8 ++++++++ 6 files changed, 65 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/9bddff29/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index f59219c..e9fc5e6 100755 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ # by your global gitignore. # Bazel -bazel* +bazel-* http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/9bddff29/BUILD ---------------------------------------------------------------------- diff --git a/BUILD b/BUILD index 8af20a7..775887b 100644 --- a/BUILD +++ b/BUILD @@ -2,6 +2,5 @@ load("@io_bazel_rules_go//go:def.bzl", "go_prefix") go_prefix("server") - # Global Tasks # - Include tasks to create distributions http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/9bddff29/WORKSPACE ---------------------------------------------------------------------- diff --git a/WORKSPACE b/WORKSPACE index 12d7520..8447930 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -8,3 +8,6 @@ git_repository( ) load("@io_bazel_rules_go//go:def.bzl", "go_repositories") go_repositories() + +load("/rat", "rat_repositories") +rat_repositories() http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/9bddff29/rat.bzl ---------------------------------------------------------------------- diff --git a/rat.bzl b/rat.bzl new file mode 100644 index 0000000..55df539 --- /dev/null +++ b/rat.bzl @@ -0,0 +1,47 @@ +# License header goes here + +RAT_TOOLCHAIN_BUILD_FILE = """ +exports_files([ + "apache-rat-0.11.jar" +]) +""" + +# Apache Rat bazel hooks. +def rat_repositories(): + native.new_http_archive( + name = "rat", + strip_prefix = "apache-rat-0.11", + url = "http://apache.mirror.digitalpacific.com.au//creadur/apache-rat-0.11/apache-rat-0.11-bin.tar.bz2", + build_file_content = RAT_TOOLCHAIN_BUILD_FILE + ) + + +def _rat_report_impl(ctx): + cmd = "java -jar %s -d %s" % (ctx.file._rat.path, ctx.attr.dir) + if ctx.file.exclude != None: + cmd += " -E " + ctx.file.exclude.path + cmd += (" > %s" % (ctx.outputs.report.path)) + ctx.action( + command = cmd, + outputs = [ctx.outputs.report], + ) + +rat_report = rule( + implementation = _rat_report_impl, + attrs = { + 'dir': attr.string( + default = ".", + mandatory = False + ), + 'exclude': attr.label( + allow_files=True, + single_file=True), + '_rat': attr.label( + default=Label("@rat//:apache-rat-0.11.jar"), + executable=True, + allow_files=True, + single_file=True, + ) + }, + outputs = {'report': "%{name}.txt"}, +) http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/9bddff29/website/.rat-excludes ---------------------------------------------------------------------- diff --git a/website/.rat-excludes b/website/.rat-excludes new file mode 100644 index 0000000..3ec06c8 --- /dev/null +++ b/website/.rat-excludes @@ -0,0 +1,6 @@ +CHANGES +LICENSE +NOTICE +THANKS +README.md +.rat-excludes http://git-wip-us.apache.org/repos/asf/incubator-wave/blob/9bddff29/website/BUILD ---------------------------------------------------------------------- diff --git a/website/BUILD b/website/BUILD index eab5889..e4d4310 100644 --- a/website/BUILD +++ b/website/BUILD @@ -1,3 +1,5 @@ +load("/rat", "rat_report") + sh_binary( name = "website", srcs = ["scripts/build.sh"], @@ -15,3 +17,9 @@ sh_binary( srcs = ["scripts/install.sh"], data = glob(["**/*"]) ) + +rat_report( + name = "rat", + dir = "website", + exclude = ".rat-excludes" +)