Copy needed imports when building interface mocks

When we are writing out interfaces mocks to a new file, we need to
collect a list of the used imports, so that we can then add them to
the file that we write.  If we don't do this, then the resulting code
probably won't compile - as it will be missing those imports.