Merge branch 'master' of github.com:JetBrains/kotlin

This commit is contained in:
James Strachan
2012-04-11 06:25:36 +01:00
13 changed files with 62 additions and 28 deletions
+1 -1
View File
@@ -16,7 +16,7 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>runtime</artifactId>
<artifactId>kotlin-runtime</artifactId>
<version>${project.version}</version>
</dependency>
+1 -1
View File
@@ -20,7 +20,7 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>stdlib</artifactId>
<artifactId>kotlin-stdlib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
+1 -1
View File
@@ -16,7 +16,7 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>stdlib</artifactId>
<artifactId>kotlin-stdlib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -16,7 +16,7 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>stdlib</artifactId>
<artifactId>kotlin-stdlib</artifactId>
<version>${project.version}</version>
</dependency>
+1 -1
View File
@@ -16,7 +16,7 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>stdlib</artifactId>
<artifactId>kotlin-stdlib</artifactId>
<version>${project.version}</version>
</dependency>
+1 -7
View File
@@ -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>
+2 -2
View File
@@ -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>
+1 -1
View File
@@ -28,7 +28,7 @@
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>stdlib</artifactId>
<artifactId>kotlin-stdlib</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
+1 -6
View File
@@ -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>
@@ -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() {
+1 -1
View File
@@ -11,7 +11,7 @@
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>runtime</artifactId>
<artifactId>kotlin-runtime</artifactId>
<packaging>jar</packaging>
<build>