Push the top level logic for writing out swiftmodules and associated files into the frontend library which has access to all the necessary dependencies.