blob: 49434bf54d97155348ea10fa21e481655b15902d [file] [log] [blame]
Thomas Vachuska46848a82018-08-13 14:32:05 -07001"""
2 Copyright 2018-present Open Networking Foundation
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15"""
16
17def check_bazel_version():
Ray Milkey5063f5b2018-08-15 16:22:30 -070018 if "bazel_version" not in dir(native):
Ray Milkey43a6d2e2019-04-04 12:00:18 -070019 fail("\nBazel version is too old; please use 0.23.* official release!\n\n")
Ray Milkey5063f5b2018-08-15 16:22:30 -070020 elif not native.bazel_version:
Ray Milkey43a6d2e2019-04-04 12:00:18 -070021 print("\nBazel is not a release version; please use 0.23.* official release!\n\n")
Ray Milkey5063f5b2018-08-15 16:22:30 -070022 return
Thomas Vachuska46848a82018-08-13 14:32:05 -070023
Ray Milkeyf3814422018-09-17 14:47:23 -070024 versions = native.bazel_version.split(".")
Ray Milkey43a6d2e2019-04-04 12:00:18 -070025 if not int(versions[1]) >= 23:
26 fail("\nBazel version %s is not supported; please use 0.23.* official release!\n\n" %
Ray Milkey5063f5b2018-08-15 16:22:30 -070027 native.bazel_version)