bazelbuild / rules_apple

Bazel rules to build apps for Apple platforms.
Apache License 2.0
514 stars 269 forks source link

Not compatible with `--noexperimental_python_import_all_repositories` #2594

Open likesum opened 1 week ago

likesum commented 1 week ago

The --noexperimental_python_import_all_repositories setting is useful in working around https://github.com/bazelbuild/bazel/issues/14640 with the PYTHONPATH becoming too large if you have python targets with large numbers of dependencies.

But rules_apple does not seem to be compatible with this. Specifically, when using apple_core_ml_library with --noexperimental_python_import_all_repositories

ERROR:*****/BUILD:346:22: MlmodelGenerate ****/****.m failed: (Exit 1): xctoolrunner failed: error executing MlmodelGenerate command (from target //****:****.CoreML) bazel-out/darwin_arm64-opt-exec-ST-13d3ddad9198/bin/external/build_bazel_rules_apple/tools/xctoolrunner/xctoolrunner coremlc generate ... (remaining 2 arguments skipped)

Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging

Traceback (most recent call last):

  File "****/../build_bazel_rules_apple/tools/xctoolrunner/xctoolrunner.py", line 43, in <module>

    from tools.wrapper_common import execute

ModuleNotFoundError: No module named 'tools'
jiawen commented 1 week ago

This is an unfortunate entangling of rules_python dependencies with rules_apple internals, which happens to use a Python based xctoolrunner.py which should in principle have its separate hermetic PYTHONPATH.