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?