Change how kotlinc and tools display their version

- Display the Kotlin version in kotlin-gradle-plugin. This is needed
  because if "-version" is specified in compiler arguments, the "info"
  level of the message printed by the compiler in CLICompiler prevents
  it from being displayed by default (unless "--debug" is passed to
  Gradle).
- Display the version of JRE the compiler is running on. This will be
  helpful to diagnose Java 9 related issues in the future.
- In CLI, also display the executable name (kotlinc-jvm or kotlinc-js)
This commit is contained in:
Alexander Udalov
2017-04-06 18:29:48 +03:00
parent bb01ca038a
commit fcf44af294
26 changed files with 63 additions and 67 deletions
@@ -1,11 +1,11 @@
[INFO] Kotlin Compiler version @snapshot@
[INFO] Kotlin version @snapshot@ (JRE <jre-version>)
[INFO] Compiling Kotlin sources from [/test-extension/src/main/kotlin]
[INFO] Module name is test-extension
[WARNING] Some JAR files in the classpath have the Kotlin Runtime library bundled into them. This may cause difficult to debug problems if there's a different version of the Kotlin Runtime library in the classpath. Consider removing these libraries from the classpath or use '-Xskip-runtime-version-check' to suppress this warning
[WARNING] /local-repo/org/jetbrains/kotlin/kotlin-compiler/@snapshot@/kotlin-compiler-@snapshot@.jar: (-1, -1) Library has Kotlin runtime bundled into it
[INFO] Kotlin Compiler version @snapshot@
[INFO] Kotlin version @snapshot@ (JRE <jre-version>)
[WARNING] No sources found skipping Kotlin compile
[INFO] Kotlin Compiler version @snapshot@
[INFO] Kotlin version @snapshot@ (JRE <jre-version>)
[INFO] Compiling Kotlin sources from [/use-test-extension/src/main/kotlin]
[INFO] Module name is use-test-extension
[INFO] Applicability test for project use-test-extension
@@ -13,5 +13,5 @@
[INFO] Configuring test plugin with arguments
[INFO] Plugin applied
[INFO] Option value: my-special-value
[INFO] Kotlin Compiler version @snapshot@
[WARNING] No sources found skipping Kotlin compile
[INFO] Kotlin version @snapshot@ (JRE <jre-version>)
[WARNING] No sources found skipping Kotlin compile
@@ -1,5 +1,5 @@
/**
* NOTE: if this script returns false, the build log with more information can be found at tools/kotlin-maven-plugin/target/it/plugins/build.log
* NOTE: if this script returns false, the build log with more information can be found at tools/kotlin-maven-plugin-test/target/it/plugins/build.log
*/
import java.util.regex.Pattern
@@ -38,7 +38,8 @@ State state = buildLogFile.readLines().collect { it.replaceAll("\\u001b[^m]*m",
replaceAll(/[0-9]+\s*ms/, "LLL ms").
trim().
replaceAll(/^\[[A-Z]+\]$/, "").
replace(kotlinVersion, "@snapshot@")
replace(kotlinVersion, "@snapshot@").
replaceAll(/\(JRE .+\)/, "(JRE <jre-version>)")
if (filtered != "") {
acc.lines << filtered