Add impl module roots also when gradle-aware make is enabled

This commit is contained in:
Dmitry Jemerov
2017-09-08 15:42:31 +02:00
parent 0caadcd2f1
commit cd44131f88
@@ -108,22 +108,23 @@ class MultiplatformGradleOrderEnumeratorHandler : OrderEnumerationHandler() {
override fun addCustomModuleRoots(type: OrderRootType, rootModel: ModuleRootModel, result: MutableCollection<String>, includeProduction: Boolean, includeTests: Boolean): Boolean {
if (type != OrderRootType.CLASSES) return false
if (!ExternalSystemApiUtil.isExternalSystemAwareModule(GradleConstants.SYSTEM_ID, rootModel.module)) return false
if (GradleSystemRunningSettings.getInstance().isUseGradleAwareMake) return false
val gradleProjectPath = ExternalSystemModulePropertyManager.getInstance(rootModel.module).getRootProjectPath() ?: return false
val externalProjectDataCache = ExternalProjectDataCache.getInstance(rootModel.module.project)!!
val externalRootProject = externalProjectDataCache.getRootExternalProject(GradleConstants.SYSTEM_ID,
File(gradleProjectPath)) ?: return false
if (!GradleSystemRunningSettings.getInstance().isUseGradleAwareMake) {
val gradleProjectPath = ExternalSystemModulePropertyManager.getInstance(rootModel.module).getRootProjectPath() ?: return false
val externalProjectDataCache = ExternalProjectDataCache.getInstance(rootModel.module.project)!!
val externalRootProject = externalProjectDataCache.getRootExternalProject(GradleConstants.SYSTEM_ID,
File(gradleProjectPath)) ?: return false
val externalSourceSets = externalProjectDataCache.findExternalProject(externalRootProject, rootModel.module)
if (externalSourceSets.isEmpty()) return false
val externalSourceSets = externalProjectDataCache.findExternalProject(externalRootProject, rootModel.module)
if (externalSourceSets.isEmpty()) return false
for (sourceSet in externalSourceSets.values) {
if (includeTests) {
addOutputModuleRoots(sourceSet.sources[ExternalSystemSourceType.TEST], result)
}
if (includeProduction) {
addOutputModuleRoots(sourceSet.sources[ExternalSystemSourceType.SOURCE], result)
for (sourceSet in externalSourceSets.values) {
if (includeTests) {
addOutputModuleRoots(sourceSet.sources[ExternalSystemSourceType.TEST], result)
}
if (includeProduction) {
addOutputModuleRoots(sourceSet.sources[ExternalSystemSourceType.SOURCE], result)
}
}
}