Merge branch 'master' of github.com:JetBrains/kotlin
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project-root>${project.basedir}/../../..</project-root>
|
||||
<project-root>../../..</project-root>
|
||||
|
||||
<asm.version>3.3.1</asm.version>
|
||||
<dart.name>dart-r3300</dart.name>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/test</testSourceDirectory>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<testSourceDirectory>test</testSourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -54,7 +54,7 @@ public inline fun <T> comparator(vararg functions: Function1<T,Any?>): Comparato
|
||||
|
||||
private class FunctionComparator<T>(val functions: Array<Function1<T,Any?>>): Comparator<T> {
|
||||
|
||||
public fun toString(): String {
|
||||
public override fun toString(): String {
|
||||
return "FunctionComparator${functions.toList()}"
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public inline fun <T> comparator(fn: (T,T) -> Int): Comparator<T> {
|
||||
}
|
||||
private class Function2Comparator<T>(val compareFn: (T,T) -> Int): Comparator<T> {
|
||||
|
||||
public fun toString(): String {
|
||||
public override fun toString(): String {
|
||||
return "Function2Comparator${compareFn}"
|
||||
}
|
||||
|
||||
@@ -89,4 +89,4 @@ private class Function2Comparator<T>(val compareFn: (T,T) -> Int): Comparator<T
|
||||
public override fun equals(obj: Any?): Boolean {
|
||||
return this == obj
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,8 @@ class CollectionTest {
|
||||
assertEquals(0, ArrayList<Double>().count())
|
||||
}
|
||||
|
||||
test fun last() {
|
||||
//todo after KT-1873 the name might be returned to 'last'
|
||||
test fun lastElement() {
|
||||
val data = arrayList("foo", "bar")
|
||||
assertEquals("bar", data.last())
|
||||
assertEquals(25, arrayList(15, 19, 20, 25).last())
|
||||
|
||||
@@ -35,8 +35,8 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>${project.basedir}/src/test/kotlin</testSourceDirectory>
|
||||
<sourceDirectory>src/main/kotlin</sourceDirectory>
|
||||
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
||||
@@ -4,14 +4,16 @@ import java.io.File
|
||||
import java.io.PrintStream
|
||||
import org.jetbrains.jet.cli.jvm.K2JVMCompilerArguments
|
||||
import org.jetbrains.jet.cli.jvm.K2JVMCompiler
|
||||
import org.jetbrains.jet.cli.jvm.compiler.CompileEnvironmentConfiguration
|
||||
import org.jetbrains.jet.cli.common.CLICompiler
|
||||
import org.jetbrains.jet.cli.jvm.compiler.K2JVMCompileEnvironmentConfiguration
|
||||
import org.jetbrains.kotlin.doc.highlighter.HtmlCompilerPlugin
|
||||
import org.jetbrains.jet.cli.common.ExitCode
|
||||
|
||||
/**
|
||||
* Main for running the KDocCompiler
|
||||
*/
|
||||
fun main(args: Array<String?>): Unit {
|
||||
K2JVMCompiler.doMain(KDocCompiler(), args);
|
||||
CLICompiler.doMain(KDocCompiler(), args);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -20,7 +22,7 @@ fun main(args: Array<String?>): Unit {
|
||||
*/
|
||||
class KDocCompiler() : K2JVMCompiler() {
|
||||
|
||||
protected override fun configureEnvironment(configuration : CompileEnvironmentConfiguration?, arguments : K2JVMCompilerArguments?) {
|
||||
protected override fun configureEnvironment(configuration : K2JVMCompileEnvironmentConfiguration, arguments : K2JVMCompilerArguments) {
|
||||
super.configureEnvironment(configuration, arguments)
|
||||
val coreEnvironment = configuration?.getEnvironment()
|
||||
if (coreEnvironment != null) {
|
||||
@@ -38,11 +40,11 @@ class KDocCompiler() : K2JVMCompiler() {
|
||||
}
|
||||
}
|
||||
|
||||
protected override fun createArguments() : K2JVMCompilerArguments? {
|
||||
protected override fun createArguments() : K2JVMCompilerArguments {
|
||||
return KDocArguments()
|
||||
}
|
||||
|
||||
protected override fun usage(target : PrintStream?) {
|
||||
protected override fun usage(target : PrintStream) {
|
||||
target?.println("Usage: KDocCompiler -docOutput <docOutputDir> [-output <outputDir>|-jar <jarFileName>] [-stdlib <path to runtime.jar>] [-src <filename or dirname>|-module <module file>] [-includeRuntime]");
|
||||
}
|
||||
}
|
||||
|
||||
+13
-15
@@ -7,20 +7,18 @@ import org.jetbrains.jet.cli.common.CompilerPluginContext
|
||||
*/
|
||||
class HtmlCompilerPlugin: CompilerPlugin {
|
||||
|
||||
public override fun processFiles(context: CompilerPluginContext?) {
|
||||
if (context != null) {
|
||||
val bindingContext = context.getContext()
|
||||
val files = context.getFiles()
|
||||
if (bindingContext != null && files != null) {
|
||||
if (files != null && bindingContext != null) {
|
||||
for (file in files) {
|
||||
if (file != null) {
|
||||
val visitor = HtmlKotlinVisitor()
|
||||
file.accept(visitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public override fun processFiles(context: CompilerPluginContext) {
|
||||
val bindingContext = context.getContext()
|
||||
val files = context.getFiles()
|
||||
if (bindingContext != null && files != null) {
|
||||
if (files != null && bindingContext != null) {
|
||||
for (file in files) {
|
||||
if (file != null) {
|
||||
val visitor = HtmlKotlinVisitor()
|
||||
file.accept(visitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-9
@@ -10,16 +10,14 @@ abstract class KModelCompilerPlugin: CompilerPlugin {
|
||||
public open var config: KDocConfig = KDocConfig()
|
||||
|
||||
|
||||
public override fun processFiles(context: CompilerPluginContext?) {
|
||||
if (context != null) {
|
||||
val bindingContext = context.getContext()
|
||||
val sources = context.getFiles()
|
||||
if (bindingContext != null && sources != null) {
|
||||
val model = KModel(bindingContext, config)
|
||||
model.load(sources)
|
||||
public override fun processFiles(context: CompilerPluginContext) {
|
||||
val bindingContext = context.getContext()
|
||||
val sources = context.getFiles()
|
||||
if (bindingContext != null && sources != null) {
|
||||
val model = KModel(bindingContext, config)
|
||||
model.load(sources)
|
||||
|
||||
processModel(model)
|
||||
}
|
||||
processModel(model)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1020,7 +1020,7 @@ class KPackage(model: KModel, val descriptor: NamespaceDescriptor,
|
||||
}
|
||||
|
||||
class KType(val jetType: JetType, model: KModel, val klass: KClass?, val arguments: List<KType> = ArrayList<KType>())
|
||||
: KNamed(klass?.name ?: jetType.toString(), model, jetType.getConstructor().getDeclarationDescriptor().sure()) {
|
||||
: KNamed(klass?.name ?: jetType.toString().sure(), model, jetType.getConstructor().getDeclarationDescriptor().sure()) {
|
||||
{
|
||||
if (klass != null) {
|
||||
this.wikiDescription = klass.wikiDescription
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
## NOTE - this is just an initial spike of some maven plugins
|
||||
|
||||
Until this plugin is working, please use this maven plugin:
|
||||
http://evgeny-goldin.com/wiki/Kotlin-maven-plugin
|
||||
+24
-24
@@ -28,6 +28,7 @@ import org.jetbrains.k2js.facade.K2JSTranslator;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.Override;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -38,32 +39,31 @@ import java.util.List;
|
||||
public class K2JSCompilerPlugin implements CompilerPlugin {
|
||||
private String outFile = "target/js/program.js";
|
||||
|
||||
public void processFiles(CompilerPluginContext context) {
|
||||
if (context != null) {
|
||||
Project project = context.getProject();
|
||||
BindingContext bindingContext = context.getContext();
|
||||
List<JetFile> sources = context.getFiles();
|
||||
@Override
|
||||
public void processFiles(@NotNull CompilerPluginContext context) {
|
||||
Project project = context.getProject();
|
||||
BindingContext bindingContext = context.getContext();
|
||||
List<JetFile> sources = context.getFiles();
|
||||
|
||||
if (bindingContext != null && sources != null && project != null) {
|
||||
Config config = new Config(project) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<JetFile> generateLibFiles() {
|
||||
return new ArrayList<JetFile>();
|
||||
}
|
||||
};
|
||||
|
||||
K2JSTranslator translator = new K2JSTranslator(config);
|
||||
final String code = translator.generateProgramCode(sources);
|
||||
|
||||
File file = new File(outFile);
|
||||
|
||||
try {
|
||||
Files.createParentDirs(file);
|
||||
Files.write(code, file, Charset.forName("UTF-8"));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
if (bindingContext != null && sources != null && project != null) {
|
||||
Config config = new Config(project) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected List<JetFile> generateLibFiles() {
|
||||
return new ArrayList<JetFile>();
|
||||
}
|
||||
};
|
||||
|
||||
K2JSTranslator translator = new K2JSTranslator(config);
|
||||
final String code = translator.generateProgramCode(sources);
|
||||
|
||||
File file = new File(outFile);
|
||||
|
||||
try {
|
||||
Files.createParentDirs(file);
|
||||
Files.write(code, file, Charset.forName("UTF-8"));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,9 +16,33 @@
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<build>
|
||||
<sourceDirectory>${project.basedir}/../../../runtime/src</sourceDirectory>
|
||||
<sourceDirectory>target/copied-sources</sourceDirectory>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.7</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>copy-sources</id>
|
||||
<phase>process-sources</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<delete dir="${basedir}/target/copied-sources" failonerror="false" />
|
||||
<copy todir="${basedir}/target/copied-sources">
|
||||
<fileset dir="${basedir}/../../../runtime/src"/>
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user