From 25b6eb311446832ab8f2875beff45fcb23d7a1ac Mon Sep 17 00:00:00 2001 From: "Aleksei.Cherepanov" Date: Thu, 23 Feb 2023 11:24:20 +0000 Subject: [PATCH] [Maven] Add tests for K2 #KT-56903 Fixed Co-authored-by: Ilya Gorbunov Merge-request: KT-MR-8922 Merged-by: Aleksei Cherepanov --- .../tools/kotlin-maven-plugin-test/pom.xml | 37 +++++++++++++++++++ .../src/it/test-customJdk/verify.bsh | 13 ++++++- .../src/it/test-plugins/verify.groovy | 25 +++++++------ 3 files changed, 62 insertions(+), 13 deletions(-) diff --git a/libraries/tools/kotlin-maven-plugin-test/pom.xml b/libraries/tools/kotlin-maven-plugin-test/pom.xml index f3b8cbb818f..e32e710b41b 100644 --- a/libraries/tools/kotlin-maven-plugin-test/pom.xml +++ b/libraries/tools/kotlin-maven-plugin-test/pom.xml @@ -186,6 +186,43 @@ run + + integration-test-k2 + + src/it + ${project.build.directory}/it-k2 + + + test-dagger-maven-example/pom.xml + test-enable-extensions-kapt-allopen/pom.xml + test-kapt-generateKotlinCode/pom.xml + test-enable-extensions/pom.xml + test-kapt-allopen/pom.xml + test-lombok-with-kapt/pom.xml + + test-js-moduleKind/pom.xml + test-js-accessToInternal/pom.xml + test-js-suppressWarnings/pom.xml + test-js-sourceMap/pom.xml + test-js-extraArguments/pom.xml + test-js-sourceMapEmbedSources/pom.xml + test-multiplatform/pom.xml + + test-helloworld-kts/pom.xml + + test-languageVersion/pom.xml + test-apiVersion/pom.xml + + + 2.0 + + + + + install + run + + diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-customJdk/verify.bsh b/libraries/tools/kotlin-maven-plugin-test/src/it/test-customJdk/verify.bsh index 147f952b5b4..7b8644903f5 100644 --- a/libraries/tools/kotlin-maven-plugin-test/src/it/test-customJdk/verify.bsh +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-customJdk/verify.bsh @@ -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\""); +} \ No newline at end of file diff --git a/libraries/tools/kotlin-maven-plugin-test/src/it/test-plugins/verify.groovy b/libraries/tools/kotlin-maven-plugin-test/src/it/test-plugins/verify.groovy index 7521a6ba576..ee81e840aed 100644 --- a/libraries/tools/kotlin-maven-plugin-test/src/it/test-plugins/verify.groovy +++ b/libraries/tools/kotlin-maven-plugin-test/src/it/test-plugins/verify.groovy @@ -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 )") + def filtered = removePaths(line, basedir) + .replace("\\", "/") + .replaceAll(/[0-9]+\s*ms/, "LLL ms") + .trim() + .replaceAll(/^\[[A-Z]+\]$/, "") + .replace(kotlinVersion, "@snapshot@") + .replaceAll(/\(JRE .+\)/, "(JRE )") if (filtered != "") { acc.lines << filtered