diff --git a/.gitignore b/.gitignore index cdbd28eca7c..683795447cb 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,4 @@ gradleBuild **/target .tf_configure.bazelrc .clwb/ +/tensorflow-core/tensorflow-core-api/config.log diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 88e17c1ca3d..09563247a16 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -24,11 +24,9 @@ complete build could be required to reflect the changes, otherwise `-Pdev` shoul ### Native Builds In some cases, like when adding GPU support or re-generating op classes, you will need to re-build the native library. 99% of this is building -TensorFlow, which by default is configured for the [CI](.github/workflows/ci.yml). The build configuration can be customized using the same methods as -TensorFlow, so if you're building locally, you may need to clone the [tensorflow](https://github.com/tensorflow/tensorflow) project, run its -configuration script (`./configure`), and copy the resulting -`.tf_configure.bazelrc` to `tensorflow-core-api`. This overrides the default options, and you can add to it manually (i.e. adding `build --copt="-g"` -to build with debugging info). +TensorFlow, which by default is configured for the [CI](.github/workflows/ci.yml). The build configuration can be customized using the `configure` +scripts in `tensorflow-core-api`, which call the scripts downloaded with the tensorflow dependency. This overrides the default options, and you can +add to it manually (i.e. adding `build --copt="-g"` to build with debugging info). ### GPU Support @@ -90,7 +88,8 @@ in [IntelliJ](https://github.com/google/styleguide/blob/gh-pages/intellij-java-g ### Dependencies -For dependencies, we can use anything compliant with [this list](https://opensource.google/docs/thirdparty/licenses/#notice), but we want to keep the core libraries as dependency free as possible. +For dependencies, we can use anything compliant with [this list](https://opensource.google/docs/thirdparty/licenses/#notice), but we want to keep the +core libraries as dependency free as possible. ### Code generation diff --git a/tensorflow-core/tensorflow-core-api/.bazelversion b/tensorflow-core/tensorflow-core-api/.bazelversion new file mode 100644 index 00000000000..a0cd9f0ccb0 --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/.bazelversion @@ -0,0 +1 @@ +3.1.0 \ No newline at end of file diff --git a/tensorflow-core/tensorflow-core-api/build.sh b/tensorflow-core/tensorflow-core-api/build.sh index 6f283bb66dc..947d10f4988 100755 --- a/tensorflow-core/tensorflow-core-api/build.sh +++ b/tensorflow-core/tensorflow-core-api/build.sh @@ -2,6 +2,10 @@ # Script to build native TensorFlow libraries set -eu +if [ ! -f .tf_configure.bazelrc ]; then + echo "No .tf_configure.bazelrc, using CI settings. For local builds, run the ./configure script." +fi + # Allows us to use ccache with Bazel on Mac export BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 diff --git a/tensorflow-core/tensorflow-core-api/configure b/tensorflow-core/tensorflow-core-api/configure new file mode 100644 index 00000000000..f52079bc55b --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/configure @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# +# Copyright 2021 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== +# +set -e + +bazel fetch @org_tensorflow//- || true + +BASE=$(bazel info output_base) +"$BASE"/external/org_tensorflow/configure +mv "$BASE"/external/org_tensorflow/.tf_configure.bazelrc . diff --git a/tensorflow-core/tensorflow-core-api/configure.cmd b/tensorflow-core/tensorflow-core-api/configure.cmd new file mode 100644 index 00000000000..15c5cc12b8c --- /dev/null +++ b/tensorflow-core/tensorflow-core-api/configure.cmd @@ -0,0 +1,26 @@ +@echo off + +:: +:: Copyright 2021 The TensorFlow Authors. All Rights Reserved. +:: +:: Licensed under the Apache License, Version 2.0 (the "License"); +:: you may not use this file except in compliance with the License. +:: You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: ============================================================================== +:: + +bazel fetch @org_tensorflow//- + +for /f %%i in ('bazel info output_base') do set VAR=%%i + +CALL %VAR%\\external\\org_tensorflow\\configure.cmd + +MOVE %VAR%\\external\\org_tensorflow\\.tf_configure.bazelrc . \ No newline at end of file