Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize toolchain size by preserving TensorFlow library symlinks. (s…
…wiftlang#27032) Bazel produces multiple TensorFlow library artifacts: ``` $ ls -alh tensorflow/bazel-bin/tensorflow 18B libtensorflow.so -> libtensorflow.so.1 23B libtensorflow.so.1 -> libtensorflow.so.1.14.0 277M libtensorflow.so.1.14.0 ``` Previously, TensorFlow libraries were copied using `cp -a` via a glob pattern. For some reason, symlinks were not preserved: ``` $ ls -alh <TOOLCHAIN_BEFORE>.xctoolchain/usr/lib/swift/macosx 18B libtensorflow.so -> libtensorflow.so.1 277M libtensorflow.so.1 277M libtensorflow.so.1.14.0 # duplicate library ``` Now, rather than copying all libraries via glob, `copy_file_preserving_symlinks` copies exactly the necessary source files to the destination while preserving symlinks: ``` $ ls -alh <TOOLCHAIN_AFTER>.xctoolchain/usr/lib/swift/macosx 18B libtensorflow.so -> libtensorflow.so.1 277M libtensorflow.so.1 ``` This combined with removing libtensorflow_framework.so dependency (swiftlang#27029) led to a macOS toolchain size reduction from 4.91 GB to 3.45 GB.
- Loading branch information