Supply and demand are two different things. When you think of an energy code, say the International Energy Conservation Code (IECC International Energy Conservation Code.), you probably think of demand, not supply. Conserving energy, after all, means reducing demand. It's related to supply only indirectly.
As a result, you might expect an energy conservation code to have requirements that affect only the demand side of the equation. With the 2015 IECC, however, that's not true anymore.
from Building Science http://www.greenbuildingadvisor.com/articles/dept/building-science/using-rooftop-solar-meet-energy-code