rework caching logic

- never cache files that produced warnings
- only use cache if it is more current than all its dependencies