Hi,
Using the new build system (the default setting) with Xcode 10 Beta 6 results in the first build failing. Subsequent builds pass.
Configuration
$PODS_ROOT/R.swift/rswift" "generate" "$SRCROOTResult
error: Build input file cannot be found: '/Project/R.generated.swift'
On a local machine, this is not a problem, as we can build again. However, on a CI environment such as Buddybuild, the build continuously fails as it performs a clean build every time.
Is your "Run Script" build phase _before_ the "Compile Sources" phase?

Hi @tomlokhorst. Yes, our run script phase is before the compile sources phase.
Just to confirm: I can reproduce this behaviour (with the example ResourceApp project in this repository)
I haven't looked into why this happens. It appears the "Compile Sources" step doesn't wait for the "R.swift" to finish.
Thanks for the update @tomlokhorst
I'm also running into this.
Workaround for Bitrise: if you run the build twice, setting Do a clean Xcode build before the archive? to no in one workflow, the second build will succeed.
I'm also having this issue. It seems that Xcode 10 has changed something here with Compile Sources.
Wondering if it helps if we define R.generated.swift as an output file of the R.swift step. Maybe that hints Xcode that it should wait for the R.swift step to finish.
Also; it sounds like a Xcode bug to me, because I think that the default should keep working as is.
@mac-cain13 Nope, that doesn't help. I actually have my own step to auto generate some code and it fails as well. Or even with Sourcery.
I think there is something going on with new build system as it's being used in new Xcode 10.
We have solved this by defining R.generated.swift as an output file, as follows:

Thanks @superpeteblaze That worked! ;)
For others who may come across this issue - this solution (defining an output file) worked for us as well. Defining the final output seems to have given the new build system enough of a hint to ensure it has that file in place before attempting a compilation.
@tomlokhorst I think this issue can be closed, as it seems to just be caused by Xcode 10's build system changes.
Lets leave it open for now.
At the minimum we should update the documentation to detail how to set the output file.
Also worth investigating; Should the project.pbxproj file (and other files) be listed in the input files?
I've found that having an Output file listed but no input files seems to make Xcode skip over the step pretty consistently which means it doesn't get updated even when needed.
I've found the same thing; R.swift only runs once when there's only an output file listed.
I tried adding a (manually created) list of input files (.xcfilelist), that seems to work.
But if we have R.swift generate that file, it won't be updated when (for example) a new images is added to an Assets Catalog.
I haven't yet investigated further, but we need to find a solution for this.
I was thinking that it might need to be a multi-step process. My thoughts were:
Please continue this discussion here: https://github.com/mac-cain13/R.swift/issues/456
Most helpful comment
We have solved this by defining R.generated.swift as an output file, as follows: