Houston is trading Trevor Ariza and the No. 16 pick in Wednesday night’s draft to Detroit for a future first-round pick, sources tell ESPN’s Adrian Wojnarowski.

The deal gives the Rockets — a hard-capped team — the freedom to use their mid-level exception in free agency.

The Rockets are purchasing Detroit’s 2021 second-round pick — via the Lakers — for $4.6 million, sources tell ESPN.

The Rockets had agreed to acquire Ariza and the No. 16 pick from Portland earlier this week as part of the Robert Covington deal.

Ariza, 35, arrived with the Blazers in February as part of a trade with Sacramento and started every one of his 21 games for Portland, averaging 11 points, 4.8 rebounds and one steal. He shot 49% from the floor, including 40% on 3-pointers. For his career, Ariza has averaged 10.5 points, 4.8 rebounds and 2.2 assists in 16 seasons.