Refactor the generation from a YAML configuration

This is in preparation of moving this into the generator.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org//500933002