While raging, an Ancestral Guardian barbarian (Xanathar's Guide to Everything, p. 9-10) can activate Ancestral Protectors on a creature he/she has just attacked. The ability states that:
Until the start of your next turn, that target has disadvantage on any attack roll that isn’t against you, and when the target hits a creature other than you with an attack, that creature has resistance to the damage dealt by the attack.
If said creature deals multiple types of damage in one attack - if a creature is resistant to all of those forms of damage, this answer states that each damage type is halved before damage is totaled. However, Ancestral Protectors does not give resistance to each type of damage dealt by the attack - it gives resistance to the attack itself. When calculating the damage dealt, would you still calculate it per the linked answer, or would you add it all, and then apply resistance?
To use the example from the Uncanny Dodge question: If the attack dealt 5 bludgeoning damage and 3 piercing damage, would Ancestral Protectors reduce it to (5+3)/2 = 4 damage, or would it reduce each packet individually for 3 damage total?
In short: Does gaining resistance to the damage of an attack mean gaining resistance to all types of damage contained in that attack, or does it mean halving the total damage of that attack?