Merge branch 'master' of github.com:JetBrains/kotlin
This commit is contained in:
@@ -58,7 +58,7 @@ public inline fun String.toCharList(): List<Character> = toCharArray().toList()
|
||||
|
||||
public inline fun String.format(format : String, vararg args : Any?) : String = java.lang.String.format(format, args).sure()
|
||||
|
||||
public inline fun String.split(regex : String) : Array<String?>? = (this as java.lang.String).split(regex)
|
||||
public inline fun String.split(regex : String) : Array<String> = (this as java.lang.String).split(regex) as Array<String>
|
||||
|
||||
public inline fun String.substring(beginIndex : Int) : String = (this as java.lang.String).substring(beginIndex).sure()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import kotlin.modules.*
|
||||
|
||||
fun project() {
|
||||
module("apidocs") {
|
||||
classpath += "../lib/junit-4.9.jar"
|
||||
classpath += "../../lib/junit-4.9.jar"
|
||||
|
||||
addSourceFiles("../../stdlib/src")
|
||||
addSourceFiles("../../kunit/src/main/kotlin")
|
||||
|
||||
@@ -92,25 +92,25 @@
|
||||
<artifactId>trove4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>net.sf.trove4j</groupId>
|
||||
<artifactId>trove4j</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>net.sf.trove4j</groupId>
|
||||
<artifactId>trove4j</artifactId>
|
||||
<version>3.0.2</version>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.jetbrains.kotlin</groupId>
|
||||
<artifactId>picocontainer</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.picocontainer</groupId>
|
||||
<artifactId>picocontainer</artifactId>
|
||||
<version>2.9</version>
|
||||
</dependency>
|
||||
-->
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>org.picocontainer</groupId>
|
||||
<artifactId>picocontainer</artifactId>
|
||||
<version>2.9</version>
|
||||
</dependency>
|
||||
-->
|
||||
|
||||
|
||||
<!-- for JS generation -->
|
||||
@@ -124,6 +124,14 @@
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<testSourceDirectory>src/test/java</testSourceDirectory>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
<!-- jdkHeaders -->
|
||||
<directory>${kotlin-sdk}/lib/alt</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
+43
-2
@@ -17,6 +17,8 @@
|
||||
package org.jetbrains.kotlin.maven;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.common.io.Resources;
|
||||
import org.apache.maven.plugin.AbstractMojo;
|
||||
import org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.plugin.MojoFailureException;
|
||||
@@ -25,6 +27,8 @@ import org.jetbrains.jet.cli.CompilerArguments;
|
||||
import org.jetbrains.jet.cli.KotlinCompiler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@@ -133,8 +137,8 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
||||
*/
|
||||
protected abstract void configureCompilerArguments(CompilerArguments arguments) throws MojoExecutionException;
|
||||
|
||||
protected static void configureBaseCompilerArguments(Log log, CompilerArguments arguments, String module,
|
||||
List<String> sources, List<String> classpath, String output) throws MojoExecutionException {
|
||||
protected void configureBaseCompilerArguments(Log log, CompilerArguments arguments, String module,
|
||||
List<String> sources, List<String> classpath, String output) throws MojoExecutionException {
|
||||
// don't include runtime, it should be in maven dependencies
|
||||
arguments.mode = "stdlib";
|
||||
|
||||
@@ -162,5 +166,42 @@ public abstract class KotlinCompileMojoBase extends AbstractMojo {
|
||||
|
||||
log.info("Classes directory is " + output);
|
||||
arguments.setOutputDir(output);
|
||||
|
||||
arguments.jdkHeaders = getJdkHeaders().getPath();
|
||||
log.debug("Using jdk headers from " + arguments.jdkHeaders);
|
||||
}
|
||||
|
||||
private File jdkHeadersPath;
|
||||
|
||||
protected File getJdkHeaders() {
|
||||
if (jdkHeadersPath != null)
|
||||
return jdkHeadersPath;
|
||||
|
||||
try {
|
||||
jdkHeadersPath = extractJdkHeaders();
|
||||
|
||||
if (jdkHeadersPath == null)
|
||||
throw new RuntimeException("Can't find kotlin jdk headers in maven plugin resources");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return jdkHeadersPath;
|
||||
}
|
||||
|
||||
private File extractJdkHeaders() throws IOException {
|
||||
final String kotlin_jdk_headers = "kotlin-jdk-headers.jar";
|
||||
|
||||
final URL jdkHeadersResource = Resources.getResource(kotlin_jdk_headers);
|
||||
if (jdkHeadersResource == null)
|
||||
return null;
|
||||
|
||||
final File jdkHeadersTempDir = Files.createTempDir();
|
||||
jdkHeadersTempDir.deleteOnExit();
|
||||
|
||||
final File jdkHeadersFile = new File(jdkHeadersTempDir, kotlin_jdk_headers);
|
||||
Files.copy(Resources.newInputStreamSupplier(jdkHeadersResource), jdkHeadersFile);
|
||||
|
||||
return jdkHeadersFile;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user