cordova-ios icon indicating copy to clipboard operation
cordova-ios copied to clipboard

cordova creating hundreds of Xcode 14 "stale files outside root paths" warnings

Open rolinger opened this issue 2 years ago • 4 comments

Every build from CLI: cordova build ios or ionic cordova build ios - is taking almost 6 minutes to complete the build. After the build, then from Xcode 14 to deploy the app to a device takes another 3 minutes.

In Xcode, during the deploy to device, the issue navigator is tracking nearly 2500 stale files outside of allowed root path warnings. If I clean and run the project <CMD> + SHIFT + K & <CMD> + SHIFT + R - which takes a few minutes to complete, then all those stale files are removed and the deploy then takes like 15 seconds.

But the next time I do a cordova build ios all those stale files return. I believe the 6 minute build time is because cordova is creating those 2500 stale files...and Xcode is trying to process/analyze them during the deploy causing 3+ more minutes of delay.

What is causing these stale files to be created...and what can I do to fix it?

My Mac environment:

Cordova 11.1.0
Cordova-ios: 6.0.2
Ionic CLI: 6.20.8
Ionic toolkit: 3.2.15
native-run: 1.7.1

Example Warnings:

Stale file '/Users/rpo/dev/myApp/platforms/ios/build/emulator/nanopb.framework' is located outside of the allowed root paths.
Stale file '/Users/rpo/dev/myApp/platforms/ios/build/emulator/nanopb.framework.dSYM/Contents/Resources/DWARF/nanopb' is located outside of the allowed root paths.
Stale file '/Users/rpo/dev/myApp/platforms/ios/build/emulator/nanopb.framework/Headers' is located outside of the allowed root paths.
Stale file '/Users/rpo/dev/myApp/platforms/ios/build/emulator/nanopb.framework/Headers/nanopb-umbrella.h' is located outside of the allowed root paths.
Stale file '/Users/rpo/dev/myApp/platforms/ios/build/emulator/nanopb.framework/Headers/pb.h' is located outside of the allowed root paths.

rolinger avatar Sep 20 '23 21:09 rolinger

Can you try the latest cordova-ios 7.0.1 and see if you're still getting these warnings? There were some changes to Xcode derived data paths in the 7.x release that will hopefully resolve these sorts of issues

dpogue avatar Sep 20 '23 21:09 dpogue

oy...thanks for the response @dpogue. Unfortunately, at the moment, I can't upgrade yet. To do so I must also upgrade to Cordova 12 and I am not quite ready to go through all the pain yet.

Is there nothing else I can do with my current install to eliminate all these stale files from being created on every build?

rolinger avatar Sep 21 '23 12:09 rolinger

To do so I must also upgrade to Cordova 12 and I am not quite ready to go through all the pain yet.

You could try upgrading to cordova-ios@7 while staying on CLI v11 but some features might not work.

The CLI doesn't usually have significant breaking changes, most of the time the breaking change is dropping support for NodeJS versions that are now out of support. If you're using current Node LTS you should be fine to upgrade the LTS. The breaking changes is highlighted here however.

The cordova-ios upgrade might be more of a breaking change, you can view that list here.

I'm not 100% sure but I think the change that dpogue was referring to is https://github.com/apache/cordova-ios/pull/1310 so if you truly cannot upgrade, then you'll have to fork and backport manually.

breautek avatar Sep 21 '23 23:09 breautek

Is there nothing else I can do with my current install to eliminate all these stale files from being created on every build?

Probably not, because they are the intermediate build output files that get compiled into the application bundle.

I hope that the fixes in #1310 will resolve this sort of problem, but I don't know for sure. Nobody seems to know exactly what conditions cause this Xcode warning, so nobody is sure how exactly to fix it 😞

dpogue avatar Sep 21 '23 23:09 dpogue