Skip to content

Instantly share code, notes, and snippets.

@DenWav
Last active October 2, 2016 22:16
Show Gist options
  • Select an option

  • Save DenWav/8f2edb9ecb9d5144ec3e6765fa6f0696 to your computer and use it in GitHub Desktop.

Select an option

Save DenWav/8f2edb9ecb9d5144ec3e6765fa6f0696 to your computer and use it in GitHub Desktop.
boolean isForge = node.getChildren().stream()
.filter(n -> n.getData() instanceof ModuleData)
.filter(n -> {
final String[] array = ((ModuleData) n.getData()).getIdeModuleGroup();
return array != null && array.length != 0 && array[0].equals(module.getName());
})
.limit(1)
.flatMap(n -> n.getChildren().stream())
.filter(n -> n.getData() instanceof GradleSourceSetData || n.getData() instanceof LibraryDependencyData)
.filter(n -> !(n.getData() instanceof GradleSourceSetData) || ((GradleSourceSetData) n.getData()).getId().contains("main"))
.limit(1)
.flatMap(n -> {
if (n.getData() instanceof GradleSourceSetData) {
return n.getChildren().stream();
} else {
return Stream.of(n);
}
})
.filter(n -> n.getData() instanceof LibraryDependencyData)
.map(n -> (LibraryDependencyData) n.getData())
.filter(l -> l.getExternalName().isEmpty())
.anyMatch(l -> l.getTarget().getPaths(LibraryPathType.BINARY).stream()
.anyMatch(p -> p.contains("forgeSrc"))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment