Xcode 10 copy phase fails on input from different target

I'm using Xcode 10.1 on Mojave.


I use an external tool (twine) to generate localization files for my app. Other targets need to copy these localizations, so I put my twine script as an "External Build Tool" target and added it as a target dependency on the targets that need to copy the files it generates.


This fails for every single copy phase that depends on these localizations. I get messages like


error: Build input file cannot be found: '/Users/me/proj/myapp/MyExtension/Resources/fr.lproj/Localizable.strings'


When I check my project directory, the generated files definitely exist. When I check the build log, the files are all generated well in advance of any copy phase running, so a race condition seems unlikely.


This is not a path name issue or similar, because if I then build a second time (the localization files generated from the previous build already exist), the build succeeds!


I have also tried creating empty localization files and building. The twine script then overwrites the files and they are copied successfully (I checked that the copied files contain strings info).


This is also not an issue with twine. If I move the localization files outside the project (so they don't exist as far the build is concerned) and have my build script simply move them back (as if they were newly generated), it fails for the exact same reason. The problem seems to be only related to the files not existing and then appearing while the build is in progress.


It seems like Xcode 10 somehow remembers that the files didn't exist at the beginning of the build and decides to fail, even though the files do exist by the time the copy phase is run. What is going on? How do I get a copy phase to copy files that might not exist at the time that the build is started?

Replies

You should probably ask the question to Twine directly.

If I simply move the the localization files elsewhere (so they don't exist when the build starts) and make the script move the files back (no twine involved), the build still fails for the same reason: the copy phases can't find the files even though they are moved back in place before the copy phase runs.


This bug occurs even when twine is not involved in my build process.

I'm working around this for now by just checking the generated files into the build system so that they always exist.


It's completely redundant and it has actually caused us issues in the past because it means we need to remember to also check in the generated files whenever the source files change, but it seems like with Xcode 10 it is necessary in order to make our builds work.