302 lines
11 KiB
XML
302 lines
11 KiB
XML
<project name="Kotlin" default="dist">
|
|
|
|
<property name="output" value="${basedir}/dist"/>
|
|
<property name="kotlin-home" value="${output}/kotlinc"/>
|
|
<property name="build.number" value="snapshot"/>
|
|
<property name="output.name" value="kotlin-${build.number}"/>
|
|
<property name="idea.sdk" value="${basedir}/ideaSDK"/>
|
|
|
|
<import file="build-tools/build.xml" optional="false"/>
|
|
|
|
|
|
<path id="classpath">
|
|
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
|
|
<fileset dir="${basedir}/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>
|
|
</path>
|
|
|
|
<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>
|
|
|
|
<target name="compileStdlib" depends="jar">
|
|
<mkdir dir="${output}/classes/stdlib"/>
|
|
<java classname="org.jetbrains.jet.cli.KotlinCompiler" 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"/>
|
|
</java>
|
|
</target>
|
|
|
|
<!--
|
|
<target name="compileKunit" depends="jarRT">
|
|
<mkdir dir="${output}/classes/kunit"/>
|
|
<java classname="org.jetbrains.jet.cli.KotlinCompiler" failonerror="true" fork="true">
|
|
<classpath>
|
|
<path refid="classpath"/>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
<arg value="-stdlib"/>
|
|
<arg value="${kotlin-home}/lib/kotlin-runtime.jar"/>
|
|
<arg value="-src"/>
|
|
<arg value="${basedir}/kunit/src/main/kotlin"/>
|
|
<arg value="-output"/>
|
|
<arg value="${output}/classes/kunit"/>
|
|
<arg value="-module"/>
|
|
<arg value="${basedir}/kunit/module.kt"/>
|
|
</java>
|
|
<jar destfile="${kotlin-home}/lib/kotlin-test.jar">
|
|
<fileset dir="${output}/classes/kunit"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="compileKdoc">
|
|
<mkdir dir="${output}/classes/kdoc"/>
|
|
<java classname="org.jetbrains.jet.cli.KotlinCompiler" failonerror="true" fork="true">
|
|
<classpath>
|
|
<path refid="classpath"/>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
<arg value="-stdlib"/>
|
|
<arg value="${kotlin-home}/lib/kotlin-runtime.jar"/>
|
|
<arg value="-src"/>
|
|
<arg value="${basedir}/kdoc/src/main/kotlin"/>
|
|
<arg value="-output"/>
|
|
<arg value="${output}/classes/kdoc"/>
|
|
<arg value="-module"/>
|
|
<arg value="${basedir}/kdoc/module.kt"/>
|
|
</java>
|
|
<jar destfile="${kotlin-home}/lib/kotlin-doc.jar">
|
|
<fileset dir="${output}/classes/kdoc"/>
|
|
</jar>
|
|
</target>
|
|
-->
|
|
|
|
<!--
|
|
<target name="docStdlib" depends="compileKdoc">
|
|
<mkdir dir="${output}/classes/stdlib"/>
|
|
<mkdir dir="${output}/apidoc/stdlib"/>
|
|
<java classname="org.jetbrains.jet.cli.KotlinCompiler" failonerror="true" fork="true">
|
|
<classpath>
|
|
<path refid="classpath"/>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<pathelement location="${output}/classes/kdoc"/>
|
|
<!- - TODO Dirty Hack until kdoc jar has stdlib inside it -->
|
|
<!--
|
|
<pathelement location="${output}/classes/stdlib"/>
|
|
</classpath>
|
|
<arg value="-output"/>
|
|
<arg value="${output}/classes/apidoc"/>
|
|
<arg value="-docOutput"/>
|
|
<arg value="${output}/apidoc/stdlib"/>
|
|
<arg value="-module"/>
|
|
<arg value="${basedir}/kdoc/ApiDocsModule.kt"/>
|
|
</java>
|
|
|
|
<fail message="No stdlib API docs generated.">
|
|
<condition>
|
|
<not>
|
|
<resourcecount count="1">
|
|
<fileset id="fs" dir="${output}/apidoc/stdlib" includes="index.html"/>
|
|
</resourcecount>
|
|
</not>
|
|
</condition>
|
|
</fail>
|
|
</target>
|
|
|
|
<target name="compileTestlib" depends="compileKunit">
|
|
<mkdir dir="${output}/classes/testlib"/>
|
|
<java classname="org.jetbrains.jet.cli.KotlinCompiler" failonerror="true" fork="true">
|
|
<classpath>
|
|
<path refid="classpath"/>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
<arg value="-stdlib"/>
|
|
<arg value="${kotlin-home}/lib/kotlin-runtime.jar"/>
|
|
<arg value="-src"/>
|
|
<arg value="${basedir}/testlib/test"/>
|
|
<arg value="-output"/>
|
|
<arg value="${output}/classes/testlib"/>
|
|
<arg value="-module"/>
|
|
<arg value="${basedir}/testlib/module.kt"/>
|
|
</java>
|
|
</target>
|
|
|
|
<target name="generateStdlib" depends="compileTestlib" description="Generates the stdlib APIs for arrays and kotlin collections">
|
|
<java classname="org.jetbrains.kotlin.tools.namespace" failonerror="true" fork="true">
|
|
<classpath>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-runtime.jar"/>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-test.jar"/>
|
|
<pathelement location="/libraries/testlib/lib/junit-4.9.jar"/>
|
|
<fileset dir="/libraries/testlib/lib">
|
|
<include name="**/*.jar"/>
|
|
</fileset>
|
|
<pathelement path="${output}/classes/testlib"/>
|
|
</classpath>
|
|
</java>
|
|
</target>
|
|
|
|
<target name="testlib" depends="compileTestlib">
|
|
<mkdir dir="${output}/test-reports"/>
|
|
|
|
<junit printsummary="yes" haltonfailure="true">
|
|
<classpath>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-runtime.jar"/>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-test.jar"/>
|
|
<pathelement location="/libraries/testlib/lib/junit-4.9.jar"/>
|
|
<fileset dir="/libraries/testlib/lib">
|
|
<include name="**/*.jar"/>
|
|
</fileset>
|
|
<pathelement path="${output}/classes/testlib"/>
|
|
</classpath>
|
|
|
|
<formatter type="plain"/>
|
|
|
|
<!- -
|
|
<test name="my.test.TestCase" haltonfailure="no" outfile="result">
|
|
<formatter type="xml"/>
|
|
</test>
|
|
-->
|
|
<!--
|
|
<batchtest fork="yes" todir="${output}/test-reports" haltonerror="true">
|
|
<fileset dir="${output}/classes/testlib">
|
|
<include name="**/*Test.*"/>
|
|
</fileset>
|
|
</batchtest>
|
|
</junit>
|
|
</target>
|
|
!-->
|
|
|
|
<target name="compileJDKHeaders" depends="jar">
|
|
<mkdir dir="${output}/classes/stdlib"/>
|
|
<java classname="org.jetbrains.jet.cli.KotlinCompiler" 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="-stubs"/>
|
|
<arg value="-transformNamesToJava"/>
|
|
</java>
|
|
</target>
|
|
|
|
<target name="compileLang" depends="jar">
|
|
<mkdir dir="${output}/classes/lang"/>
|
|
<java classname="org.jetbrains.jet.cli.KotlinCompiler" 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="-stubs"/>
|
|
</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"/>
|
|
</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="compile" depends="compileRT">
|
|
<mkdir 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="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="clean">
|
|
<delete dir="${output}"/>
|
|
</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}/bin">
|
|
<fileset dir="${basedir}/compiler/cli/bin"/>
|
|
</copy>
|
|
<chmod dir="${kotlin-home}/bin" includes="*" perm="755"/>
|
|
</target>
|
|
|
|
<target name="dist" depends="init,jarRT,copyKotlinJars,jarJDKHeaders,jarLang,jar,buildToolsJar"/>
|
|
|
|
<target name="doc" depends="dist"/>
|
|
|
|
<!--
|
|
<target name="test" depends="dist" description="Creates the distribution and runs all the tests"/>
|
|
-->
|
|
|
|
<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"/>
|
|
<zipfileset prefix="kotlinc/examples" dir="${basedir}/examples/src"/>
|
|
</zip>
|
|
</target>
|
|
</project>
|