[Maven] Add tests for K2

#KT-56903 Fixed

Co-authored-by: Ilya Gorbunov <Ilya.Gorbunov@jetbrains.com>

Merge-request: KT-MR-8922
Merged-by: Aleksei Cherepanov <aleksei.cherepanov@jetbrains.com>
This commit is contained in:
Aleksei.Cherepanov
2023-02-23 11:24:20 +00:00
committed by Space Team
parent b306ed53aa
commit 25b6eb3114
3 changed files with 62 additions and 13 deletions
@@ -186,6 +186,43 @@
<goal>run</goal>
</goals>
</execution>
<execution>
<id>integration-test-k2</id>
<configuration>
<projectsDirectory>src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it-k2</cloneProjectsTo>
<pomExcludes>
<!-- exclude kapt -->
<pomExclude>test-dagger-maven-example/pom.xml</pomExclude>
<pomExclude>test-enable-extensions-kapt-allopen/pom.xml</pomExclude>
<pomExclude>test-kapt-generateKotlinCode/pom.xml</pomExclude>
<pomExclude>test-enable-extensions/pom.xml</pomExclude>
<pomExclude>test-kapt-allopen/pom.xml</pomExclude>
<pomExclude>test-lombok-with-kapt/pom.xml</pomExclude>
<!-- exclude js and mpp -->
<pomExclude>test-js-moduleKind/pom.xml</pomExclude>
<pomExclude>test-js-accessToInternal/pom.xml</pomExclude>
<pomExclude>test-js-suppressWarnings/pom.xml</pomExclude>
<pomExclude>test-js-sourceMap/pom.xml</pomExclude>
<pomExclude>test-js-extraArguments/pom.xml</pomExclude>
<pomExclude>test-js-sourceMapEmbedSources/pom.xml</pomExclude>
<pomExclude>test-multiplatform/pom.xml</pomExclude>
<!-- exclude kts -->
<pomExclude>test-helloworld-kts/pom.xml</pomExclude>
<!-- exclude test, that depends on lv as they will be automatically fixed, when current lv goes to 2.0 -->
<pomExclude>test-languageVersion/pom.xml</pomExclude>
<pomExclude>test-apiVersion/pom.xml</pomExclude>
</pomExcludes>
<properties>
<kotlin.compiler.languageVersion>2.0</kotlin.compiler.languageVersion>
</properties>
</configuration>
<!--<phase>package</phase>-->
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
@@ -2,4 +2,15 @@ source(new File(basedir, "../../../verify-common.bsh").getAbsolutePath());
assertBuildLogHasLine("[INFO] BUILD FAILURE");
assertBuildLogHasNoLineThatContains("AutoCloseable");
assertBuildLogHasLineThatContains("Unresolved reference: stream");
int line1 = findBuildLogLineThatContains("Unresolved reference: stream");
int line2 = findBuildLogLineThatContains("Unresolved reference: java.util.stream.Stream");
if (line1 >= 0) {
print("Expected content \"Unresolved reference: stream\" was found at line " + (line1+1) + " of build log: \"" + buildLog[line1] + "\"");
} else if (line2 >= 0) {
print("Expected content \"Unresolved reference: java.util.stream.Stream\" was found at line " + (line2+1) + " of build log: \"" + buildLog[line2] + "\"");
} else {
throw new Exception("Expected build log to contain: \"Unresolved reference: stream\" or \"Unresolved reference: java.util.stream.Stream\"");
}
@@ -26,20 +26,21 @@ State state = buildLogFile.readLines().collect { it.replaceAll("\\u001b[^m]*m",
def m = pattern.matcher(line)
if (m.find()) {
acc.currentPlugin = m.group(1)
} else if (line.startsWith("[INFO] Downloaded") ||
line.startsWith("[INFO] Downloading") ||
line.startsWith("Downloaded") ||
line.startsWith("Downloading") ||
line.startsWith("[INFO] PERF:")) {
} else if (line.startsWith("[INFO] Downloaded")
|| line.startsWith("[INFO] Downloading")
|| line.startsWith("Downloaded")
|| line.startsWith("Downloading")
|| line.startsWith("[WARNING] Language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features")
|| line.startsWith("[INFO] PERF:")) {
// ignore line
} else if (acc.currentPlugin == "kotlin-maven-plugin") {
def filtered = removePaths(line, basedir).
replace("\\", "/").
replaceAll(/[0-9]+\s*ms/, "LLL ms").
trim().
replaceAll(/^\[[A-Z]+\]$/, "").
replace(kotlinVersion, "@snapshot@").
replaceAll(/\(JRE .+\)/, "(JRE <jre-version>)")
def filtered = removePaths(line, basedir)
.replace("\\", "/")
.replaceAll(/[0-9]+\s*ms/, "LLL ms")
.trim()
.replaceAll(/^\[[A-Z]+\]$/, "")
.replace(kotlinVersion, "@snapshot@")
.replaceAll(/\(JRE .+\)/, "(JRE <jre-version>)")
if (filtered != "") {
acc.lines << filtered