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="uast-kotlin" scope="TEST" />
|
||||||
<orderEntry type="module" module-name="kapt3" scope="TEST" />
|
<orderEntry type="module" module-name="kapt3" scope="TEST" />
|
||||||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
||||||
|
<orderEntry type="module" module-name="idea-gradle" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -10,5 +10,6 @@
|
|||||||
<orderEntry type="library" name="idea-full" level="project" />
|
<orderEntry type="library" name="idea-full" level="project" />
|
||||||
<orderEntry type="module" module-name="idea" scope="PROVIDED" />
|
<orderEntry type="module" module-name="idea" scope="PROVIDED" />
|
||||||
<orderEntry type="module" module-name="idea-maven" />
|
<orderEntry type="module" module-name="idea-maven" />
|
||||||
|
<orderEntry type="module" module-name="idea-gradle" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/tests" isTestSource="true" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
|||||||
+3
-2
@@ -17,6 +17,7 @@
|
|||||||
package org.jetbrains.kotlin.idea.inspections.gradle
|
package org.jetbrains.kotlin.idea.inspections.gradle
|
||||||
|
|
||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
|
import org.jetbrains.kotlin.idea.inspections.PluginVersionDependentInspection
|
||||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
|
import org.jetbrains.kotlin.psi.psiUtil.getChildrenOfType
|
||||||
import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
|
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 org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.path.GrCallExpression
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class DifferentKotlinGradleVersionInspection : GradleBaseInspection() {
|
class DifferentKotlinGradleVersionInspection : GradleBaseInspection(), PluginVersionDependentInspection{
|
||||||
var testVersionMessage: String? = null
|
override var testVersionMessage: String? = null
|
||||||
@TestOnly set
|
@TestOnly set
|
||||||
|
|
||||||
override fun buildVisitor(): BaseInspectionVisitor = MyVisitor()
|
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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with 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.MavenDomPlugin
|
||||||
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel
|
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel
|
||||||
import org.jetbrains.idea.maven.project.MavenProjectsManager
|
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.maven.PomFile
|
||||||
import org.jetbrains.kotlin.idea.versions.bundledRuntimeVersion
|
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() }
|
private val idePluginVersion by lazy { bundledRuntimeVersion() }
|
||||||
|
|
||||||
var testVersionMessage: String? = null
|
override var testVersionMessage: String? = null
|
||||||
@TestOnly set
|
@TestOnly set
|
||||||
|
|
||||||
override fun checkFileElement(domFileElement: DomFileElement<MavenDomProjectModel>?, holder: DomElementAnnotationHolder?) {
|
override fun checkFileElement(domFileElement: DomFileElement<MavenDomProjectModel>?, holder: DomElementAnnotationHolder?) {
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
<orderEntry type="module" module-name="frontend.script" />
|
<orderEntry type="module" module-name="frontend.script" />
|
||||||
<orderEntry type="module" module-name="backend.jvm" />
|
<orderEntry type="module" module-name="backend.jvm" />
|
||||||
<orderEntry type="library" name="kotlin-reflect" level="project" />
|
<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" />
|
<orderEntry type="module" module-name="sam-with-receiver-cli" scope="TEST" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</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.openapi.vfs.VirtualFile
|
||||||
import com.intellij.testFramework.InspectionTestUtil
|
import com.intellij.testFramework.InspectionTestUtil
|
||||||
import com.intellij.testFramework.createGlobalContextForTool
|
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(
|
fun runInspection(
|
||||||
inspection: LocalInspectionTool, project: Project, files: List<VirtualFile>? = null, withTestDir: String? = null
|
inspection: LocalInspectionTool, project: Project, files: List<VirtualFile>? = null, withTestDir: String? = null
|
||||||
@@ -35,11 +31,8 @@ fun runInspection(
|
|||||||
val wrapper = LocalInspectionToolWrapper(inspection)
|
val wrapper = LocalInspectionToolWrapper(inspection)
|
||||||
|
|
||||||
val tool = wrapper.tool
|
val tool = wrapper.tool
|
||||||
if (tool is DomElementsInspection<*> || tool is GradleBaseInspection) {
|
if (tool is PluginVersionDependentInspection) {
|
||||||
when (tool) {
|
tool.testVersionMessage = "\$PLUGIN_VERSION"
|
||||||
is DifferentKotlinMavenVersionInspection -> tool.testVersionMessage = "\$PLUGIN_VERSION"
|
|
||||||
is DifferentKotlinGradleVersionInspection -> tool.testVersionMessage = "\$PLUGIN_VERSION"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val scope = if (files != null) AnalysisScope(project, files) else AnalysisScope(project)
|
val scope = if (files != null) AnalysisScope(project, files) else AnalysisScope(project)
|
||||||
|
|||||||
Reference in New Issue
Block a user