diff options
author | Michael Case <mikecase@google.com> | 2017-12-22 15:44:29 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-12-22 15:48:23 -0800 |
commit | a64485dbb378d7ac6afc9082fd7176a957815a8c (patch) | |
tree | 8569696c2116f674fcc1ba7e324602d0de0cc5e5 /third_party/git | |
parent | f10a598e34da5ea4060ccfb8a027dd5c37c108c0 (diff) |
Run gen_git_source.py inside of a repo_rule instead of configure.
PiperOrigin-RevId: 179971055
Diffstat (limited to 'third_party/git')
-rw-r--r-- | third_party/git/BUILD | 0 | ||||
-rw-r--r-- | third_party/git/BUILD.tpl | 10 | ||||
-rw-r--r-- | third_party/git/git_configure.bzl | 20 |
3 files changed, 30 insertions, 0 deletions
diff --git a/third_party/git/BUILD b/third_party/git/BUILD new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/third_party/git/BUILD diff --git a/third_party/git/BUILD.tpl b/third_party/git/BUILD.tpl new file mode 100644 index 0000000000..7b031e74d5 --- /dev/null +++ b/third_party/git/BUILD.tpl @@ -0,0 +1,10 @@ +# Description: +# Exports generated files used to generate tensorflow/core/util/version_info.cc + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) + +exports_files( + glob(["gen/*"]), +) diff --git a/third_party/git/git_configure.bzl b/third_party/git/git_configure.bzl new file mode 100644 index 0000000000..bd197bfd24 --- /dev/null +++ b/third_party/git/git_configure.bzl @@ -0,0 +1,20 @@ +"""Repository rule for Git autoconfiguration.""" + +def _git_conf_impl(repository_ctx): + repository_ctx.template( + "BUILD", + Label("//third_party/git:BUILD.tpl")) + + tensorflow_root_path = str(repository_ctx.path( + Label("@org_tensorflow//:BUILD")))[:-len("BUILD")] + python_script_path = repository_ctx.path( + Label("@org_tensorflow//tensorflow/tools/git:gen_git_source.py")) + generated_files_path = repository_ctx.path("gen") + + repository_ctx.execute([ + python_script_path, "--configure", tensorflow_root_path, + "--gen_root_path", generated_files_path], quiet=False) + +git_configure = repository_rule( + implementation = _git_conf_impl, +) |