mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-15 02:59:33 +07:00
IDEA-163185 [Gradle|Sync] fix: don't resolve the content root as a build root for the generated sources under it
The build root cannot be excluded and used as a content root at the same time. GitOrigin-RevId: 9129066a84a51db569b1058e27a92db49c6624ef
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7818039983
commit
3ca055a407
@@ -59,21 +59,25 @@ class GradleContentRootIndex {
|
||||
): Set<Path> {
|
||||
|
||||
val projectRootPath = externalProject.projectDir.toPath()
|
||||
val buildRootPath = externalProject.buildDir.toPath()
|
||||
|
||||
val contentRootPaths = NioPathPrefixTreeFactory.createSet()
|
||||
for (sourceDirectorySet in sources.values) {
|
||||
for (sourceRootPath in sourceDirectorySet) {
|
||||
val contentRootPath = resolveContentRoot(projectRootPath, sourceRootPath)
|
||||
val contentRootPath = resolveContentRoot(projectRootPath, buildRootPath, sourceRootPath)
|
||||
contentRootPaths.add(contentRootPath)
|
||||
}
|
||||
}
|
||||
return contentRootPaths.getRoots()
|
||||
}
|
||||
|
||||
private fun resolveContentRoot(projectRootPath: Path, sourceRootPath: Path): Path {
|
||||
private fun resolveContentRoot(projectRootPath: Path, buildRootPath: Path, sourceRootPath: Path): Path {
|
||||
if (!sourceRootPath.startsWith(projectRootPath)) {
|
||||
return sourceRootPath
|
||||
}
|
||||
if (sourceRootPath.startsWith(buildRootPath)) {
|
||||
return sourceRootPath
|
||||
}
|
||||
val contentRootPath = sourceRootPath.parent
|
||||
if (contentRootPath == null || contentRootPath == projectRootPath) {
|
||||
return sourceRootPath
|
||||
|
||||
Reference in New Issue
Block a user