An Optimization Framework for “Build-or-Buy” Decisions in Software Architecture