Skip to content

Instantly share code, notes, and snippets.

@DenWav
Last active October 5, 2016 23:32
Show Gist options
  • Save DenWav/ccd3d9de4878690fd74da1eb7c433bb1 to your computer and use it in GitHub Desktop.
Save DenWav/ccd3d9de4878690fd74da1eb7c433bb1 to your computer and use it in GitHub Desktop.
Set<Module> goodModules = toImport.stream()
.flatMap(n -> n.getChildren().stream())
.flatMap(n -> {
if (n.getData() instanceof GradleSourceSetData) {
return n.getChildren().stream()
.filter(n1 -> n1.getData() instanceof DependencyData)
.filter(n1 -> ((DependencyData) n1.getData()).getOwnerModule().getExternalName().contains("main"));
} else {
return Stream.of(n);
}
})
.filter(n -> n.getData() instanceof AbstractDependencyData)
.filter(n -> ((AbstractDependencyData) n.getData()).getExternalName().matches("(^" + spongeMatcher + "|Sponge(Common|API)).*"))
.map(n -> modelsProvider.findIdeModule(((DependencyData) n.getData()).getOwnerModule()))
.collect(Collectors.toSet());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment