Merge branch 'master' of github.com:JetBrains/kotlin
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>runtime</artifactId>
|
||||
<artifactId>kotlin-runtime</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -16,13 +16,7 @@
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>runtime</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -11,12 +11,12 @@
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>runtime</artifactId>
|
||||
<artifactId>kotlin-runtime</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>stdlib</artifactId>
|
||||
<artifactId>kotlin-stdlib</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>runtime</artifactId>
|
||||
<artifactId>kotlin-runtime</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -156,11 +156,6 @@
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!--
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
|
||||
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
|
||||
-->
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<include>org.jetbrains.kotlin:*</include>
|
||||
|
||||
+49
-4
@@ -28,6 +28,7 @@ import org.jetbrains.jet.cli.KotlinCompiler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -109,6 +110,8 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
||||
|
||||
final KotlinCompiler compiler = createCompiler();
|
||||
|
||||
printCompilerArgumentsIfDebugEnabled(arguments, compiler);
|
||||
|
||||
final KotlinCompiler.ExitCode exitCode = compiler.exec(System.err, arguments);
|
||||
|
||||
switch (exitCode) {
|
||||
@@ -120,6 +123,25 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
||||
}
|
||||
}
|
||||
|
||||
private void printCompilerArgumentsIfDebugEnabled(CompilerArguments arguments, KotlinCompiler compiler) {
|
||||
if (getLog().isDebugEnabled()) {
|
||||
getLog().debug("Invoking compiler " + compiler + " with arguments:");
|
||||
try {
|
||||
Field[] fields = arguments.getClass().getFields();
|
||||
for (Field f : fields) {
|
||||
Object value = f.get(arguments);
|
||||
if (value != null) {
|
||||
getLog().debug(f.getName() + "=" + value);
|
||||
}
|
||||
}
|
||||
getLog().debug("End of arguments");
|
||||
}
|
||||
catch (Exception e) {
|
||||
getLog().warn("Failed to print compiler arguments: " + e, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected KotlinCompiler createCompiler() {
|
||||
return new KotlinCompiler();
|
||||
}
|
||||
@@ -157,12 +179,20 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
||||
final ArrayList<String> classpathList = new ArrayList<String>(classpath);
|
||||
|
||||
if (classpathList.remove(output)) {
|
||||
log.debug("Removed target directory from classpath (" + output + ")");
|
||||
log.debug("Removed target directory from compiler classpath (" + output + ")");
|
||||
}
|
||||
|
||||
final String classPathString = Joiner.on(File.pathSeparator).join(classpathList);
|
||||
log.info("Classpath: " + classPathString);
|
||||
arguments.setClasspath(classPathString);
|
||||
// final String runtime = getRuntimeFromClassPath(classpath);
|
||||
// if (runtime != null) {
|
||||
// log.debug("Removed Kotlin runtime from compiler classpath (" + runtime + ")");
|
||||
// classpathList.remove(runtime);
|
||||
// }
|
||||
|
||||
if (classpathList.size() > 0) {
|
||||
final String classPathString = Joiner.on(File.pathSeparator).join(classpathList);
|
||||
log.info("Classpath: " + classPathString);
|
||||
arguments.setClasspath(classPathString);
|
||||
}
|
||||
|
||||
log.info("Classes directory is " + output);
|
||||
arguments.setOutputDir(output);
|
||||
@@ -171,6 +201,21 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
||||
log.debug("Using jdk headers from " + arguments.jdkHeaders);
|
||||
}
|
||||
|
||||
// TODO: Make a better runtime detection or get rid of it entirely
|
||||
private String getRuntimeFromClassPath(List<String> classpath) {
|
||||
for (String item : classpath) {
|
||||
final int lastSeparatorIndex = item.lastIndexOf(File.separator);
|
||||
|
||||
if (lastSeparatorIndex < 0)
|
||||
continue;
|
||||
|
||||
if (item.startsWith("kotlin-runtime-", lastSeparatorIndex + 1) && item.endsWith(".jar"))
|
||||
return item;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private File jdkHeadersPath;
|
||||
|
||||
protected File getJdkHeaders() {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>runtime</artifactId>
|
||||
<artifactId>kotlin-runtime</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<build>
|
||||
|
||||
Reference in New Issue
Block a user