Build duplicated gems only once.