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,3 +1,3 @@
[INFO] Kotlin Compiler version @snapshot@
[INFO] Kotlin version @snapshot@ (JRE <jre-version>)
[INFO] Compiling Kotlin sources from [/src/main/kotlin]
[INFO] Module name is test-project
@@ -35,7 +35,8 @@ State state = new File(basedir, "build.log").readLines().collect { it.replaceAll
replaceAll(/[0-9]+\s*ms/, "LLL ms").
trim().
replaceAll(/^\[[A-Z]+\]$/, "").
replaceAll(/version [0-9a-z-+\.]+/, "version @snapshot@")
replaceAll(/version [0-9a-z-+\.]+/, "version @snapshot@").
replaceAll(/\(JRE .+\)/, "(JRE <jre-version>)")
if (filtered != "") {
acc.lines << filtered
@@ -198,8 +198,8 @@ public abstract class KotlinCompileMojoBase<A extends CommonCompilerArguments> e
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
getLog().info("Kotlin Compiler version " + KotlinCompilerVersion.VERSION);
getLog().info("Kotlin version " + KotlinCompilerVersion.VERSION +
" (JRE " + System.getProperty("java.runtime.version") + ")");
if (!hasKotlinFilesInSources()) {
getLog().warn("No sources found skipping Kotlin compile");