The Chinese Heritage Foundation in Minneapolis, a non-governmental organization, had proposed the idea to him in 2013.
The saga, one of the greatest classics in Chinese literature, contains all the elements needed for an opera: love triangles, jealousy, death and more.
But reading through 120 chapters of the novel translated into English, with more than 500 characters, was a challenge for Gockley.
He says he even asked his Chinese friends in San Francisco if the attempt was crazy. They answered, "No. It's a fabulous idea!"
His friends told him that a good way for Americans to understand China was to understand A Dream of Red Mansions.
When the project took off last year, Gockley asked Sheng for two things. First, the music - both vocal and instrumental - should relate to Chinese music, so use Chinese instruments. Second, it must be "beautiful" and avoid traces of European modernism in the score.
In February, a few songs from the opera were previewed at the 2015 Stanford Pan-Asian Music Festival in Stanford, California, by Shenzhen Symphony Orchestra. Gockley says that was enough to convince him the composer was on the right track.
This isn't the first time that Gockley commissioned an opera adapted from Chinese literature. In 2007, he commissioned Stewart Wallace's The Bonesetter's Daughter, based on Amy Tan's novel and featuring a libretto by the Chinese-American author.
He talks of San Francisco Opera's association with China. In 1987, Western Opera Theater, the annual touring program of San Francisco Opera, performed Tosca in Shanghai and also gave master classes at Shanghai Conservatory of Music.
"When I return to China again, I would like to have specific programs where our skills and resources in San Francisco could be in collaboration with Chinese opera houses and conservatories," he says.