Add inspection that warns if Gradle plugin version differs from the one in IDE (KT-12730)

#KT-12730 Fixed
This commit is contained in:
Nikolay Krasko
2016-07-05 21:09:23 +03:00
parent 7a9af072b4
commit 620ddcd63a
18 changed files with 423 additions and 24 deletions
@@ -0,0 +1,30 @@
group 'OnlyGradleTest'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '0.0.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = 1.5
repositories {
mavenCentral()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'org.codehaus.groovy:groovy-all:2.3.+'
testCompile group: 'junit', name: 'junit', version: '4.11'
}
@@ -0,0 +1,55 @@
<problems>
<problem>
<file>wrongPluginVersionWithNumber.gradle</file>
<line>6</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="wrongPluginVersionWithNumber.gradle" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin Gradle and IDE plugins versions are different</problem_class>
<description>Kotlin version that is used for building with Gradle (0.0.1) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION)</description>
</problem>
<problem>
<file>wrongPluginVersionWithStandardKotlinVariable.gradle</file>
<line>9</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="wrongPluginVersionWithStandardKotlinVariable.gradle" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin Gradle and IDE plugins versions are different</problem_class>
<description>Kotlin version that is used for building with Gradle (0.0.1) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION)</description>
</problem>
<problem>
<file>fullHelloWorldConfiguration.gradle</file>
<line>11</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="fullHelloWorldConfiguration.gradle" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin Gradle and IDE plugins versions are different</problem_class>
<description>Kotlin version that is used for building with Gradle (0.0.1) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION)</description>
</problem>
<problem>
<file>wrongPluginVersionWithSomeVariable.gradle</file>
<line>9</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="wrongPluginVersionWithSomeVariable.gradle" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin Gradle and IDE plugins versions are different</problem_class>
<description>Kotlin version that is used for building with Gradle (0.0.1) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION)</description>
</problem>
<problem>
<file>wrongPluginVersionWithSomeVariableInDef.gradle</file>
<line>9</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="wrongPluginVersionWithSomeVariableInDef.gradle" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin Gradle and IDE plugins versions are different</problem_class>
<description>Kotlin version that is used for building with Gradle (0.0.1) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION)</description>
</problem>
<problem>
<file>wrongPluginVersionWithVariableAndFullInterpolation.gradle</file>
<line>9</line>
<module>light_idea_test_case</module>
<entry_point TYPE="file" FQNAME="wrongPluginVersionWithVariableAndFullInterpolation.gradle" />
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Kotlin Gradle and IDE plugins versions are different</problem_class>
<description>Kotlin version that is used for building with Gradle (0.0.1) differs from the one bundled into the IDE plugin ($PLUGIN_VERSION)</description>
</problem>
</problems>
@@ -0,0 +1 @@
// INSPECTION_CLASS: org.jetbrains.kotlin.idea.inspections.gradle.DifferentKotlinGradleVersionInspection
@@ -0,0 +1,11 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$PLUGIN_VERSION"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -0,0 +1,17 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:something-kotlin-gradle-plugin:0.0.1"
classpath "someone:kotlin-gradle-plugin:0.0.1"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1" // Bad position for plugin
classpath "someone:kotlin-gradle-plugin:0.0.1"
}
@@ -0,0 +1,11 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -0,0 +1,12 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
//noinspection DifferentKotlinGradleVersion
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -0,0 +1,11 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:0.0.1"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -0,0 +1,14 @@
buildscript {
ext.some = '0.0.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$some"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -0,0 +1,14 @@
buildscript {
def defVar = '0.0.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$defVar"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -0,0 +1,14 @@
buildscript {
ext.kotlin_version = '0.0.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
@@ -0,0 +1,14 @@
buildscript {
ext.t = '0.0.1'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${t}"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'