Handle inter-module scoped dependencies properly.

They were all being classified as compile dependencies, which failed when you
had a module depend on another module as a test dependency, for example.