moves the compile logic to a separated library