Skip to content

Commit

Permalink
check_version: fails if native.bazel_version is undefined
Browse files Browse the repository at this point in the history
This feature is in Bazel since 0.2.1, TensorFlow requires 0.3.0
at least and should error out if the feature is not present.

Also give a warning when the version number is not present
(when Bazel is built from HEAD) for better debugging.

See http://stackoverflow.com/questions/39811568/error-function-repository-rule-does-not-exist-while-trying-to-compile-tensor.
  • Loading branch information
damienmg committed Oct 2, 2016
1 parent aaeb50c commit fa7ec2e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tensorflow/tensorflow.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,17 @@ def src_to_test_name(src):

# Check that a specific bazel version is being used.
def check_version(bazel_version):
if "bazel_version" in dir(native) and native.bazel_version:
if "bazel_version" not in dir(native):
fail("\nCurrent Bazel version is lower than 0.2.1, expected at least %s\n" % bazel_version)
if not native.bazel_version:
print("\nCurrent Bazel is not a release version, cannot check for compatibility.")
print("Make sure that you are running at least Bazel %s.\n" % bazel_version)
else:
current_bazel_version = _parse_bazel_version(native.bazel_version)
minimum_bazel_version = _parse_bazel_version(bazel_version)
if minimum_bazel_version > current_bazel_version:
fail("\nCurrent Bazel version is {}, expected at least {}\n".format(
native.bazel_version, bazel_version))
pass

# Return the options to use for a C++ library or binary build.
# Uses the ":optmode" config_setting to pick the options.
Expand Down

0 comments on commit fa7ec2e

Please sign in to comment.