Reputation: 95
I am trying to add an auto-generated file (Mock.generated.swift
by running swiftymocky generate
) to my Compile Sources list of my test target.
To do so, I added a Run Script phase before Compile Sources phase as:
swiftymocky generate
And I also dragged the generated file Mock.generated.swift
to my project but delete it from the local disk. (I want to add it by script but I don't know how.) Then the file will show as RED in the project navigator to indicate it's missing.
Then when I build the test target, I see the file Mock.generated.swift
is back. But I still get the compilation error:
Build input file cannot be found
So what's wrong with my attempt? Is it possible to dynamically add file to the Compile Sources list after the file is generated?
Upvotes: 2
Views: 1306
Reputation: 88142
run script
phase should be before Compile Sources
phaseOutput Files
.By doing this you're letting Xcode know that it should wait this script to be finished before capturing the file structure.
Upvotes: 5