Add code for mangling platform-defs
Fix a logic error
Fix noBuild referenced before assignment