Merge branch 'master' of github.com:JetBrains/kotlin
This commit is contained in:
@@ -16,7 +16,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>runtime</artifactId>
|
<artifactId>kotlin-runtime</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>runtime</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
|
||||||
<artifactId>stdlib</artifactId>
|
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -11,12 +11,12 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>runtime</artifactId>
|
<artifactId>kotlin-runtime</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>stdlib</artifactId>
|
<artifactId>kotlin-stdlib</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains.kotlin</groupId>
|
<groupId>org.jetbrains.kotlin</groupId>
|
||||||
<artifactId>runtime</artifactId>
|
<artifactId>kotlin-runtime</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -156,11 +156,6 @@
|
|||||||
<goal>shade</goal>
|
<goal>shade</goal>
|
||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!--
|
|
||||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
|
||||||
<keepDependenciesWithProvidedScope>true</keepDependenciesWithProvidedScope>
|
|
||||||
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
|
|
||||||
-->
|
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>org.jetbrains.kotlin:*</include>
|
<include>org.jetbrains.kotlin:*</include>
|
||||||
|
|||||||
+49
-4
@@ -28,6 +28,7 @@ import org.jetbrains.jet.cli.KotlinCompiler;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -109,6 +110,8 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
|||||||
|
|
||||||
final KotlinCompiler compiler = createCompiler();
|
final KotlinCompiler compiler = createCompiler();
|
||||||
|
|
||||||
|
printCompilerArgumentsIfDebugEnabled(arguments, compiler);
|
||||||
|
|
||||||
final KotlinCompiler.ExitCode exitCode = compiler.exec(System.err, arguments);
|
final KotlinCompiler.ExitCode exitCode = compiler.exec(System.err, arguments);
|
||||||
|
|
||||||
switch (exitCode) {
|
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() {
|
protected KotlinCompiler createCompiler() {
|
||||||
return new KotlinCompiler();
|
return new KotlinCompiler();
|
||||||
}
|
}
|
||||||
@@ -157,12 +179,20 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
|||||||
final ArrayList<String> classpathList = new ArrayList<String>(classpath);
|
final ArrayList<String> classpathList = new ArrayList<String>(classpath);
|
||||||
|
|
||||||
if (classpathList.remove(output)) {
|
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);
|
// final String runtime = getRuntimeFromClassPath(classpath);
|
||||||
log.info("Classpath: " + classPathString);
|
// if (runtime != null) {
|
||||||
arguments.setClasspath(classPathString);
|
// 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);
|
log.info("Classes directory is " + output);
|
||||||
arguments.setOutputDir(output);
|
arguments.setOutputDir(output);
|
||||||
@@ -171,6 +201,21 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
|||||||
log.debug("Using jdk headers from " + arguments.jdkHeaders);
|
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;
|
private File jdkHeadersPath;
|
||||||
|
|
||||||
protected File getJdkHeaders() {
|
protected File getJdkHeaders() {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>runtime</artifactId>
|
<artifactId>kotlin-runtime</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
Reference in New Issue
Block a user