Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduceEdges does not always work for direct Dependencies #82

Closed
ferstl opened this issue Aug 6, 2018 · 0 comments
Closed

reduceEdges does not always work for direct Dependencies #82

ferstl opened this issue Aug 6, 2018 · 0 comments
Assignees
Milestone

Comments

@ferstl
Copy link
Owner

ferstl commented Aug 6, 2018

The reduceEdges option does not always work correctly for direct dependencies for a module. For example, GraphIntegrationTest#transitiveExludes() shows this behavior. This is the currently created graph:

com.github.ferstl:module-3:compile
+- com.github.ferstl:module-1:compile
|  +- commons-codec:commons-codec:compile
|  +- org.apache.commons:commons-lang3:compile
|  \- junit:junit:test
|     \- org.hamcrest:hamcrest-core:test
+- com.github.ferstl:module-2:compile
|  +- com.github.ferstl:module-1:compile
|  +- com.google.guava:guava:compile
|  +- org.springframework:spring-core:compile (optional)
|  \- junit:junit:test
\- com.mysema.querydsl:querydsl-core:compile
   +- com.mysema.commons:mysema-commons-lang:compile
   \- com.infradna.tool:bridge-method-annotation:compile

However, the graph should look like:

com.github.ferstl:module-3:compile
+- com.github.ferstl:module-2:compile
|  +- com.github.ferstl:module-1:compile
|  |  +- commons-codec:commons-codec:compile
|  |  +- org.apache.commons:commons-lang3:compile
|  |  \- junit:junit:test
|  |     \- org.hamcrest:hamcrest-core:test
|  +- com.google.guava:guava:compile
|  +- org.springframework:spring-core:compile (optional)
|  \- junit:junit:test
\- com.mysema.querydsl:querydsl-core:compile
   +- com.mysema.commons:mysema-commons-lang:compile
   \- com.infradna.tool:bridge-method-annotation:compile

Edges are currently omitted when traversing the graph by checking if there is already another path for a new edge. In this example, this will not work, because the graph is created in this order:

  • module-1 and its dependencies to commons-codec, commons-lang3 and junit
  • module-2 and its dependencies to module-1, guava and spring-core
  • module-3 and its dependencies to module-1, module-2 and querydsl-core

When processing module-3 and the dependency to module-1 is visited first, the edge can not be omitted because there is no other path from module-3 to module-1. When module-2 is visited afterwards, an edge from module-3 to module-2 is created. Since module-2 does already have a path to module-1, the graph does now contain two paths to module-1.

The edge from module-2 to module-1 has to be omitted, because the path via module-2 is "older" (meaning resolved earlier). This can either be achieved after each module is completely processed or after the creation of the full graph.

ferstl added a commit that referenced this issue Aug 7, 2018
Edges having this flag set to true will not be subject to any graph
optimization.
ferstl added a commit that referenced this issue Aug 7, 2018
@ferstl ferstl added the bug label Aug 7, 2018
@ferstl ferstl added this to the 3.2.1 milestone Aug 7, 2018
@ferstl ferstl self-assigned this Aug 7, 2018
ferstl added a commit that referenced this issue Aug 8, 2018
ferstl added a commit that referenced this issue Aug 8, 2018
Merge isReachableInternal() and hasOlderPathInternal() -> isReachable()
@ferstl ferstl closed this as completed Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant