Add pre-build hook to make this work with v2 format.

Changes for v2 format compatibility.