Fix building multiple modules with shared excludes

If module A & B both require module Z but also are set to exclude it,
after build, A & B don't contain Z as expected,
but module Z is empty.
Test for #322
Merge pull request #322 from avaly/bug-module-exclude

Fix building multiple modules with shared excludes