mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-79488 Allow external Python project systems to control their source roots
GitOrigin-RevId: c0f0966d3033867c1927e05d7073403feb195302
This commit is contained in:
committed by
intellij-monorepo-bot
parent
91e9250379
commit
a2e30a6755
@@ -117,10 +117,9 @@ abstract class BaseProjectModelService<E : EntitySource, P : ExternalProject> {
|
||||
dependencies += ModuleDependency(ModuleId(moduleName.name), true, DependencyScope.COMPILE, false)
|
||||
}
|
||||
contentRoots = listOf(ContentRootEntity(extProject.root.toVirtualFileUrl(fileUrlManager), emptyList(), source) {
|
||||
sourceRoots = listOf(SourceRootEntity(
|
||||
url = (extProject.root / "src").toVirtualFileUrl(fileUrlManager),
|
||||
rootTypeId = PYTHON_SOURCE_ROOT_TYPE,
|
||||
entitySource = source))
|
||||
sourceRoots = extProject.sourceRoots.map { srcRoot ->
|
||||
SourceRootEntity(srcRoot.toVirtualFileUrl(fileUrlManager), PYTHON_SOURCE_ROOT_TYPE, source)
|
||||
}
|
||||
})
|
||||
exModuleOptions = ExternalSystemModuleOptionsEntity(source) {
|
||||
externalSystem = systemName
|
||||
|
||||
@@ -15,6 +15,9 @@ data class PoetryProject(
|
||||
override val root: Path,
|
||||
override val dependencies: List<ExternalProjectDependency>,
|
||||
) : ExternalProject {
|
||||
override val sourceRoots: List<Path>
|
||||
get() = listOfNotNull((root / "src").takeIf { it.isDirectory() })
|
||||
|
||||
// Poetry projects don't have any declarative hierarchical structure
|
||||
override val fullName: String?
|
||||
get() = name
|
||||
|
||||
@@ -22,6 +22,7 @@ interface ExternalProject {
|
||||
val name: String
|
||||
val root: Path
|
||||
val dependencies: List<ExternalProjectDependency>
|
||||
val sourceRoots: List<Path>
|
||||
|
||||
/**
|
||||
* The colon separated fully qualified name of the project in the form `root:subproject:subsubproject`
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.nio.file.FileVisitResult
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.PathMatcher
|
||||
import kotlin.io.path.*
|
||||
import kotlin.io.path.isDirectory
|
||||
|
||||
private const val DEFAULT_VENV_DIR = ".venv"
|
||||
|
||||
@@ -22,7 +23,10 @@ data class UvProject(
|
||||
override val fullName: String?,
|
||||
val isWorkspace: Boolean,
|
||||
val parentWorkspace: UvProject?,
|
||||
) : ExternalProject
|
||||
) : ExternalProject {
|
||||
override val sourceRoots: List<Path>
|
||||
get() = listOfNotNull((root / "src").takeIf { it.isDirectory() })
|
||||
}
|
||||
|
||||
private data class UvPyProjectToml(
|
||||
val projectName: String,
|
||||
|
||||
Reference in New Issue
Block a user