reworked kotlin compiler dist

This commit is contained in:
Leonid Shalupov
2012-05-04 19:12:02 +04:00
parent 743c14f239
commit 4eae229127
24 changed files with 252 additions and 1246 deletions
-31
View File
@@ -1,31 +0,0 @@
#!/bin/sh -e
die() {
echo "$@" >&2
exit 1
}
root=`cd $(dirname $0)/..; pwd`
ideaRoot=
for d in $root/ideaSDK /Applications/Nika-*.app; do
if [ -d "$d/lib" ]; then
ideaRoot="$d"
break
fi
done
test -n "$ideaRoot" || die "Idea root not found"
classpath="$root/out/production/cli"
classpath="$classpath:$root/out/production/backend:$root/out/production/frontend:$root/out/production/frontend.java:$root/out/production/jet.as.java.psi:$root/out/production/util"
classpath="$classpath:$root/out/production/stdlib"
classpath="$classpath:$root/lib/*:$ideaRoot/lib/*:$ideaRoot/lib/rt/*"
exec java $JAVA_OPTS \
-ea \
-classpath "$classpath" \
org.jetbrains.jet.cli.jvm.K2JVMCompiler \
"$@"
# vim: set ts=4 sw=4 et:
-7
View File
@@ -1,7 +0,0 @@
#!/bin/sh -e
cd $(dirname $0)/..
exec java -classpath 'dist/classes/tests:compiler/frontend/src:dist/classes/runtime:dist/classes/compiler:lib/*:ideaSDL/core/*:ideaSDK/lib/*' "$@"
# vim: set ts=4 sw=4 et ft=sh:
-173
View File
@@ -1,173 +0,0 @@
{toc:style=disc|indent=20px}
h1. Ant
h2. Defining {{*<kotlinc>*}} task using local Kotlin setup
One way to define Ant's {{*<kotlinc>*}} task is by using your local Kotlin setup and {{*KOTLIN_HOME*}} environment variable:
{code:xml}
<property environment="env"/>
<taskdef resource = "org/jetbrains/jet/buildtools/ant/antlib.xml">
<classpath>
<fileset dir = "${env.KOTLIN_HOME}/lib" includes = "*.jar"/>
</classpath>
</taskdef>
{code}
Alternatively, you can copy all jar files from Kotlin distribution to Ant's {{"lib"}} folder.
h2. Defining {{*<kotlinc>*}} task using Ivy
Another way to define Ant's {{*<kotlinc>*}} task is by using Ivy:
{{"ivyconf.xml"}}:
{code:xml}
<ivysettings>
<property name='ivy.checksums' value=''/>
<caches defaultCache="${user.home}/.ivy/cache"/>
<settings defaultResolver="sonatype-repo"/>
<statuses>
<status name='integration' integration='true'/>
</statuses>
<resolvers>
<url name="sonatype-repo" m2compatible="true">
<artifact pattern="https://oss.sonatype.org/content/repositories/central/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
<url name='jetbrains-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
<ivy pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml'/>
<artifact pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'/>
</url>
</resolvers>
<modules>
<module organisation='org' name='bt343' matcher='regexp' resolver='jetbrains-repo'/>
<module organisation='org' name='bt344' matcher='regexp' resolver='jetbrains-repo'/>
</modules>
</ivysettings>
{code}
{{"ivy.xml"}}:
{code:xml}
<ivy-module version="1.3">
<info organisation="com.jetbrains" module="kotlin"/>
<dependencies>
<!-- Kotlin build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt344 -->
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt344/latest.lastSuccessful/teamcity-ivy.xml -->
<dependency org="org" name="bt344" rev="latest.lastSuccessful">
<include ext="jar" matcher="exactOrRegexp"/>
</dependency>
<!-- IDEA build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt343 -->
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt343/latest.lastSuccessful/teamcity-ivy.xml -->
<dependency org="org" name="bt343" rev="latest.lastSuccessful">
<include name="core/.*" ext="jar" matcher="exactOrRegexp"/>
</dependency>
<dependency org="asm" name="asm-util" rev="3.3.1"/>
</dependencies>
</ivy-module>
{code}
{{"build.xml"}}:
{code:xml}
<!-- Copy Ivy jar and all its dependencies to Ant's "lib": http://www.apache.org/dist/ant/ivy/2.2.0/apache-ivy-2.2.0-bin-with-deps.zip -->
<taskdef uri="antlib:org.apache.ivy.ant" resource="org/apache/ivy/ant/antlib.xml"/>
<ivy:configure file="${basedir}/ivyconf.xml"/>
<ivy:resolve file="${basedir}/ivy.xml"/>
<ivy:cachepath pathid="kotlin.classpath" organisation="org" revision="latest.lastSuccessful"/>
<taskdef resource = "org/jetbrains/jet/buildtools/ant/antlib.xml">
<classpath>
<path refid="kotlin.classpath"/>
</classpath>
</taskdef>
{code}
h2. {{*<kotlinc>*}} attributes
|| {align:center}Name{align} || {align:center}Description{align} || {align:center}Required{align} || {align:center}Default Value{align} ||
| {align:center}{{*src*}}{align} | Kotlin source file or directory to compile | {{"src"}} or {{"module"}} needs to be specified | &nbsp; |
| {align:center}{{*module*}}{align} | Kotlin [module|http://confluence.jetbrains.net/display/Kotlin/Modules+and+Compilation] to compile | {{"src"}} or {{"module"}} needs to be specified | &nbsp; |
| {align:center}{{*output*}}{align} | Destination directory | If {{"src"}} is used - {{"output"}} or {{"jar"}} needs to be specified | &nbsp; |
| {align:center}{{*jar*}}{align} | Destination jar file | If {{"src"}} is used - {{"output"}} or {{"jar"}} needs to be specified
If {{"module"}} is used - only {{"jar"}} can be specified or it can be omitted | {align:center}{{"moduleName.jar"}}{align} |
| {align:center}{{*classpath*}}{align} | Compilation class path | {align:center}{{false}}{align} | &nbsp; |
| {align:center}{{*classpathref*}}{align} | Compilation class path reference | {align:center}{{false}}{align} | &nbsp; |
| {align:center}{{*stdlib*}}{align} | Path to {{"kotlin-runtime.jar"}} | {align:center}{{false}}{align} | {align:center}{{""}}{align} |
| {align:center}{{*includeRuntime*}}{align} | If {{"jar"}} is used - whether Kotlin runtime library is included | {align:center}{{false}}{align} | {align:center}{{true}}{align} |
{{<kotlinc>}} accepts a nested {{<classpath>}} element, similarly to [{{<javac>}}|http://evgeny-goldin.org/javadoc/ant/Tasks/javac.html].
h2. Examples
{code:xml}
<kotlinc src = "test/longer-examples/Bottles.kt" output = "dist"/>
<kotlinc src = "test/longer-examples" output = "dist"/>
<kotlinc src = "test/longer-examples/Bottles.kt" jar = "dist.jar"/>
<kotlinc src = "test/longer-examples" jar = "dist.jar"/>
<kotlinc module = "test/modules/smoke/Smoke.kts" jar = "dist.jar"/>
<kotlinc module = "test/modules/smoke/Smoke.kts"/> => "smoke.jar"
{code}
{{"Smoke.kts"}}:
{code}
import kotlin.modules.*
fun project() {
module("smoke") {
sources += "Smoke.kt"
}
}
{code}
{{"Smoke.kt"}}:
{code}
package Smoke
fun main(args: Array<String>) {
print("${args[0]}|${args[1]}|${args[2]}")
}
{code}
h3. Classpath examples
{code:xml}
<path id="junit-jar">
<fileset file="lib/junit.jar"/>
</path>
<kotlinc src = "src/unit-tests" jar = "tests.jar" classpath = "lib/junit.jar"/>
<kotlinc src = "src/unit-tests" jar = "tests.jar" classpathref = "junit-jar"/>
<kotlinc src = "src/unit-tests" jar = "tests.jar">
<classpath>
<path refid="junit-jar"/>
</classpath>
</kotlinc>
<kotlinc src = "src/unit-tests" jar = "tests.jar">
<classpath>
<fileset file="lib/junit.jar"/>
</classpath>
</kotlinc>
{code}
h1. Maven
See [{{"kotlin-maven-plugin"}}|http://evgeny-goldin.com/wiki/Kotlin-maven-plugin].
h1. Gradle
+19 -1
View File
@@ -4,13 +4,31 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/core/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/ant/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="cli" />
<orderEntry type="library" name="intellij-core" level="project" />
<orderEntry type="module" module-name="frontend.java" />
<orderEntry type="module" module-name="runtime" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../dependencies/ant.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../ideaSDK/lib/annotations.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
-503
View File
@@ -1,503 +0,0 @@
<project name="build-tools" default="buildToolsJar" xmlns:ivy="antlib:org.apache.ivy.ant">
<property name="tests-dir" location="${output}/ant-test/build-tools-test"/>
<property name="tests-jar" location="${tests-dir}/out.jar"/>
<property name="junit-jar" location="${basedir}/libraries/lib/junit-4.9.jar"/>
<property name="failonerror" value="true"/> <!-- Whether invoking compiled classes should file on error -->
<property name="use-ivy" value="false"/> <!-- Whether Ivy should be used to define "kotlin.classpath" and <kotlinc> task -->
<!-- Override with "-Duse-ivy=true" -->
<!-- http://ant-contrib.sourceforge.net/tasks/tasks/index.html -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${basedir}/build-tools/lib/ant-contrib-1.0b3.jar"/>
</classpath>
</taskdef>
<path id="junit-jar">
<fileset file="${junit-jar}"/>
</path>
<!-- Verifies file or directory specified exists -->
<macrodef name="verify-exists">
<attribute name="file"/>
<attribute name="type" default="dir"/>
<sequential>
<if>
<available file="@{file}" type="@{type}"/>
<then>
<echo>[@{file}] of type [@{type}] exists</echo>
</then>
<else>
<fail message="[@{file}] of type [@{type}] is not found!"/>
</else>
</if>
</sequential>
</macrodef>
<!-- Defines "kotlin.classpath" using ${kotlin-home} -->
<macrodef name="kotlin-home-setup">
<sequential>
<if>
<and>
<available file="${kotlin-home}/lib/kotlin-build-tools.jar" type="file"/>
<available file="${kotlin-home}/lib/kotlin-compiler.jar" type="file"/>
<available file="${kotlin-home}/lib/kotlin-runtime.jar" type="file"/>
</and>
<then>
<echo>[${kotlin-home}/lib] jars found, defining "kotlin.classpath"</echo>
<path id="kotlin.classpath">
<fileset dir = "${kotlin-home}/lib" includes = "*.jar"/>
</path>
</then>
<else>
<!-- Creating and unpacking the distribution archive to make sure it's Ok -->
<echo>[${kotlin-home}/lib] jars *not* found, creating distribution zip</echo>
<antcall target = "zip"/>
<verify-exists file="${output}/${output.name}.zip" type="file"/>
<!-- Sometimes deleting "dist/kotlinc/lib/alt/kotlin-jdk-headers.jar" fails -->
<delete dir = "${kotlin-home}" failonerror="false"/>
<mkdir dir = "${kotlin-home}"/>
<unzip src = "${output}/${output.name}.zip" dest="${output}"/>
<verify-exists file="${kotlin-home}/lib"/>
<verify-exists file="${kotlin-home}/lib/kotlin-build-tools.jar" type="file"/>
<verify-exists file="${kotlin-home}/lib/kotlin-compiler.jar" type="file"/>
<verify-exists file="${kotlin-home}/lib/kotlin-runtime.jar" type="file"/>
<kotlin-home-setup/>
</else>
</if>
</sequential>
</macrodef>
<!-- Defines "kotlin.classpath" and <kotlinc> task -->
<macrodef name="define-kotlinc">
<sequential>
<if>
<istrue value="${use-ivy}"/>
<then>
<!-- Defining "kotlin.classpath" with Ivy -->
<taskdef uri="antlib:org.apache.ivy.ant" resource="org/apache/ivy/ant/antlib.xml"/>
<ivy:configure file="${basedir}/build-tools/ivyconf.xml"/>
<ivy:resolve file="${basedir}/build-tools/ivy.xml"/>
<ivy:cachepath pathid="kotlin.classpath" organisation="org" revision="latest.lastSuccessful"/>
</then>
<else>
<!-- Defining "kotlin.classpath" with ${kotlin-home} -->
<kotlin-home-setup/>
</else>
</if>
<taskdef resource = "org/jetbrains/jet/buildtools/ant/antlib.xml">
<classpath>
<path refid="kotlin.classpath"/>
</classpath>
</taskdef>
</sequential>
</macrodef>
<!-- Deletes all previously compiled files -->
<macrodef name="cleanup">
<sequential>
<delete dir = "${tests-dir}" failonerror="true"/>
<delete file = "${tests-jar}" failonerror="true"/>
<mkdir dir = "${tests-dir}"/>
</sequential>
</macrodef>
<!-- Runs <kotlinc> create a *.class files in directory -->
<macrodef name="kotlinc-dir">
<attribute name="src"/>
<attribute name="stdlib" default=""/>
<sequential>
<cleanup/>
<kotlinc src = "@{src}" output = "${tests-dir}" stdlib = "@{stdlib}" classpathref="junit-jar"/>
</sequential>
</macrodef>
<!-- Runs <kotlinc> to create a *.class files in a jar -->
<macrodef name="kotlinc-jar">
<attribute name="src" default=""/>
<attribute name="module" default=""/>
<attribute name="includeRuntime" default="true"/>
<attribute name="stdlib" default=""/>
<attribute name="jar" default="${tests-jar}"/>
<sequential>
<cleanup/>
<if>
<equals arg1="@{module}" arg2=""/>
<then>
<kotlinc src = "@{src}" jar = "@{jar}" includeRuntime = "@{includeRuntime}" stdlib = "@{stdlib}">
<classpath>
<path refid="junit-jar"/>
</classpath>
</kotlinc>
</then>
<elseif>
<equals arg1="@{jar}" arg2=""/>
<then>
<kotlinc module = "@{module}" includeRuntime = "@{includeRuntime}" stdlib = "@{stdlib}">
<classpath>
<fileset file="${junit-jar}"/>
</classpath>
</kotlinc>
</then>
</elseif>
<else>
<kotlinc module = "@{module}" jar = "@{jar}" includeRuntime = "@{includeRuntime}" stdlib = "@{stdlib}" classpath="${junit-jar}"/>
</else>
</if>
</sequential>
</macrodef>
<!-- Runs <java> for compiled classes and verifies the output correctness -->
<macrodef name="run-java">
<attribute name="out"/>
<attribute name="classname" default="namespace"/>
<attribute name="args" default=""/>
<attribute name="equals" default="true"/> <!-- Whether strict equality of output to @{out} required -->
<attribute name="run-jar" default="false"/> <!-- Whether to run compiled classes or a jar file -->
<attribute name="jar" default="${tests-jar}"/> <!-- Jar to use for classpath if "run-jar" is "true" -->
<sequential>
<var name = "java-out" unset = "true"/>
<if>
<istrue value="@{run-jar}"/>
<then>
<echo>Running [@{classname}], classpath = "@{jar}"</echo>
<java outputproperty = "java-out"
classname = "@{classname}"
failonerror = "${failonerror}">
<classpath>
<pathelement path = "@{jar}"/>
</classpath>
<arg line = "@{args}"/>
</java>
</then>
<else>
<echo>Running [@{classname}], classpath = "${tests-dir}"</echo>
<java outputproperty = "java-out"
classname = "@{classname}"
failonerror = "${failonerror}">
<classpath>
<pathelement path = "${tests-dir}"/>
<path refid = "kotlin.classpath"/>
</classpath>
<arg line = "@{args}"/>
</java>
</else>
</if>
<if>
<or>
<equals arg1="${java-out}" arg2="@{out}"/>
<and>
<isfalse value="@{equals}"/>
<contains string="${java-out}" substring="@{out}"/>
</and>
</or>
<then>
<echo>${java-out}</echo>
</then>
<elseif>
<istrue value="${failonerror}"/>
<then>
<fail message="Test failed: '${java-out}' (received) != '@{out}' (expected), equals = [@{equals}]"/>
</then>
</elseif>
</if>
</sequential>
</macrodef>
<!-- Compiles "Hello.kt" as a single file and a folder, runs <java> and verifies the output -->
<macrodef name="hello-test">
<attribute name="root"/>
<attribute name="args" default=""/>
<attribute name="out"/>
<sequential>
<kotlinc-dir src = "@{root}/Hello.kt"/>
<run-java args = "@{args}" out = "@{out}"/>
<kotlinc-dir src = "@{root}"/>
<run-java args = "@{args}" out = "@{out}"/>
<kotlinc-jar src = "@{root}/Hello.kt"/>
<run-java args = "@{args}" out = "@{out}" run-jar="true"/>
<kotlinc-jar src = "@{root}"/>
<run-java args = "@{args}" out = "@{out}" run-jar="true"/>
</sequential>
</macrodef>
<!-- Runs all Hello tests -->
<macrodef name="hello-tests">
<sequential>
<hello-test root="${basedir}/build-tools/test/hello/1" out="Hello, world!"/>
<hello-test root="${basedir}/build-tools/test/hello/2" args="Kotlin-Developer" out="Hello, Kotlin-Developer!"/>
<hello-test root="${basedir}/build-tools/test/hello/3" args="Mickey-Mouse" out="Hello, Mickey-Mouse!"/>
<hello-test root="${basedir}/build-tools/test/hello/4" args="IT" out="Ciao!"/>
<hello-test root="${basedir}/build-tools/test/hello/4" args="FR" out="Salut!"/>
<hello-test root="${basedir}/build-tools/test/hello/5" args="Donald-Duck" out="Hello, Donald-Duck!"/>
</sequential>
</macrodef>
<!-- Compiles, runs and verifies the output of web demo longer examples -->
<macrodef name="longer-examples-tests">
<sequential>
<kotlinc-dir src = "${basedir}/build-tools/test/longer-examples"/>
<run-java classname = "bottles.namespace" equals="false" out="12 bottles of beer on the wall, 12 bottles of beer."/>
<run-java classname = "life.namespace" equals="false" out="*** ** ** ***"/>
<!--<run-java classname = "maze.namespace" equals="false" out="O ~OOOOOOOOOOOOOO"/>-->
<!--<run-java classname = "html.namespace" equals="false" out="&lt;a href=&quot;http://jetbrains.com/kotlin&quot;&gt;"/>-->
<kotlinc-jar src = "${basedir}/build-tools/test/longer-examples"/>
<run-java classname = "bottles.namespace" equals="false" run-jar="true" out="12 bottles of beer on the wall, 12 bottles of beer."/>
<run-java classname = "life.namespace" equals="false" run-jar="true" out="*** ** ** ***"/>
<!--<run-java classname = "maze.namespace" equals="false" run-jar="true" out="O ~OOOOOOOOOOOOOO"/>-->
<!--<run-java classname = "html.namespace" equals="false" run-jar="true" out="&lt;a href=&quot;http://jetbrains.com/kotlin&quot;&gt;"/>-->
</sequential>
</macrodef>
<!-- Compiles and runs a Kotlin module -->
<macrodef name="module-tests">
<sequential>
<!-- Module => Explicit Jar -->
<kotlinc-jar module="${basedir}/build-tools/test/modules/smoke/Smoke.kts"/>
<run-java classname = "Smoke.namespace" run-jar = "true" args = "1 2 3" out = "1|2|3"/>
<!-- Module => Default Jar -->
<kotlinc-jar module="${basedir}/build-tools/test/modules/smoke/Smoke.kts" jar=""/>
<move file="${basedir}/build-tools/test/modules/smoke/smoke.jar" todir="${tests-dir}"/>
<run-java classname = "Smoke.namespace" run-jar = "true" args = "1 2 3" out = "1|2|3" jar="${tests-dir}/smoke.jar"/>
</sequential>
</macrodef>
<!-- Runs JUnit single test or batch tests -->
<macrodef name="run-junit">
<attribute name="classpath"/>
<attribute name="test" default=""/>
<sequential>
<path id="junit-classpath">
<path refid="junit-jar"/>
<path refid="kotlin.classpath"/>
<pathelement location="@{classpath}"/>
</path>
<if>
<equals arg1="@{test}" arg2=""/>
<then>
<!-- Batch tests -->
<if>
<matches string="@{classpath}" pattern="\.jar$"/>
<then>
<!-- Batch tests from a jar -->
<echo>Running JUnit: classpath = "@{classpath}" (Jar)</echo>
<junit haltonfailure="true">
<classpath>
<path refid="junit-classpath"/>
</classpath>
<formatter type="plain" usefile="false"/>
<batchtest>
<zipfileset src="@{classpath}" includes="**/*Test.class" excludes="**/BuiltTest.class"/>
</batchtest>
</junit>
</then>
<else>
<!-- Batch tests from a dir -->
<echo>Running JUnit: classpath = "@{classpath}" (Dir)</echo>
<junit haltonfailure="true">
<classpath>
<path refid="junit-classpath"/>
</classpath>
<formatter type="plain" usefile="false"/>
<batchtest>
<fileset dir="@{classpath}" includes="**/*Test.class" excludes="**/BuiltTest.class"/>
</batchtest>
</junit>
</else>
</if>
</then>
<else>
<!-- Single test -->
<echo>Running JUnit: test = "@{test}", classpath = "@{classpath}"</echo>
<junit haltonfailure="true">
<classpath>
<path refid="junit-classpath"/>
</classpath>
<formatter type="plain" usefile="false"/>
<test name="@{test}"/>
</junit>
</else>
</if>
</sequential>
</macrodef>
<!-- Runs all JUnit tests, first each test separately and then all of them in a batch mode -->
<macrodef name="testlib-junit-tests">
<attribute name="classpath"/>
<sequential>
<run-junit classpath="@{classpath}" test="test.collections.CollectionTest"/>
<run-junit classpath="@{classpath}" test="test.collections.IoTest"/>
<run-junit classpath="@{classpath}" test="test.collections.ListTest"/>
<run-junit classpath="@{classpath}" test="test.collections.MapTest"/>
<run-junit classpath="@{classpath}" test="test.collections.OldStdlibTest"/>
<run-junit classpath="@{classpath}" test="test.collections.SetTest"/>
<run-junit classpath="@{classpath}" test="test.collections.StandardCollectionTest"/>
<run-junit classpath="@{classpath}" test="test.stdlib.issues.StdLibIssuesTest"/>
<run-junit classpath="@{classpath}" test="testString.StringTest"/>
<run-junit classpath="@{classpath}"/>
</sequential>
</macrodef>
<!-- Compiles "testlib" Kotlin tests (dir/module => dir/jar) and runs all JUnit tests resulted -->
<macrodef name="testlib-tests">
<sequential>
<!-- Dir => Dir -->
<kotlinc-dir src = "${basedir}/libraries/stdlib/test"/>
<testlib-junit-tests classpath = "${tests-dir}"/>
<!-- Dir => Jar -->
<kotlinc-jar src = "${basedir}/libraries/stdlib/test"/>
<testlib-junit-tests classpath = "${tests-jar}"/>
<!-- Module => Explicit Jar -->
<kotlinc-jar module = "${basedir}/libraries/stdlib/testModule.kt"/>
<testlib-junit-tests classpath = "${tests-jar}"/>
<!-- Module => Default Jar -->
<kotlinc-jar module = "${basedir}/libraries/stdlib/testModule.kt" jar=""/>
<move file="${basedir}/libraries/testlib/testlib.jar" todir="${tests-dir}"/>
<testlib-junit-tests classpath = "${tests-dir}/testlib.jar"/>
</sequential>
</macrodef>
<!-- Verifies build fails if <kotlinc> fails -->
<macrodef name="compilation-fail-test">
<sequential>
<var name="failed" value="false"/>
<trycatch property="error-message" reference="bar">
<try>
<!-- Should fail -->
<kotlinc-dir src = "${basedir}/build-tools/test/compilation-fail"/>
</try>
<catch>
<var name="failed" value="true"/>
<echo>"ERROR:" was expected here</echo>
</catch>
</trycatch>
<if>
<isfalse value="${failed}"/>
<then>
<fail message="kotlinc-dir: compilation should have failed!"/>
</then>
</if>
<var name="failed" value="false"/>
<trycatch property="error-message" reference="bar">
<try>
<!-- Should fail -->
<kotlinc-jar src = "${basedir}/build-tools/test/compilation-fail"/>
</try>
<catch>
<var name="failed" value="true"/>
<echo>"ERROR:" was expected here</echo>
</catch>
</trycatch>
<if>
<isfalse value="${failed}"/>
<then>
<fail message="kotlinc-jar: compilation should have failed!"/>
</then>
</if>
<var name="failed" value="false"/>
<trycatch property="error-message" reference="bar">
<try>
<!-- Should fail -->
<kotlinc-jar module = "${basedir}/build-tools/test/compilation-fail/Smoke.kts"/>
</try>
<catch>
<var name="failed" value="true"/>
<echo>"ERROR:" was expected here</echo>
</catch>
</trycatch>
<if>
<isfalse value="${failed}"/>
<then>
<fail message="kotlinc-jar: compilation should have failed!"/>
</then>
</if>
</sequential>
</macrodef>
<!-- Creates build tools distribution jar -->
<target name="buildToolsJar" depends="compile">
<mkdir dir ="${output}/classes/buildTools"/>
<javac destdir="${output}/classes/buildTools" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src>
<dirset dir="${basedir}/build-tools">
<include name="core/src"/>
<include name="ant/src"/>
<include name="maven/src"/>
<include name="gradle/src"/>
</dirset>
<dirset dir="${basedir}/js">
<include name="js.translator/src"/>
</dirset>
<!--
<dirset dir="${basedir}/j2k">
<include name="src"/>
</dirset>
-->
</src>
<compilerarg value="-Xlint:all"/>
<classpath>
<path refid = "classpath.kotlin"/>
<fileset dir = "${ant.home}/lib" includes="*.jar"/>
<fileset dir = "${basedir}/js/js.translator/lib" includes="*.jar"/>
</classpath>
</javac>
<jar destfile="${kotlin-home}/lib/kotlin-build-tools.jar">
<fileset dir = "${output}/classes/buildTools"/>
<fileset dir = "${basedir}/build-tools/ant/src" includes="**/*.xml"/>
</jar>
</target>
<!-- Tests build tools distribution jar -->
<target name="buildToolsTest">
<define-kotlinc/>
<hello-tests/>
<longer-examples-tests/>
<module-tests/>
<!--<testlib-tests/>-->
<compilation-fail-test/>
</target>
</project>
-20
View File
@@ -1,20 +0,0 @@
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Configuring Ant to work with TeamCity Ivy repo: http://goo.gl/foaTg -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<ivy-module version="1.3">
<info organisation="com.jetbrains" module="kotlin"/>
<dependencies>
<!-- Kotlin build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt344 -->
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt344/latest.lastSuccessful/teamcity-ivy.xml -->
<dependency org="org" name="bt344" rev="latest.lastSuccessful">
<include ext="jar" matcher="exactOrRegexp"/>
</dependency>
<!-- IDEA build: http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt343 -->
<!-- http://teamcity.jetbrains.com/guestAuth/repository/download/bt343/latest.lastSuccessful/teamcity-ivy.xml -->
<dependency org="org" name="bt343" rev="latest.lastSuccessful">
<include name="core/.*" ext="jar" matcher="exactOrRegexp"/>
</dependency>
<dependency org="asm" name="asm-util" rev="3.3.1"/>
</dependencies>
</ivy-module>
-25
View File
@@ -1,25 +0,0 @@
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!-- Configuring Ant to work with TeamCity Ivy repo: http://goo.gl/foaTg -->
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<ivysettings>
<property name='ivy.checksums' value=''/>
<caches defaultCache="${user.home}/.ivy/cache"/>
<settings defaultResolver="sonatype-repo"/>
<statuses>
<status name='integration' integration='true'/>
</statuses>
<resolvers>
<url name="sonatype-repo" m2compatible="true">
<artifact pattern="https://oss.sonatype.org/content/repositories/central/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]"/>
</url>
<url name='jetbrains-repo' alwaysCheckExactRevision='yes' checkmodified='true'>
<ivy pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/teamcity-ivy.xml'/>
<artifact pattern='http://teamcity.jetbrains.com/guestAuth/repository/download/[module]/[revision]/[artifact](.[ext])'/>
</url>
</resolvers>
<modules>
<module organisation='org' name='bt343' matcher='regexp' resolver='jetbrains-repo'/>
<module organisation='org' name='bt344' matcher='regexp' resolver='jetbrains-repo'/>
</modules>
</ivysettings>
Binary file not shown.
+191 -196
View File
@@ -5,10 +5,6 @@
<property name="build.number" value="snapshot"/>
<property name="output.name" value="kotlin-${build.number}"/>
<property name="idea.sdk" value="${basedir}/ideaSDK"/>
<!-- set to false for faster build -->
<import file="build-tools/build.xml" optional="false"/>
<path id="classpath">
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
@@ -21,115 +17,59 @@
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
<fileset dir="${basedir}/js/js.translator/lib" includes="*.jar"/>
<pathelement path="${output}/classes/runtime"/>
</path>
<path id="classpath.kotlin">
<path refid="classpath"/>
<pathelement path="${output}/classes/compiler"/>
</path>
<path id="sourcepath">
<dirset dir="${basedir}/compiler">
<include name="frontend/src"/>
<include name="frontend.java/src"/>
<include name="backend/src"/>
<include name="cli/src"/>
<include name="util/src"/>
<include name="jet.as.java.psi/src"/>
<dirset dir="${basedir}/">
<include name="compiler/frontend/src"/>
<include name="compiler/frontend.java/src"/>
<include name="compiler/backend/src"/>
<include name="compiler/cli/src"/>
<include name="compiler/util/src"/>
<include name="compiler/jet.as.java.psi/src"/>
<include name="runtime/src"/>
<include name="js/js.translator/src"/>
</dirset>
<dirset dir="${basedir}/js/js.translator">
<include name="src"/>
</dirset>
</path>
<macrodef name="cleandir">
<attribute name="dir"/>
<sequential>
<echo message="Cleaning @{dir}"/>
<delete dir="@{dir}" failonerror="false"/>
<mkdir dir="@{dir}"/>
</sequential>
</macrodef>
<target name="clean">
<delete dir="${output}"/>
</target>
<target name="init" depends="clean">
<mkdir dir="${kotlin-home}"/>
<mkdir dir="${kotlin-home}/lib"/>
<mkdir dir="${kotlin-home}/lib/alt"/>
</target>
<target name="compileRT" depends="init">
<mkdir dir="${output}/classes/runtime"/>
<javac destdir="${output}/classes/runtime" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src path="${basedir}/runtime/src"/>
<classpath refid="classpath"/>
</javac>
<target name="prepareDist">
<copy todir="${kotlin-home}/bin">
<fileset dir="${basedir}/compiler/cli/bin"/>
</copy>
<copy todir="${kotlin-home}/license">
<fileset dir="${basedir}/license"/>
</copy>
<echo file="${kotlin-home}/build.txt" message="${build.number}"/>
<chmod dir="${kotlin-home}/bin" includes="*" perm="755"/>
</target>
<target name="compileStdlib" depends="jar,jarLang,compileRT">
<mkdir dir="${output}/classes/stdlib"/>
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true" fork="true">
<classpath>
<path refid="classpath"/>
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
</classpath>
<arg value="-src"/>
<arg value="${basedir}/libraries/stdlib/src"/>
<arg value="-output"/>
<arg value="${output}/classes/stdlib"/>
<arg value="-mode"/>
<arg value="stdlib"/>
<arg value="-classpath"/>
<arg value="${output}/classes/runtime"/>
</java>
</target>
<target name="compileJDKHeaders" depends="jar,jarLang">
<mkdir dir="${output}/classes/stdlib"/>
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true">
<classpath>
<path refid="classpath"/>
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
</classpath>
<arg value="-src"/>
<arg value="${basedir}/jdk-headers/src"/>
<arg value="-output"/>
<arg value="${output}/classes/jdk-headers"/>
<arg value="-mode"/>
<arg value="jdkHeaders"/>
</java>
</target>
<target name="compileLang" depends="jar">
<mkdir dir="${output}/classes/lang"/>
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true">
<classpath>
<path refid="classpath"/>
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
</classpath>
<arg value="-src"/>
<arg value="${basedir}/compiler/frontend/src"/>
<arg value="-output"/>
<arg value="${output}/classes/lang"/>
<arg value="-mode"/>
<arg value="builtins"/>
</java>
</target>
<target name="jarRT" depends="compile,copyKotlinJars,compileStdlib">
<jar destfile="${kotlin-home}/lib/kotlin-runtime.jar">
<fileset dir="${output}/classes/runtime"/>
<fileset dir="${output}/classes/stdlib"/>
<fileset dir="${basedir}/runtime" includes="src/**/*"/>
<fileset dir="${basedir}/libraries/stdlib" includes="src/**/*"/>
</jar>
</target>
<target name="jarJDKHeaders" depends="compile,compileJDKHeaders">
<jar destfile="${kotlin-home}/lib/alt/kotlin-jdk-headers.jar">
<fileset dir="${output}/classes/jdk-headers"/>
</jar>
</target>
<target name="jarLang" depends="compile,compileLang">
<jar destfile="${kotlin-home}/lib/lang.jar">
<fileset dir="${output}/classes/lang"/>
</jar>
</target>
<target name="compileInjectorsGenerator">
<mkdir dir="${output}/classes/injectorsGenerator"/>
<target name="injectorsGenerator">
<cleandir dir="${output}/classes/injectorsGenerator"/>
<javac destdir="${output}/classes/injectorsGenerator" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src path="injector-generator/src"/>
<src refid="sourcepath"/>
@@ -137,48 +77,27 @@
</javac>
</target>
<target name="generateInjectors" depends="compileInjectorsGenerator">
<target name="generateInjectors" depends="injectorsGenerator">
<java classname="org.jetbrains.jet.di.AllInjectorsGenerator" failonerror="true">
<classpath refid="classpath"/>
<classpath path="${output}/classes/injectorsGenerator"/>
</java>
</target>
<target name="compile" depends="compileRT,generateInjectors">
<mkdir dir="${output}/classes/compiler"/>
<target name="compiler">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${basedir}/dependencies/jarjar.jar"/>
<taskdef resource="proguard/ant/task.properties" classpath="${basedir}/dependencies/proguard.jar"/>
<cleandir dir="${output}/classes/compiler"/>
<javac destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src refid="sourcepath"/>
<classpath refid="classpath"/>
</javac>
</target>
<target name="compileTests" depends="dist">
<mkdir dir="${output}/classes/tests"/>
<javac destdir="${output}/classes/tests" debug="true" includeAntRuntime="false">
<src path="compiler/tests"/>
<classpath refid="classpath"/>
<classpath location="${output}/classes/compiler"/>
<classpath location="ideaSDK/lib/junit-4.10.jar"/>
<classpath location="ideaSDK/lib/idea.jar"/>
</javac>
</target>
<target name="jar" depends="compile">
<jar destfile="${kotlin-home}/lib/kotlin-compiler.jar">
<fileset dir="${output}/classes/compiler"/>
<fileset dir="${basedir}/compiler/frontend/src" includes="jet/**"/>
</jar>
</target>
<target name="jarjar" unless="nojarjar">
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${basedir}/dependencies/jarjar.jar"/>
<taskdef resource="proguard/ant/task.properties" classpath="${basedir}/dependencies/proguard.jar"/>
<!-- JarJar Kotlin compiler & dependencies -->
<delete file="${output}/kotlin-compiler-jarjar.jar" failonerror="false"/>
<jarjar jarfile="${output}/kotlin-compiler-jarjar.jar">
<fileset dir="${output}/classes/compiler"/>
<fileset dir="${output}/classes/runtime"/>
<fileset dir="${basedir}/compiler/frontend/src" includes="jet/**"/>
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
@@ -198,21 +117,20 @@
<zap pattern="org.jdom.xpath.Jaxen*"/>
<zap pattern="org.mozilla.javascript.xml.impl.xmlbeans.**" />
<zap pattern="org.mozilla.javascript.xml.impl.xmlbeans.**"/>
<rule pattern="com.intellij.**" result="kotlinc.internal.com.intellij.@1"/>
<rule pattern="com.sun.jna.**" result="kotlinc.internal.com.sun.jna.@1"/>
<rule pattern="org.apache.log4j.**" result="kotlinc.internal.org.apache.log4j.@1"/>
<rule pattern="org.jdom.**" result="kotlinc.internal.org.jdom.@1"/>
<rule pattern="JDOMAbout**" result="kotlinc.internal.org.jdom.JDOMAbout@1"/>
<rule pattern="org.intellij.lang.annotations.**" result="kotlinc.internal.org.intellij.lang.annotations.@1"/>
<rule pattern="org.jetbrains.annotations.**" result="kotlinc.internal.org.jetbrains.annotations.@1"/>
<rule pattern="com.google.**" result="kotlinc.internal.com.google.@1"/>
<rule pattern="org.objectweb.asm.**" result="kotlinc.internal.org.objectweb.asm.@1"/>
<rule pattern="com.sampullara.cli.**" result="kotlinc.internal.com.sampullara.cli.@1"/>
<rule pattern="org.picocontainer.**" result="kotlinc.internal.org.picocontainer.@1"/>
<rule pattern="gnu.trove.**" result="kotlinc.internal.gnu.trove.@1"/>
<rule pattern="javax.inject.**" result="kotlinc.internal.javax.inject.@1"/>
<rule pattern="com.intellij.**" result="org.jetbrains.jet.internal.com.intellij.@1"/>
<rule pattern="com.sun.jna.**" result="org.jetbrains.jet.internal.com.sun.jna.@1"/>
<rule pattern="org.apache.log4j.**" result="org.jetbrains.jet.internal.org.apache.log4j.@1"/>
<rule pattern="org.jdom.**" result="org.jetbrains.jet.internal.org.jdom.@1"/>
<rule pattern="JDOMAbout**" result="org.jetbrains.jet.internal.org.jdom.JDOMAbout@1"/>
<rule pattern="org.intellij.lang.annotations.**" result="org.jetbrains.jet.internal.org.intellij.lang.annotations.@1"/>
<rule pattern="com.google.**" result="org.jetbrains.jet.internal.com.google.@1"/>
<rule pattern="org.objectweb.asm.**" result="org.jetbrains.jet.internal.org.objectweb.asm.@1"/>
<rule pattern="com.sampullara.cli.**" result="org.jetbrains.jet.internal.com.sampullara.cli.@1"/>
<rule pattern="org.picocontainer.**" result="org.jetbrains.jet.internal.org.picocontainer.@1"/>
<rule pattern="gnu.trove.**" result="org.jetbrains.jet.internal.gnu.trove.@1"/>
<rule pattern="javax.inject.**" result="org.jetbrains.jet.internal.javax.inject.@1"/>
</jarjar>
<delete failonerror="false" dir="${output}/kotlin-compiler.exploded"/>
@@ -222,8 +140,8 @@
<delete file="${output}/kotlin-compiler-jarjar.jar"/>
<!-- Clean JarJar result -->
<delete file="${output}/kotlin-compiler-clean.jar" failonerror="false"/>
<jar jarfile="${output}/kotlin-compiler-clean.jar">
<delete file="${output}/kotlin-compiler-before-proguard.jar.jar" failonerror="false"/>
<jar jarfile="${output}/kotlin-compiler-before-proguard.jar.jar">
<fileset dir="${output}/kotlin-compiler.exploded">
<include name="**/*.class"/>
<include name="**/*.jet"/>
@@ -243,15 +161,15 @@
<attribute name="Main-Class" value="org.jetbrains.jet.cli.jvm.K2JVMCompiler"/>
</manifest>
</jar>
<delete dir="${output}/kotlin-compiler.exploded" />
<delete dir="${output}/kotlin-compiler.exploded"/>
<available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar" />
<available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar" />
<available property="rtjar" value="${java.home}/lib/rt.jar" file="${java.home}/lib/rt.jar"/>
<available property="rtjar" value="${java.home}/../Classes/classes.jar" file="${java.home}/../Classes/classes.jar"/>
<delete file="${output}/kotlin-compiler.jar" failonerror="false"/>
<delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/>
<proguard><![CDATA[
-injars '${output}/kotlin-compiler-clean.jar'
-outjars '${output}/kotlin-compiler.jar'
-injars '${output}/kotlin-compiler-before-proguard.jar.jar'
-outjars '${kotlin-home}/lib/kotlin-compiler.jar'
-libraryjars '${rtjar}'
@@ -259,30 +177,48 @@
-dontoptimize
-dontobfuscate
# Keep application classes, along with their 'main' methods.
-keepclasseswithmembers public class * {
public static void main(java.lang.String[]);
}
-keepclasseswithmembers class * {
# Various dynamically called methods
void start();
void stop();
void dispose();
** getFileSystem();
** isVarArgs();
** getApplication();
** finalizeReferent();
** newBuilder();
** startFinalizer(java.lang.Class,java.lang.Object);
** executeOnPooledThread(java.lang.Runnable);
** getUserData(java.lang.String);
int getBooleanAttributes(java.io.File);
<init>(kotlinc.internal.com.intellij.lang.ASTNode);
-keep class org.jetbrains.annotations.** {
public protected *;
}
# Keep the special static methods that are required in enumeration classes.
-keep class org.jetbrains.k2js.** {
public protected *;
}
-keep class org.jetbrains.jet.** {
public protected *;
}
-keep class jet.** {
public protected *;
}
-keepclasseswithmembers class * { void start(); }
-keepclasseswithmembers class * { void stop(); }
-keepclasseswithmembers class * { void dispose(); }
-keepclasseswithmembers class * { ** getFileSystem(); }
-keepclasseswithmembers class * { ** isVarArgs(); }
-keepclasseswithmembers class * { ** getApplication(); }
-keepclasseswithmembers class * { ** finalizeReferent(); }
-keepclasseswithmembers class * { ** newBuilder(); }
-keepclasseswithmembers class * { ** startFinalizer(java.lang.Class,java.lang.Object); }
-keepclasseswithmembers class * { ** executeOnPooledThread(java.lang.Runnable); }
-keepclasseswithmembers class * { ** getUserData(java.lang.String); }
-keepclasseswithmembers class * { int getBooleanAttributes(java.io.File); }
-keepclasseswithmembers class * { ** project(); }
-keepclasseswithmembers class * { ** TYPE; }
-keepclasseswithmembers class * { ** ourInstance; }
-keepclasseswithmembers class * { <init>(kotlinc.internal.com.intellij.lang.ASTNode); }
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
@@ -291,52 +227,111 @@
-keepclassmembers class * {
** toString();
** hashCode();
** project();
** TYPE;
** ourInstance;
}
]]></proguard>
<delete file="${output}/kotlin-compiler-clean.jar" />
<!--<delete file="${output}/kotlin-compiler-before-proguard.jar"/>-->
</target>
<target name="nojarjar" unless="nojarjar">
<jar destfile="${output}/kotlin-compiler.jar">
<fileset dir="${output}/classes/compiler"/>
<fileset dir="${output}/classes/runtime"/>
<fileset dir="${basedir}/compiler/frontend/src" includes="jet/**"/>
<target name="antTools">
<cleandir dir="${output}/classes/buildTools"/>
<javac destdir="${output}/classes/buildTools" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src>
<dirset dir="${basedir}/build-tools">
<include name="core/src"/>
<include name="ant/src"/>
</dirset>
</src>
<compilerarg value="-Xlint:all"/>
<classpath>
<fileset dir="${kotlin-home}/lib" includes="kotlin-compiler.jar"/>
<fileset dir="${basedir}/dependencies" includes="ant.jar"/>
</classpath>
</javac>
<jar destfile="${kotlin-home}/lib/kotlin-ant.jar">
<fileset dir="${output}/classes/buildTools"/>
<fileset dir="${basedir}/build-tools/ant/src" includes="**/*.xml"/>
</jar>
</target>
<target name="clean">
<delete dir="${output}"/>
<target name="jdkHeaders">
<cleandir dir="${output}/classes/stdlib"/>
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true">
<classpath>
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
</classpath>
<arg value="-src"/>
<arg value="${basedir}/jdk-headers/src"/>
<arg value="-output"/>
<arg value="${output}/classes/jdk-headers"/>
<arg value="-mode"/>
<arg value="jdkHeaders"/>
</java>
<jar destfile="${kotlin-home}/lib/alt/kotlin-jdk-headers.jar">
<fileset dir="${output}/classes/jdk-headers"/>
</jar>
</target>
<target name="copyKotlinJars">
<copy todir="${kotlin-home}/lib">
<fileset dir="${idea.sdk}/core" includes="*.jar"/>
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
</copy>
<copy todir="${kotlin-home}/lib/js">
<fileset dir="${basedir}/js/js.translator/lib" includes="**/*.jar"/>
</copy>
<copy todir="${kotlin-home}/bin">
<fileset dir="${basedir}/compiler/cli/bin"/>
</copy>
<chmod dir="${kotlin-home}/bin" includes="*" perm="755"/>
<target name="runtime">
<cleandir dir="${output}/classes/runtime"/>
<javac destdir="${output}/classes/runtime" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
<src path="${basedir}/runtime/src"/>
</javac>
<cleandir dir="${output}/classes/stdlib"/>
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true" fork="true">
<classpath>
<path refid="classpath"/>
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
</classpath>
<arg value="-src"/>
<arg value="${basedir}/libraries/stdlib/src"/>
<arg value="-output"/>
<arg value="${output}/classes/stdlib"/>
<arg value="-mode"/>
<arg value="stdlib"/>
<arg value="-classpath"/>
<arg value="${output}/classes/runtime"/>
</java>
<jar destfile="${kotlin-home}/lib/kotlin-runtime.jar">
<fileset dir="${output}/classes/runtime"/>
<fileset dir="${output}/classes/stdlib"/>
<fileset dir="${basedir}/runtime" includes="src/**/*"/>
<fileset dir="${basedir}/libraries/stdlib" includes="src/**/*"/>
</jar>
</target>
<target name="dist" depends="init,copyKotlinJars,jar,buildToolsJar,jarJDKHeaders,jarRT,jarLang,jarjar,nojarjar"/>
<target name="lang">
<cleandir dir="${output}/classes/lang"/>
<java classname="org.jetbrains.jet.cli.jvm.K2JVMCompiler" failonerror="true">
<classpath>
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
</classpath>
<arg value="-src"/>
<arg value="${basedir}/compiler/frontend/src"/>
<arg value="-output"/>
<arg value="${output}/classes/lang"/>
<arg value="-mode"/>
<arg value="builtins"/>
</java>
<target name="doc" depends="dist"/>
<!-- Not used yet -->
<!--
<jar destfile="${kotlin-home}/lib/lang.jar">
<fileset dir="${output}/classes/lang"/>
</jar>
-->
</target>
<target name="dist"
depends="init,prepareDist,injectorsGenerator,generateInjectors,compiler,antTools,jdkHeaders,runtime,lang"/>
<target name="zip" depends="dist">
<echo file="${kotlin-home}/build.txt" message="${build.number}"/>
<zip destfile="${output}/${output.name}.zip">
<zipfileset prefix="kotlinc" dir="${kotlin-home}"/>
<zipfileset prefix="kotlinc" file="${output}/build.txt"/>
<zipfileset prefix="kotlinc/license" dir="${basedir}/license"/>
<zipfileset prefix="kotlinc/bin" filemode="755" dir="${basedir}/compiler/cli/bin"/>
</zip>
</target>
</project>
@@ -39,18 +39,6 @@ if $cygwin; then
KOTLIN_HOME=`cygpath --unix "$KOTLIN_HOME"`
fi
# Constructing the extension classpath
TOOL_CLASSPATH=""
if [ -z "$TOOL_CLASSPATH" ] ; then
for ext in "$KOTLIN_HOME"/lib/* ; do
if [ -z "$TOOL_CLASSPATH" ] ; then
TOOL_CLASSPATH="$ext"
else
TOOL_CLASSPATH="$TOOL_CLASSPATH:$ext"
fi
done
fi
[ -n "$JAVA_OPTS" ] || JAVA_OPTS="-Xmx256M -Xms32M"
# break out -D and -J options and add them to JAVA_OPTS as well
@@ -69,7 +57,7 @@ while [ $# -gt 0 ]; do
shift
;;
-J*)
# as with -D, pass to scala even though it will almost
# as with -D, pass to kotlin even though it will almost
# never be used.
java_args=("${java_args[@]}" "${1:2}")
kotlin_args=("${kotlin_args[@]}" "$1")
@@ -94,5 +82,5 @@ CPSELECT="-cp "
"${JAVACMD:=java}" \
$JAVA_OPTS \
"${java_args[@]}" \
${CPSELECT}${TOOL_CLASSPATH} \
${CPSELECT}${KOTLIN_HOME}"/lib/kotlin-compiler.jar" \
org.jetbrains.jet.cli.jvm.K2JVMCompiler "$@"
@@ -21,26 +21,12 @@ if "%_JAVACMD%"=="" set _JAVACMD=java
rem We use the value of the JAVA_OPTS environment variable if defined
set _JAVA_OPTS=-Xmx256M -Xms32M
set _TOOL_CLASSPATH=
if "%_TOOL_CLASSPATH%"=="" (
for %%f in ("%_KOTLIN_HOME%\lib\*") do call :add_cpath "%%f"
for /d %%f in ("%_KOTLIN_HOME%\lib\*") do call :add_cpath "%%f"
)
"%_JAVACMD%" %_JAVA_OPTS% -cp "%_TOOL_CLASSPATH%" org.jetbrains.jet.cli.jvm.K2JVMCompiler %*
"%_JAVACMD%" %_JAVA_OPTS% -cp "%_KOTLIN_HOME%\lib\kotlin-compiler.jar" org.jetbrains.jet.cli.jvm.K2JVMCompiler %*
goto end
rem ##########################################################################
rem # subroutines
:add_cpath
if "%_TOOL_CLASSPATH%"=="" (
set _TOOL_CLASSPATH=%~1
) else (
set _TOOL_CLASSPATH=%_TOOL_CLASSPATH%;%~1
)
goto :eof
:set_home
set _BIN_DIR=
for %%i in (%~sf0) do set _BIN_DIR=%_BIN_DIR%%%~dpsi
@@ -29,12 +29,11 @@ import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import org.junit.ComparisonFailure;
import org.junit.Rule;
import org.junit.rules.TestRule;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import sun.misc.JarFilter;
import java.io.File;
import java.io.IOException;
@@ -74,13 +73,7 @@ public abstract class KotlinIntegrationTestBase {
protected int runCompiler(String logName, String... arguments) throws Exception {
final File lib = getCompilerLib();
final File[] jars = lib.listFiles(new JarFilter());
final String classpath = StringUtil.join(jars, new Function<File, String>() {
@Override
public String fun(File file) {
return file.getAbsolutePath();
}
}, File.pathSeparator);
final String classpath = lib.getAbsolutePath() + File.separator + "kotlin-compiler.jar";
Collection<String> javaArgs = new ArrayList<String>();
javaArgs.add("-cp");
@@ -122,10 +115,12 @@ public abstract class KotlinIntegrationTestBase {
final String goldContent = Files.toString(expectedFile, UTF_8);
try {
assertEquals(goldContent, content.toString());
}
finally {
tmpFile.delete();
}
catch (ComparisonFailure e) {
Files.write(content, tmpFile, Charsets.UTF_8);
throw e;
}
}
}
@@ -17,7 +17,6 @@
package org.jetbrains.jet.plugin.compiler;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.intellij.compiler.impl.javaCompiler.OutputItemImpl;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompilerMessageCategory;
@@ -57,21 +56,6 @@ public final class CompilerUtils {
private CompilerUtils() {
}
private static List<File> getJarsInDirectory(File dir) {
List<File> r = Lists.newArrayList();
File[] files = dir.listFiles();
if (files != null) {
for (File jar : files) {
if (jar.isFile() && jar.getName().endsWith(".jar")) {
r.add(jar);
}
}
}
return r;
}
public static List<File> kompilerClasspath(File kotlinHome, CompileContext context) {
File libs = new File(kotlinHome, "lib");
@@ -81,10 +65,8 @@ public final class CompilerUtils {
return Collections.emptyList();
}
ArrayList<File> answer = new ArrayList<File>();
answer.addAll(getJarsInDirectory(libs));
answer.addAll(getJarsInDirectory(new File(libs, "guice"))); // TODO: flatten at artifact build
answer.add(new File(libs, "kotlin-compiler.jar"));
return answer;
}
+3 -3
View File
@@ -22,12 +22,12 @@
<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<artifactId>kdoc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kdoc</artifactId>
<artifactId>kotlin-maven-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
@@ -35,8 +35,8 @@
<artifactId>pegdown</artifactId>
<version>${pegdown.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
+1 -1
View File
@@ -23,7 +23,7 @@
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-maven-plugin</artifactId>
<artifactId>kotlin-compiler</artifactId>
<version>${project.version}</version>
</dependency>
@@ -12,7 +12,7 @@ import java.util.List
import java.util.HashSet
import java.util.*
import com.intellij.psi.PsiElement
import org.jetbrains.jet.internal.com.intellij.psi.PsiElement
import org.jetbrains.jet.lang.resolve.BindingContext
import org.jetbrains.jet.lang.resolve.BindingContext.*
import org.jetbrains.jet.cli.common.CompilerPlugin
@@ -12,7 +12,7 @@ import java.util.List
import java.util.HashSet
import java.util.Collection
import com.intellij.psi.PsiElement
import org.jetbrains.jet.internal.com.intellij.psi.PsiElement
import org.jetbrains.jet.lang.resolve.BindingContext
import org.jetbrains.jet.lang.resolve.BindingContext.*
import org.jetbrains.jet.cli.common.CompilerPlugin
@@ -1,10 +1,10 @@
package org.jetbrains.kotlin.doc.highlighter
import com.intellij.psi.PsiFile
import org.jetbrains.jet.internal.com.intellij.psi.PsiFile
import org.jetbrains.jet.lang.psi.*
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiWhiteSpace
import com.intellij.psi.PsiComment
import org.jetbrains.jet.internal.com.intellij.psi.PsiElement
import org.jetbrains.jet.internal.com.intellij.psi.PsiWhiteSpace
import org.jetbrains.jet.internal.com.intellij.psi.PsiComment
class HtmlKotlinVisitor: JetTreeVisitor<StringBuilder>() {
@@ -1,8 +1,8 @@
package org.jetbrains.kotlin.doc.highlighter
import com.intellij.psi.*
import com.intellij.psi.tree.IElementType
import com.intellij.psi.tree.TokenSet
import org.jetbrains.jet.internal.com.intellij.psi.*
import org.jetbrains.jet.internal.com.intellij.psi.tree.IElementType
import org.jetbrains.jet.internal.com.intellij.psi.tree.TokenSet
import java.util.HashMap
import java.util.Map
import kotlin.template.HtmlFormatter
@@ -35,14 +35,15 @@ import org.jetbrains.kotlin.doc.templates.KDocTemplate
import org.jetbrains.jet.lang.resolve.scopes.WritableScopeImpl
import org.jetbrains.jet.lang.descriptors.Visibility
import org.jetbrains.jet.lang.descriptors.ClassKind
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiFile
import com.intellij.psi.PsiDirectory
import org.jetbrains.jet.internal.com.intellij.psi.PsiElement
import org.jetbrains.jet.internal.com.intellij.psi.PsiFile
import org.jetbrains.jet.internal.com.intellij.psi.PsiDirectory
import org.jetbrains.jet.lang.descriptors.Visibilities
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils
import org.jetbrains.jet.lang.diagnostics.DiagnosticUtils.LineAndColumn
import com.intellij.psi.PsiFileSystemItem
import org.jetbrains.jet.internal.com.intellij.psi.PsiFileSystemItem
import java.io.File
import org.jetbrains.jet.internal.com.intellij.psi.PsiElement
/**
+1 -97
View File
@@ -19,7 +19,7 @@
<artifactId>kotlin-install</artifactId>
<packaging>pom</packaging>
<description>Installs the Kotlin runtime dependencies into the local maven repo</description>
<description>Installs and deploys the Kotlin compiler</description>
<build>
<plugins>
@@ -43,102 +43,6 @@
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>org.jetbrains.kotlin:kotlin-build-tools</id>
<phase>verify</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-build-tools</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<file>${kotlin-sdk}/lib/kotlin-build-tools.jar</file>
<createChecksum>true</createChecksum>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>org.jetbrains.kotlin:intellij-core</id>
<phase>verify</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>intellij-core</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<file>${kotlin-sdk}/lib/intellij-core.jar</file>
<createChecksum>true</createChecksum>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>org.jetbrains.kotlin:intellij-annotations</id>
<phase>verify</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>intellij-annotations</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<file>${kotlin-sdk}/lib/annotations.jar</file>
<createChecksum>true</createChecksum>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>org.jetbrains.kotlin:trove4j</id>
<phase>verify</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>trove4j</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<file>${kotlin-sdk}/lib/trove4j.jar</file>
<createChecksum>true</createChecksum>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>org.jetbrains.kotlin:picocontainer</id>
<phase>verify</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>picocontainer</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<file>${kotlin-sdk}/lib/picocontainer.jar</file>
<createChecksum>true</createChecksum>
<generatePom>true</generatePom>
</configuration>
</execution>
<execution>
<id>org.jetbrains.kotlin:dartc</id>
<phase>verify</phase>
<goals>
<goal>install-file</goal>
</goals>
<configuration>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>dartc</artifactId>
<version>${project.version}</version>
<packaging>jar</packaging>
<file>${kotlin-sdk}/lib/js/${dart.name}.jar</file>
<createChecksum>true</createChecksum>
<generatePom>true</generatePom>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
+1 -115
View File
@@ -25,102 +25,13 @@
<artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version>
</dependency>
<!--
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>${maven.version}</version>
</dependency>
-->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-compiler</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-runtime</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>intellij-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>intellij-annotations</artifactId>
<version>${project.version}</version>
</dependency>
<!-- TODO Req. only for K2JSTranslator, move it to compiler -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-build-tools</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Shall be transitive dependencies of Kotlin compiler -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-tree</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm-util</artifactId>
<version>${asm.version}</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<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>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>
-->
<!-- for JS generation -->
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>dartc</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<testSourceDirectory>src/test/java</testSourceDirectory>
@@ -144,31 +55,6 @@
<artifactId>maven-plugin-plugin</artifactId>
<version>2.9</version>
</plugin>
<!-- Get rid of it right after compiler careful packaging -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>org.jetbrains.kotlin:*</include>
</includes>
<excludes>
<exclude>org.jetbrains.kotlin:stdlib</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -17,7 +17,7 @@
package org.jetbrains.kotlin.maven;
import com.google.common.io.Files;
import com.intellij.openapi.project.Project;
import org.jetbrains.jet.internal.com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.jet.cli.common.CompilerPlugin;
import org.jetbrains.jet.cli.common.CompilerPluginContext;
@@ -28,7 +28,6 @@ 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;
+11
View File
@@ -32,6 +32,17 @@
<get src="http://teamcity.jetbrains.com/guestAuth/repository/download/bt351/.lastPinned/plugin-verifier-1.0-SNAPSHOT.jar"
dest="dependencies/download/plugin-verifier-1.0-SNAPSHOT.jar" usetimestamp="true"/>
<copy file="dependencies/download/plugin-verifier-1.0-SNAPSHOT.jar" tofile="dependencies/plugin-verifier.jar" overwrite="true" />
<!-- ant 1.7.0 -->
<get src="http://archive.apache.org/dist/ant/binaries/apache-ant-1.7.0-bin.tar.gz"
dest="dependencies/download/apache-ant-1.7.0-bin.tar.gz" usetimestamp="true" />
<delete file="dependencies/ant.jar" failonerror="false"/>
<untar src="dependencies/download/apache-ant-1.7.0-bin.tar.gz" dest="dependencies" compression="gzip">
<patternset>
<include name="apache-ant-1.7.0/lib/ant.jar"/>
</patternset>
<mapper type="flatten"/>
</untar>
</target>
<macrodef name="execute_update">