Skip to content

Commit 355ff71

Browse files
Merge pull request #178 from mezpahlan/support_exotic_gradle_projects
Support exotic gradle projects
2 parents 2c16c05 + aefe941 commit 355ff71

File tree

2 files changed

+244
-53
lines changed

2 files changed

+244
-53
lines changed

affectedmoduledetector/src/main/kotlin/com/dropbox/affectedmoduledetector/ProjectGraph.kt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,16 @@ internal class ProjectGraph(project: Project, val gitRoot: File, val logger: Log
4040
logger?.info("creating node for ${it.path}")
4141
val relativePath = it.projectDir.canonicalFile.toRelativeString(rootProjectDir)
4242
val sections = relativePath.split(File.separatorChar)
43-
logger?.info("relative path: $relativePath , sections: $sections")
44-
val leaf = sections.fold(rootNode) { left, right ->
43+
44+
// If the subproject is not a child of the root project (in the File directory sense)
45+
// then we are in some weird non standard quixotic project and our sections are going
46+
// to have ".." characters indicating that we need to traverse up one level. However
47+
// we need to filter these out because this will not match the parent child
48+
// dependency relationship that Gradle will produce.
49+
val realSections = sections.filter { section -> section != ".." }
50+
51+
logger?.info("relative path: $relativePath , sections: $realSections")
52+
val leaf = realSections.fold(rootNode) { left, right ->
4553
left.getOrCreateNode(right)
4654
}
4755
leaf.project = it

0 commit comments

Comments
 (0)