Generate files only when it is needed

Summary: Lowers average build time in projects using this by a lot

Test Plan:
remove output folder, see it is generated. Modify a swagger spec, and see it is generated.
Don't change anything, and see that it doesn't re-generate files

Reviewers: nitro, kt, prateek.pandey, jd, aa

Reviewed By: aa

Subscribers: eng

Differential Revision: http://phabricator.scale-data.com/D1323