Move Gradle tests to idea-gradle module; remove idea dep on idea-gradle
This commit is contained in:
@@ -43,5 +43,6 @@
|
||||
<orderEntry type="module" module-name="uast-kotlin" scope="TEST" />
|
||||
<orderEntry type="module" module-name="kapt3" scope="TEST" />
|
||||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
||||
<orderEntry type="module" module-name="idea-gradle" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -10,5 +10,6 @@
|
||||
<orderEntry type="library" name="idea-full" level="project" />
|
||||
<orderEntry type="module" module-name="idea" scope="PROVIDED" />
|
||||
<orderEntry type="module" module-name="idea-maven" />
|
||||
<orderEntry type="module" module-name="idea-gradle" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -4,6 +4,7 @@
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
||||
+3
-2
@@ -17,6 +17,7 @@
|
||||
package org.jetbrains.kotlin.idea.inspections.gradle
|
||||
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.kotlin.idea.inspections.PluginVersionDependentInspection
|
||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
|
||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
||||
@@ -36,8 +37,8 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.literals
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrCallExpression
|
||||
import java.util.*
|
||||
|
||||
class DifferentKotlinGradleVersionInspection : GradleBaseInspection() {
|
||||
var testVersionMessage: String? = null
|
||||
class DifferentKotlinGradleVersionInspection : GradleBaseInspection(), PluginVersionDependentInspection{
|
||||
override var testVersionMessage: String? = null
|
||||
@TestOnly set
|
||||
|
||||
override fun buildVisitor(): BaseInspectionVisitor = MyVisitor()
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
* Copyright 2010-2017 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.
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2016 JetBrains s.r.o.
|
||||
* Copyright 2010-2017 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.
|
||||
+3
-2
@@ -24,13 +24,14 @@ import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomPlugin
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel
|
||||
import org.jetbrains.idea.maven.project.MavenProjectsManager
|
||||
import org.jetbrains.kotlin.idea.inspections.PluginVersionDependentInspection
|
||||
import org.jetbrains.kotlin.idea.maven.PomFile
|
||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||
|
||||
class DifferentKotlinMavenVersionInspection : DomElementsInspection<MavenDomProjectModel>(MavenDomProjectModel::class.java) {
|
||||
class DifferentKotlinMavenVersionInspection : DomElementsInspection<MavenDomProjectModel>(MavenDomProjectModel::class.java), PluginVersionDependentInspection {
|
||||
private val idePluginVersion by lazy { bundledRuntimeVersion() }
|
||||
|
||||
var testVersionMessage: String? = null
|
||||
override var testVersionMessage: String? = null
|
||||
@TestOnly set
|
||||
|
||||
override fun checkFileElement(domFileElement: DomFileElement<MavenDomProjectModel>?, holder: DomElementAnnotationHolder?) {
|
||||
|
||||
@@ -66,7 +66,6 @@
|
||||
<orderEntry type="module" module-name="frontend.script" />
|
||||
<orderEntry type="module" module-name="backend.jvm" />
|
||||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
||||
<orderEntry type="module" module-name="idea-gradle" />
|
||||
<orderEntry type="module" module-name="sam-with-receiver-cli" scope="TEST" />
|
||||
</component>
|
||||
</module>
|
||||
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2010-2017 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.idea.inspections
|
||||
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
|
||||
interface PluginVersionDependentInspection {
|
||||
var testVersionMessage: String?
|
||||
@TestOnly set
|
||||
}
|
||||
@@ -24,10 +24,6 @@ import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.testFramework.InspectionTestUtil
|
||||
import com.intellij.testFramework.createGlobalContextForTool
|
||||
import com.intellij.util.xml.highlighting.DomElementsInspection
|
||||
import org.jetbrains.kotlin.idea.inspections.gradle.DifferentKotlinGradleVersionInspection
|
||||
import org.jetbrains.kotlin.idea.maven.inspections.DifferentKotlinMavenVersionInspection
|
||||
import org.jetbrains.plugins.gradle.codeInspection.GradleBaseInspection
|
||||
|
||||
fun runInspection(
|
||||
inspection: LocalInspectionTool, project: Project, files: List<VirtualFile>? = null, withTestDir: String? = null
|
||||
@@ -35,11 +31,8 @@ fun runInspection(
|
||||
val wrapper = LocalInspectionToolWrapper(inspection)
|
||||
|
||||
val tool = wrapper.tool
|
||||
if (tool is DomElementsInspection<*> || tool is GradleBaseInspection) {
|
||||
when (tool) {
|
||||
is DifferentKotlinMavenVersionInspection -> tool.testVersionMessage = "\$PLUGIN_VERSION"
|
||||
is DifferentKotlinGradleVersionInspection -> tool.testVersionMessage = "\$PLUGIN_VERSION"
|
||||
}
|
||||
if (tool is PluginVersionDependentInspection) {
|
||||
tool.testVersionMessage = "\$PLUGIN_VERSION"
|
||||
}
|
||||
|
||||
val scope = if (files != null) AnalysisScope(project, files) else AnalysisScope(project)
|
||||
|
||||
Reference in New Issue
Block a user