Run Script runs when building for simulator but not when building for actual hardware

Hello,

I have a custom script that builds a library needed for integrating Rust code into a project. The script works just fine when I build for the simulator. But, when I switch the target to an actual device (connected via USB) the script does not run.

Here is what I have for the Run Script section:

# Type a script or drag a script file from your workspace to insert its path.
echo "Running script..."
bash ${PROJECT_DIR}/bin/compile-library.sh shipping-rust-ffi $BUILDVARIANT
echo "...completed"

Here is the relevant portion of the log when building for the simulator showing the script running:

Here is the relevant portion of the log when building for hardware showing that phase being skipped:

I have looked through all the Build Settings, Build Phases, and Build Rules sections with no luck.

What I am doing is just a simple test app based upon this article:

https://blog.mozilla.org/data/2022/01/31/this-week-in-glean-building-and-deploying-a-rust-library-on-ios/

I'm using Xcode 14.1 under macOS Monterey 12.6.1 on an Apple M1 Pro.

Thank you in advance for your help

Answered by ptdecker in 735428022

Problem solved. It is non-obvious that on the Build Phases tab, the "Run Script" phase can be drag-n-dropped anywhere in the sequence. When one adds a "Run Script" phase, it is added at the bottom of the list after the link phase. I'm still unsure why it WORKED when I was running the simulator. I suspect it worked once then every time I did a build it was using the library linked from the PRIOR build. Once it ran, I discovered a root cause issue which once resolved got everything working.

Problem solved. It is non-obvious that on the Build Phases tab, the "Run Script" phase can be drag-n-dropped anywhere in the sequence. When one adds a "Run Script" phase, it is added at the bottom of the list after the link phase. I'm still unsure why it WORKED when I was running the simulator. I suspect it worked once then every time I did a build it was using the library linked from the PRIOR build. Once it ran, I discovered a root cause issue which once resolved got everything working.

Accepted Answer

Problem solved. It is non-obvious that on the Build Phases tab, the "Run Script" phase can be drag-n-dropped anywhere in the sequence. When one adds a "Run Script" phase, it is added at the bottom of the list after the link phase. I'm still unsure why it WORKED when I was running the simulator. I suspect it worked once then every time I did a build it was using the library linked from the PRIOR build. Once it ran, I discovered a root cause issue which once resolved got everything working.

Run Script runs when building for simulator but not when building for actual hardware
 
 
Q