Make AI use custom units?

I made some custom terran spaceships that are made at a shipyard building. How do I make the AI build shipyards and create the spaceship units? Is there a way to add the units to the Melee AI?