Tesla to build motors, gearboxes in Gigafactory