From dd372ec5e16266c9898b91a9b978a0861368e07a Mon Sep 17 00:00:00 2001 From: Christian Sigg Date: Wed, 17 Mar 2021 12:45:10 -0700 Subject: [PATCH] Do not write `TF_CONFIGURE_IOS` to .bazelrc, only use it in ./configure.py. PiperOrigin-RevId: 363484115 Change-Id: I5fd6186f19d1612ef9fe85a088aa7a72dc45d26d --- .bazelrc | 1 - configure.py | 15 +++++---------- tensorflow/lite/ios/build_frameworks.sh | 11 +++-------- 3 files changed, 8 insertions(+), 19 deletions(-) diff --git a/.bazelrc b/.bazelrc index 2df0f33f930..1c514fc5f43 100644 --- a/.bazelrc +++ b/.bazelrc @@ -542,7 +542,6 @@ try-import %workspace%/.bazelrc.user # Here are bazelrc configs for release builds build:release_base --config=v2 build:release_base --distinct_host_configuration=false -build:release_base --action_env TF_CONFIGURE_IOS="0" build:release_cpu_linux --config=release_base build:release_cpu_linux --config=avx_linux diff --git a/configure.py b/configure.py index 898ecb06b0c..a3460fd50ec 100644 --- a/configure.py +++ b/configure.py @@ -1201,13 +1201,12 @@ def config_info_line(name, help_text): print('\t--config=%-12s\t# %s' % (name, help_text)) -def configure_ios(): - """Configures TensorFlow for iOS builds. - - This function will only be executed if `is_macos()` is true. - """ +def configure_ios(environ_cp): + """Configures TensorFlow for iOS builds.""" if not is_macos(): return + if not get_var(environ_cp, 'TF_CONFIGURE_IOS', 'iOS', False): + return for filepath in APPLE_BAZEL_FILES: existing_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath + '.apple') renamed_filepath = os.path.join(_TF_WORKSPACE_ROOT, filepath) @@ -1326,8 +1325,6 @@ def main(): if is_macos(): environ_cp['TF_NEED_TENSORRT'] = '0' - else: - environ_cp['TF_CONFIGURE_IOS'] = '0' with_xla_support = environ_cp.get('TF_ENABLE_XLA', None) if with_xla_support is not None: @@ -1451,9 +1448,7 @@ def main(): system_specific_test_config(environ_cp) - set_action_env_var(environ_cp, 'TF_CONFIGURE_IOS', 'iOS', False) - if environ_cp.get('TF_CONFIGURE_IOS') == '1': - configure_ios() + configure_ios(environ_cp) print('Preconfigured Bazel build configs. You can use any of the below by ' 'adding "--config=<>" to your build command. See .bazelrc for more ' diff --git a/tensorflow/lite/ios/build_frameworks.sh b/tensorflow/lite/ios/build_frameworks.sh index 31410b9b54b..b4a440de98d 100755 --- a/tensorflow/lite/ios/build_frameworks.sh +++ b/tensorflow/lite/ios/build_frameworks.sh @@ -161,15 +161,10 @@ if ! grep -q "3.4.0" ".bazelversion"; then echo "3.4.0" > .bazelversion fi -# Check if users already run configure -if [ ! -f "$ROOT_DIR/.tf_configure.bazelrc" ]; then - echo "ERROR: Please run ./configure first." +# Check if users ran configure with iOS enabled. +if [ ! -f "$ROOT_DIR/TensorFlowLiteObjC.podspec" ]; then + echo "ERROR: Please run ./configure with iOS config." exit 1 -else - if ! grep -q "TF_CONFIGURE_IOS=\"1\"" "$ROOT_DIR/.tf_configure.bazelrc"; then - echo "ERROR: Please run ./configure with iOS config." - exit 1 - fi fi # Prepare the tmp directory.