in src/com/intellij/idea/plugin/hybris/project/factories/ModuleDescriptorFactory.kt [41:127]
fun createDescriptor(file: File, rootProjectDescriptor: HybrisProjectDescriptor): ModuleDescriptor {
val hybrisProjectService = ApplicationManager.getApplication().getService(HybrisProjectService::class.java)
val resolvedFile = try {
file.canonicalFile
} catch (e: IOException) {
throw HybrisConfigurationException(e)
}
validateModuleDirectory(resolvedFile)
val originalPath = file.absolutePath
val newPath = resolvedFile.absolutePath
val path = if (originalPath != newPath) {
"$originalPath($newPath)"
} else {
originalPath
}
return when {
hybrisProjectService.isConfigModule(resolvedFile) -> {
LOG.info("Creating Config module for $path")
ConfigModuleDescriptor(resolvedFile, rootProjectDescriptor)
}
hybrisProjectService.isCCv2Module(resolvedFile) -> {
LOG.info("Creating CCv2 module for $path")
CCv2ModuleDescriptor(resolvedFile, rootProjectDescriptor)
}
hybrisProjectService.isPlatformModule(resolvedFile) -> {
LOG.info("Creating Platform module for $path")
PlatformModuleDescriptor(resolvedFile, rootProjectDescriptor)
}
hybrisProjectService.isCoreExtModule(resolvedFile) -> {
LOG.info("Creating Core EXT module for $path")
YCoreExtModuleDescriptor(resolvedFile, rootProjectDescriptor, getExtensionInfo(resolvedFile))
}
hybrisProjectService.isPlatformExtModule(resolvedFile) -> {
LOG.info("Creating Platform EXT module for $path")
with(YPlatformExtModuleDescriptor(resolvedFile, rootProjectDescriptor, getExtensionInfo(resolvedFile))) {
SubModuleDescriptorFactory.buildAll(this)
.forEach { this.addSubModule(it) }
this
}
}
hybrisProjectService.isOutOfTheBoxModule(resolvedFile, rootProjectDescriptor) -> {
LOG.info("Creating OOTB module for $path")
with(YOotbRegularModuleDescriptor(resolvedFile, rootProjectDescriptor, getExtensionInfo(resolvedFile))) {
SubModuleDescriptorFactory.buildAll(this)
.forEach { this.addSubModule(it) }
this
}
}
hybrisProjectService.isHybrisModule(resolvedFile) -> {
LOG.info("Creating Custom hybris module for $path")
with(YCustomRegularModuleDescriptor(resolvedFile, rootProjectDescriptor, getExtensionInfo(resolvedFile))) {
SubModuleDescriptorFactory.buildAll(this)
.forEach { this.addSubModule(it) }
this
}
}
hybrisProjectService.isGradleModule(resolvedFile) -> {
LOG.info("Creating gradle module for $path")
GradleModuleDescriptor(resolvedFile, rootProjectDescriptor)
}
hybrisProjectService.isGradleKtsModule(resolvedFile) -> {
LOG.info("Creating gradle kts module for $path")
GradleKtsModuleDescriptor(resolvedFile, rootProjectDescriptor)
}
hybrisProjectService.isMavenModule(resolvedFile) -> {
LOG.info("Creating maven module for $path")
MavenModuleDescriptor(resolvedFile, rootProjectDescriptor)
}
else -> {
LOG.info("Creating eclipse module for $path")
EclipseModuleDescriptor(resolvedFile, rootProjectDescriptor, getEclipseModuleDescriptorName(resolvedFile))
}
}
}