Extension point for detecting build system type used in project

Now we use a non-deprecated way to detect Maven modules
This commit is contained in:
Dmitry Jemerov
2018-01-03 14:52:41 +01:00
parent 0ca2117ac7
commit 685d38218d
24 changed files with 151 additions and 325 deletions
@@ -0,0 +1,22 @@
/*
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.maven
import com.intellij.openapi.module.Module
import org.jetbrains.idea.maven.project.MavenProjectsManager
import org.jetbrains.kotlin.idea.configuration.BuildSystemType
import org.jetbrains.kotlin.idea.configuration.BuildSystemTypeDetector
object Maven : BuildSystemType()
class MavenDetector : BuildSystemTypeDetector {
override fun detectBuildSystemType(module: Module): BuildSystemType? {
return if (MavenProjectsManager.getInstance(module.project).isMavenizedModule(module))
Maven
else
null
}
}
@@ -1,17 +1,6 @@
/*
* Copyright 2010-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea.maven.configuration
@@ -43,7 +32,6 @@ import org.jetbrains.idea.maven.utils.MavenArtifactScope
import org.jetbrains.kotlin.config.ApiVersion
import org.jetbrains.kotlin.config.CoroutineSupport
import org.jetbrains.kotlin.config.LanguageFeature
import org.jetbrains.kotlin.idea.KotlinPluginUtil
import org.jetbrains.kotlin.idea.configuration.*
import org.jetbrains.kotlin.idea.facet.getRuntimeLibraryVersion
import org.jetbrains.kotlin.idea.framework.ui.ConfigureDialogWithModulesAndVersion
@@ -60,7 +48,7 @@ abstract class KotlinMavenConfigurator
override fun getStatus(moduleSourceRootGroup: ModuleSourceRootGroup): ConfigureKotlinStatus {
val module = moduleSourceRootGroup.baseModule
if (!KotlinPluginUtil.isMavenModule(module))
if (module.getBuildSystemType() != Maven)
return ConfigureKotlinStatus.NON_APPLICABLE
val psi = runReadAction { findModulePomFile(module) }