A decade-long pact will turn a vast ex-car factory into a hub for drones, unmanned vehicles and batteries.