Thanks for being a part of WWDC25!

How did we do? We’d love to know your thoughts on this year’s conference. Take the survey here

Making an xcode Run Script phase run when any file within a folder has changed

I have an Xcproject that I am using to define a .framework target that includes Objective-C++ bridges for a whole slew of C++ libraries.

To bridge Objective-C++ to Swift code in a separate target, I am using a .modulemap file that I generate in a script.

So we've essentially got

App.xcproject
   App target { Dependency on Bridges.framework }
Bridges.xcproject 
   Bridges.framework { Dependency on generate-modulemap + a whole slough of c++ libraries }
   generate-modulemap

It is VERY expensive for the Bridges framework to need to compile each build. The generation of the bridge static library takes 21 seconds, and the signing of it takes 32 seconds.

I would like to get generate-module to have its RunScript phase run based on dependency analysis. This way a new modulemap is only made when there is a new header and I can avoid compiling the whole framework each build. Normally, I would just list all of the headers in the input list to the script, but in this case, the goal is more to have it be any file within that folder. However, it is very unclear how to do so. Is there a way to get the "based on dependency analysis" to go based on any file within a folder?

A filelist does not work here because the filelist does not get updated automatically when you add a new header into that folder.

A filelist does not work here because the filelist does not get updated automatically when you add a new header into that folder.

It sounds like you have dynamic inputs to the file list, and you could meet your needs if the file list supported wildcard patterns. Xcode doesn't support wildcards in file lists, so it's a worthwhile enhancement request to file. Please post the FB number here if you do.

— Ed Ford,  DTS Engineer

Making an xcode Run Script phase run when any file within a folder has changed
 
 
Q