Merge pull request #22964 from perfinion:bazelrc
PiperOrigin-RevId: 225413451
This commit is contained in:
commit
78c246bb6c
@ -92,3 +92,11 @@ build:dynamic_kernels --copt=-DAUTOLOAD_DYNAMIC_KERNELS
|
|||||||
build --define=PREFIX=/usr
|
build --define=PREFIX=/usr
|
||||||
build --define=LIBDIR=$(PREFIX)/lib
|
build --define=LIBDIR=$(PREFIX)/lib
|
||||||
build --define=INCLUDEDIR=$(PREFIX)/include
|
build --define=INCLUDEDIR=$(PREFIX)/include
|
||||||
|
|
||||||
|
# Default options should come above this line
|
||||||
|
|
||||||
|
# Options from ./configure
|
||||||
|
try-import %workspace%/.tf_configure.bazelrc
|
||||||
|
|
||||||
|
# Put user-specific options in .bazelrc.user
|
||||||
|
try-import %workspace%/.bazelrc.user
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,7 +1,7 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.ipynb_checkpoints
|
.ipynb_checkpoints
|
||||||
node_modules
|
node_modules
|
||||||
/.bazelrc
|
/.bazelrc.user
|
||||||
/.tf_configure.bazelrc
|
/.tf_configure.bazelrc
|
||||||
/bazel-*
|
/bazel-*
|
||||||
/bazel_pip
|
/bazel_pip
|
||||||
|
@ -44,7 +44,7 @@ remote_config_workspace()
|
|||||||
# files, in case the parsing of those build files depends on the bazel
|
# files, in case the parsing of those build files depends on the bazel
|
||||||
# version we require here.
|
# version we require here.
|
||||||
load("//tensorflow:version_check.bzl", "check_bazel_version_at_least")
|
load("//tensorflow:version_check.bzl", "check_bazel_version_at_least")
|
||||||
check_bazel_version_at_least("0.15.0")
|
check_bazel_version_at_least("0.18.0")
|
||||||
|
|
||||||
load("//tensorflow:workspace.bzl", "tf_workspace")
|
load("//tensorflow:workspace.bzl", "tf_workspace")
|
||||||
|
|
||||||
|
23
configure.py
23
configure.py
@ -255,18 +255,6 @@ def setup_python(environ_cp):
|
|||||||
def reset_tf_configure_bazelrc():
|
def reset_tf_configure_bazelrc():
|
||||||
"""Reset file that contains customized config settings."""
|
"""Reset file that contains customized config settings."""
|
||||||
open(_TF_BAZELRC, 'w').close()
|
open(_TF_BAZELRC, 'w').close()
|
||||||
bazelrc_path = os.path.join(_TF_WORKSPACE_ROOT, '.bazelrc')
|
|
||||||
|
|
||||||
data = []
|
|
||||||
if os.path.exists(bazelrc_path):
|
|
||||||
with open(bazelrc_path, 'r') as f:
|
|
||||||
data = f.read().splitlines()
|
|
||||||
with open(bazelrc_path, 'w') as f:
|
|
||||||
for l in data:
|
|
||||||
if _TF_BAZELRC_FILENAME in l:
|
|
||||||
continue
|
|
||||||
f.write('%s\n' % l)
|
|
||||||
f.write('import %%workspace%%/%s\n' % _TF_BAZELRC_FILENAME)
|
|
||||||
|
|
||||||
def cleanup_makefile():
|
def cleanup_makefile():
|
||||||
"""Delete any leftover BUILD files from the Makefile build.
|
"""Delete any leftover BUILD files from the Makefile build.
|
||||||
@ -488,11 +476,12 @@ def check_bazel_version(min_version, max_version):
|
|||||||
if curr_version_int < min_version_int:
|
if curr_version_int < min_version_int:
|
||||||
print('Please upgrade your bazel installation to version %s or higher to '
|
print('Please upgrade your bazel installation to version %s or higher to '
|
||||||
'build TensorFlow!' % min_version)
|
'build TensorFlow!' % min_version)
|
||||||
sys.exit(0)
|
sys.exit(1)
|
||||||
if curr_version_int > max_version_int:
|
if (curr_version_int > max_version_int and
|
||||||
|
'TF_IGNORE_MAX_BAZEL_VERSION' not in os.environ):
|
||||||
print('Please downgrade your bazel installation to version %s or lower to '
|
print('Please downgrade your bazel installation to version %s or lower to '
|
||||||
'build TensorFlow!' % max_version)
|
'build TensorFlow!' % max_version)
|
||||||
sys.exit(0)
|
sys.exit(1)
|
||||||
return curr_version
|
return curr_version
|
||||||
|
|
||||||
|
|
||||||
@ -1565,11 +1554,9 @@ def main():
|
|||||||
# environment variables.
|
# environment variables.
|
||||||
environ_cp = dict(os.environ)
|
environ_cp = dict(os.environ)
|
||||||
|
|
||||||
check_bazel_version('0.15.0', '0.20.0')
|
check_bazel_version('0.18.0', '0.20.0')
|
||||||
|
|
||||||
reset_tf_configure_bazelrc()
|
reset_tf_configure_bazelrc()
|
||||||
# Explicitly import tools/bazel.rc, this is needed for Bazel 0.19.0 or later
|
|
||||||
write_to_bazelrc('import %workspace%/tools/bazel.rc')
|
|
||||||
|
|
||||||
cleanup_makefile()
|
cleanup_makefile()
|
||||||
setup_python(environ_cp)
|
setup_python(environ_cp)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# Select bazel version.
|
# Select bazel version.
|
||||||
BAZEL_VERSION="0.15.0"
|
BAZEL_VERSION="0.20.0"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}')
|
local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}')
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
# It will compile bazel from source and install it in /usr/local/bin
|
# It will compile bazel from source and install it in /usr/local/bin
|
||||||
|
|
||||||
# Select bazel version.
|
# Select bazel version.
|
||||||
BAZEL_VERSION="0.15.0"
|
BAZEL_VERSION="0.20.0"
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}')
|
local_bazel_ver=$(bazel version 2>&1 | grep -i label | awk '{print $3}')
|
||||||
|
@ -65,7 +65,7 @@ RUN echo "startup --batch" >>/etc/bazel.bazelrc
|
|||||||
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
||||||
>>/etc/bazel.bazelrc
|
>>/etc/bazel.bazelrc
|
||||||
# Install the most recent bazel release.
|
# Install the most recent bazel release.
|
||||||
ENV BAZEL_VERSION 0.15.0
|
ENV BAZEL_VERSION 0.20.0
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN mkdir /bazel && \
|
RUN mkdir /bazel && \
|
||||||
cd /bazel && \
|
cd /bazel && \
|
||||||
|
@ -87,7 +87,7 @@ RUN echo "startup --batch" >>/etc/bazel.bazelrc
|
|||||||
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
||||||
>>/etc/bazel.bazelrc
|
>>/etc/bazel.bazelrc
|
||||||
# Install the most recent bazel release.
|
# Install the most recent bazel release.
|
||||||
ENV BAZEL_VERSION 0.15.0
|
ENV BAZEL_VERSION 0.20.0
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN mkdir /bazel && \
|
RUN mkdir /bazel && \
|
||||||
cd /bazel && \
|
cd /bazel && \
|
||||||
|
@ -88,7 +88,7 @@ RUN echo "startup --batch" >>/etc/bazel.bazelrc
|
|||||||
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
||||||
>>/etc/bazel.bazelrc
|
>>/etc/bazel.bazelrc
|
||||||
# Install the most recent bazel release.
|
# Install the most recent bazel release.
|
||||||
ENV BAZEL_VERSION 0.15.0
|
ENV BAZEL_VERSION 0.20.0
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN mkdir /bazel && \
|
RUN mkdir /bazel && \
|
||||||
cd /bazel && \
|
cd /bazel && \
|
||||||
|
@ -79,7 +79,7 @@ RUN echo "startup --batch" >>/etc/bazel.bazelrc
|
|||||||
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
RUN echo "build --spawn_strategy=standalone --genrule_strategy=standalone" \
|
||||||
>>/etc/bazel.bazelrc
|
>>/etc/bazel.bazelrc
|
||||||
# Install the most recent bazel release.
|
# Install the most recent bazel release.
|
||||||
ENV BAZEL_VERSION 0.15.0
|
ENV BAZEL_VERSION 0.20.0
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN mkdir /bazel && \
|
RUN mkdir /bazel && \
|
||||||
cd /bazel && \
|
cd /bazel && \
|
||||||
|
Loading…
Reference in New Issue
Block a user