Replaced unique_future by decltype() in BuildEnvironment