Moves most of functionality to API package for ScalaProject

Sufficient to compile plugins.