Tomato, courgette and aubergine gratin