The Buffalo Bills have traded wide receiver Sammy Watkins and a sixth-round pick in next year’s draft to the Los Angeles Rams for cornerback E.J. Gaines and a 2018 second-round pick, the Bills announced Friday.

Also Friday, the Bills also acquired wide receiver Jordan Matthews and 2018 third-round pick from the Philadelphia Eagles for cornerback Ronald Darby.

The Bills’ decision to trade their top receiver and top cornerback for future draft picks signals that first-year general manager Brandon Beane and coach Sean McDermott view the Bills as a long-term rebuilding project.

Buffalo now owns two selections in the first, second and third rounds of the 2018 draft. The Bills previously acquired the Kansas City Chiefs‘ first-round pick in trading down during the 2017 draft to select cornerback Tre’Davious White at No. 27.

The departure of Watkins strips quarterback Tyrod Taylor of his top passing target this season. Taylor took a $10 million pay cut to remain with the Bills this offseason, but his future with the team remains in doubt. The Bills can release Taylor before paying him a $6 million roster bonus next March and save most of his $18 million cap number in 2018, the final year of his contract.

Darby, who finished second in voting for defensive rookie of the year in 2015, had two years remaining on his contract. White now projects as the Bills’ top cornerback this season with Gaines likely to start opposite him.

The Rams have been searching all year for an outside vertical threat to compliment Sean McVay’s offense and finally have that player in Watkins, who joins former Bills teammate Robert Woods on the Rams’ receiving corps.

The Rams were previously hoping that the 5-foot-8 Tavon Austin would adapt to that role, but he spent the offseason recovering from wrist surgery and had been held out of training camp because of a hamstring injury. The Rams’ other vertical threat, Mike Thomas, is suspended the first four games for violating the NFL’s policy on performance-enhancing substances. And their last one, Josh Reynolds, is a rookie who is still quite raw.

Watkins can play a role similar to the one DeSean Jackson played on McVay’s offense in Washington the past four years. Watkins joins Woods and slot receiver Cooper Kupp in three-receiver sets, putting Austin’s role on the team in serious question.

Watkins enters the 2017 season on the final year of his contract, after the Bills declined his fifth-year option earlier this offseason.

Gaines seemingly entered training camp in competition with newcomer Kayvon Webster for the No. 2 cornerback job, alongside Trumaine Johnson. But Webster’s familiarity with Wade Phillips’ system — Webster played on Phillips’ Broncos defenses these past two years — gave him an advantage and ultimately won him the job.

Matthews has been a highly productive player since being selected 42nd overall in 2014. He ranks first in receptions (225) and third in receiving yards (2,673) among Eagles in their first three years, and is one of only five players in NFL history with 65-plus receptions and 800-plus receiving yards in each of their first three seasons, joining a club that includes Randy Moss, Odell Beckham Jr., Mike Evans and A.J. Green.

Despite the production, the Eagles never got serious about working out a contract extension with Matthews, who is in the final year of his rookie deal. Executive vice president of football operations Howie Roseman has a history of re-upping homegrown players early if they have been identified as part of the core. It was telling that he chose not to aggressively pursue a new contract with Matthews.

Part of the issue is that Matthews’ value is difficult to gauge. His numbers suggest he’s deserving of something in the range of Kenny Stills (four years, $32 million) or Austin (four years, $42 million). The counter would be that Matthews is a slot receiver — not an exceptionally explosive one relative to some others out there — and paying big money for a player who might end up being the team’s third receiving option doesn’t make sense, especially if they want to extend Alshon Jeffery beyond this year.

There is also a knee injury to consider. Matthews has struggled to get right since sustaining what was described as a bone bruise last August on a low hit during training camp. One ailment after the next has crept up in the months since. He is currently dealing with knee tendinitis, which kept him from practicing for a good portion of the spring. A recent report suggested some team employees believe Matthews could have practiced more but allowed his contract status to influence his decision-making, a charge that the Matthews strongly denied.

Nelson Agholor enjoyed a strong spring manning the slot in Matthews’ absence. The Eagles are also high on rookie Mack Hollins and second-year player Marcus Johnson. The departure of Matthews will make it easier for the front office to keep some of the promising young talent on the 53-man roster.

Just as importantly, the trade brings some much-needed talent to a suspect cornerback group. Patrick Robinson and Jalen Mills sat atop the depth chart before the deal, with Ron Brooks as the favorite to man the slot. (Brooks, coming off a ruptured quad tendon, injured his hamstring Thursday in the preseason opener against the Green Bay Packers). Inconsistency has plagued the group during the spring and summer, and defensive coordinator Jim Schwartz has made it quite clear that the competition is far from settled.

“I’d love to have some continuity there. But we also have to let it play,” he said.

ESPN Bills reporter Mike Rodak, ESPN Rams reporter Alden Gonzalez and ESPN Eagles reporter Tim McManus contributed to this report.