Don't force configure with kotlin-jdk artifacts for early versions (KT-21028)
#KT-21028 Fixed
This commit is contained in:
+6
@@ -50,6 +50,12 @@ public class GradleConfigureProjectByChangingFileTestGenerated extends AbstractG
|
||||
doTestGradle(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jreLib")
|
||||
public void testJreLib() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/configuration/gradle/jreLib/");
|
||||
doTestGradle(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("js")
|
||||
public void testJs() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/testData/configuration/gradle/js/");
|
||||
|
||||
+6
@@ -44,6 +44,12 @@ public class MavenConfigureProjectByChangingFileTestGenerated extends AbstractMa
|
||||
doTestWithMaven(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("jreLib")
|
||||
public void testJreLib() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-maven/testData/configurator/jvm/jreLib/");
|
||||
doTestWithMaven(fileName);
|
||||
}
|
||||
|
||||
@TestMetadata("libraryMissed")
|
||||
public void testLibraryMissed() throws Exception {
|
||||
String fileName = KotlinTestUtils.navigationMetadata("idea/idea-maven/testData/configurator/jvm/libraryMissed/");
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>maventest</groupId>
|
||||
<artifactId>maventest</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
<!--
|
||||
// VERSION: 1.1.60
|
||||
-->
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>maventest</groupId>
|
||||
<artifactId>maventest</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
<properties>
|
||||
<kotlin.version>$VERSION$</kotlin.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-stdlib-jre8</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-test</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory></sourceDirectory>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>kotlin-maven-plugin</artifactId>
|
||||
<version>${kotlin.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>test-compile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<jvmTarget>1.8</jvmTarget>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
<!--
|
||||
// VERSION: $VERSION$
|
||||
-->
|
||||
@@ -315,10 +315,13 @@ fun getStdlibArtifactId(sdk: Sdk?, version: String): String {
|
||||
return MAVEN_STDLIB_ID
|
||||
}
|
||||
|
||||
val areSDKArtifactsAvailable = VersionComparatorUtil.COMPARATOR.compare("1.2.0-rc-39", version) >= 0
|
||||
val sdkVersion = sdk?.version
|
||||
return when {
|
||||
sdkVersion != null && sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_8) -> MAVEN_STDLIB_ID_JDK8
|
||||
sdkVersion == JavaSdkVersion.JDK_1_7 -> MAVEN_STDLIB_ID_JDK7
|
||||
sdkVersion != null && sdkVersion.isAtLeast(JavaSdkVersion.JDK_1_8) ->
|
||||
if (areSDKArtifactsAvailable) MAVEN_STDLIB_ID_JDK8 else MAVEN_STDLIB_ID_JDK7
|
||||
sdkVersion == JavaSdkVersion.JDK_1_7 ->
|
||||
if (areSDKArtifactsAvailable) MAVEN_STDLIB_ID_JDK7 else MAVEN_STDLIB_ID_JRE7
|
||||
else -> MAVEN_STDLIB_ID
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// VERSION: $VERSION$
|
||||
buildscript {
|
||||
ext.kotlin_version = '$VERSION$'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
}
|
||||
}
|
||||
apply plugin: 'kotlin'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
|
||||
}
|
||||
compileKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
compileTestKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
// JDK: 1.8
|
||||
@@ -0,0 +1,2 @@
|
||||
// VERSION: 1.1.60
|
||||
// JDK: 1.8
|
||||
@@ -36,7 +36,7 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
testCompile("junit:junit:4.12")
|
||||
compile(kotlinModule("stdlib-jdk8", kotlin_version))
|
||||
compile(kotlinModule("stdlib-jre8", kotlin_version))
|
||||
}
|
||||
|
||||
// VERSION: $VERSION$
|
||||
|
||||
Reference in New Issue
Block a user