mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-03-10 08:31:29 +00:00
Generated tests depend on the annotations from the `tests-common` module. Testing utils from test root of the `incremental-compilation-impl` module are also used in Gradle tests, so the test root is built in the ant build too. However building `tests-common` separately from the compiler is complicated, so I decided to exclude generated tests from 'kotlin-build-common-test.jar'.
1028 lines
48 KiB
XML
1028 lines
48 KiB
XML
<project xmlns:if="ant:if" xmlns:unless="ant:unless" name="Kotlin" default="dist">
|
|
<import file="common.xml" optional="false"/>
|
|
<property file="resources/kotlinManifest.properties"/>
|
|
|
|
<!-- Set to false to disable proguard run on kotlin-compiler.jar. Speeds up the build -->
|
|
<property name="shrink" value="true"/>
|
|
|
|
<property name="max.heap.size.for.forked.jvm" value="1024m"/>
|
|
|
|
<property name="bootstrap.home" value="${basedir}/dependencies/bootstrap-compiler"/>
|
|
<property name="bootstrap.compiler.home" value="${bootstrap.home}/Kotlin/kotlinc"/>
|
|
<property name="bootstrap.runtime" value="${bootstrap.compiler.home}/lib/kotlin-stdlib.jar"/>
|
|
<property name="bootstrap.reflect" value="${bootstrap.compiler.home}/lib/kotlin-reflect.jar"/>
|
|
<property name="bootstrap.script.runtime" value="${bootstrap.compiler.home}/lib/kotlin-script-runtime.jar"/>
|
|
<property name="bootstrap.kotlin.test" value="${bootstrap.compiler.home}/lib/kotlin-test.jar" />
|
|
|
|
<property name="kotlin-home" value="${output}/kotlinc"/>
|
|
<property name="build.number" value="snapshot"/>
|
|
<property name="bootstrap.build.no.tests" value="false"/>
|
|
<property name="idea.sdk" value="${basedir}/ideaSDK"/>
|
|
<property name="protobuf.jar" value="${basedir}/dependencies/protobuf-2.6.1.jar"/>
|
|
<property name="javax.inject.jar" value="${basedir}/lib/javax.inject.jar"/>
|
|
<property name="gradle.logging.level" value=""/>
|
|
|
|
<property environment="env"/>
|
|
<property name="tools.jar" value="${env.JDK_18}/lib/tools.jar"/>
|
|
|
|
<property name="java.target" value="1.8"/>
|
|
|
|
<condition property="bootstrap.or.local.build" value="true" else="false">
|
|
<or>
|
|
<istrue value="${bootstrap.build.no.tests}"/>
|
|
<not>
|
|
<isset property="teamcity.version"/>
|
|
</not>
|
|
</or>
|
|
</condition>
|
|
|
|
<!--
|
|
The compiler produced on the first step of the build (Bootstrap No Tests) is only guaranteed to work against the OLD runtime
|
|
located in dependencies/bootstrap-compiler/.../kotlin-stdlib.jar, because the newly built compiler is just a Kotlin application,
|
|
compiled by the old compiler with the old runtime in classpath. If you advance the ABI version, the newly built compiler will NOT work
|
|
against the runtime it will produce on its own because they have different ABI versions.
|
|
So on the first step of bootstrap we copy that runtime to kotlin-stdlib-internal-bootstrap.jar (see 'prepare-dist' target) and change
|
|
the compiler classpath accordingly. On the second step this is believed to be not required, because there are
|
|
little to no differences between the new and the newest runtime.
|
|
-->
|
|
<condition property="compiler.manifest.class.path"
|
|
value="kotlin-stdlib-internal-bootstrap.jar kotlin-reflect-internal-bootstrap.jar kotlin-script-runtime-internal-bootstrap.jar"
|
|
else="kotlin-stdlib.jar kotlin-reflect.jar kotlin-script-runtime.jar">
|
|
<istrue value="${bootstrap.or.local.build}"/>
|
|
</condition>
|
|
|
|
<path id="classpath">
|
|
<file file="${bootstrap.runtime}"/>
|
|
<file file="${bootstrap.kotlin.test}" />
|
|
<file file="${bootstrap.reflect}"/>
|
|
<file file="${bootstrap.script.runtime}"/>
|
|
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
|
|
<pathelement location="${protobuf.jar}"/>
|
|
<pathelement location="${tools.jar}"/>
|
|
|
|
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
|
|
<fileset dir="${dependencies}" includes="jline3.jar"/>
|
|
<fileset dir="${dependencies}" includes="jansi.jar"/>
|
|
<fileset dir="${dependencies}" includes="javaslang-2.0.6.jar"/>
|
|
<fileset dir="${dependencies}" includes="json-org.jar"/>
|
|
<fileset dir="${dependencies}" includes="kotlinx-coroutines-core.jar"/>
|
|
<fileset dir="${basedir}/ideaSDK/jps" includes="jps-model.jar"/>
|
|
</path>
|
|
|
|
<typedef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${bootstrap.compiler.home}/lib/kotlin-ant.jar"/>
|
|
|
|
<path id="javac2.classpath">
|
|
<pathelement location="${idea.sdk}/lib/javac2.jar"/>
|
|
<pathelement location="${idea.sdk}/lib/asm-all.jar"/>
|
|
</path>
|
|
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath" loaderref="javac2.loader"/>
|
|
<typedef name="skip" classname="com.intellij.ant.ClassFilterAnnotationRegexp" classpathref="javac2.classpath" loaderref="javac2.loader"/>
|
|
|
|
<dirset id="compilerSources.dirset" dir="${basedir}/">
|
|
<include name="core/descriptor.loader.java/src"/>
|
|
<include name="core/descriptors/src"/>
|
|
<include name="core/deserialization/src"/>
|
|
<include name="core/util.runtime/src"/>
|
|
<include name="compiler/backend/src"/>
|
|
<include name="compiler/backend-common/src"/>
|
|
<include name="compiler/ir/backend.common/src"/>
|
|
<include name="compiler/ir/backend.jvm/src"/>
|
|
<include name="compiler/ir/ir.psi2ir/src"/>
|
|
<include name="compiler/ir/ir.tree/src"/>
|
|
<include name="compiler/builtins-serializer/src"/>
|
|
<include name="compiler/javac-wrapper/src"/>
|
|
<include name="compiler/cli/src"/>
|
|
<include name="compiler/cli/cli-common/src"/>
|
|
<include name="compiler/conditional-preprocessor/src/"/>
|
|
<include name="compiler/container/src"/>
|
|
<include name="compiler/frontend/src"/>
|
|
<include name="compiler/resolution/src"/>
|
|
<include name="compiler/frontend.java/src"/>
|
|
<include name="compiler/light-classes/src"/>
|
|
<include name="compiler/plugin-api/src"/>
|
|
<include name="compiler/daemon/src"/>
|
|
<include name="compiler/daemon/daemon-common/src"/>
|
|
<include name="compiler/frontend.script/src"/>
|
|
<include name="build-common/src"/>
|
|
<include name="compiler/incremental-compilation-impl/src"/>
|
|
<include name="compiler/serialization/src"/>
|
|
<include name="compiler/util/src"/>
|
|
<include name="js/js.ast/src"/>
|
|
<include name="js/js.translator/src"/>
|
|
<include name="js/js.frontend/src"/>
|
|
<include name="js/js.inliner/src"/>
|
|
<include name="js/js.parser/src"/>
|
|
<include name="js/js.serializer/src"/>
|
|
<include name="js/js.dce/src"/>
|
|
<include name="plugins/annotation-collector/src"/>
|
|
</dirset>
|
|
|
|
<property name="idea.out" value="${basedir}/out/production"/>
|
|
<patternset id="compilerClassesFromIDEA.fileset">
|
|
<include name="frontend/**"/>
|
|
<include name="resolution/**"/>
|
|
<include name="container/**"/>
|
|
<include name="descriptors/**"/>
|
|
<include name="deserialization/**"/>
|
|
<include name="serialization/**"/>
|
|
<include name="descriptor.loader.java/**"/>
|
|
<include name="frontend.java/**"/>
|
|
<include name="backend/**"/>
|
|
<include name="backend-common/**"/>
|
|
<include name="backend.common/**"/>
|
|
<include name="backend.jvm/**"/>
|
|
<include name="ir.psi2ir/**"/>
|
|
<include name="ir.tree/**"/>
|
|
<include name="cli/**"/>
|
|
<include name="cli-common/**"/>
|
|
<include name="conditional-preprocessor/**"/>
|
|
<include name="daemon/**"/>
|
|
<include name="daemon-common/**"/>
|
|
<include name="frontend.script/**"/>
|
|
<include name="build-common/**"/>
|
|
<include name="incremental-compilation-impl/**"/>
|
|
<include name="util/**"/>
|
|
<include name="util.runtime/**"/>
|
|
<include name="light-classes/**"/>
|
|
<include name="plugin-api/**"/>
|
|
<include name="annotation-collector/**"/>
|
|
<include name="builtins-serializer/**"/>
|
|
<include name="javac-wrapper/**"/>
|
|
<include name="js.ast/**"/>
|
|
<include name="js.translator/**"/>
|
|
<include name="js.frontend/**"/>
|
|
<include name="js.inliner/**"/>
|
|
<include name="js.parser/**"/>
|
|
<include name="js.serializer/**"/>
|
|
<include name="js.dce/**"/>
|
|
<exclude name="**/META-INF/services/**"/>
|
|
</patternset>
|
|
|
|
<path id="compilerSources.path">
|
|
<dirset refid="compilerSources.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="clean_idea_output">
|
|
<delete dir="${basedir}/out"/>
|
|
</target>
|
|
|
|
<target name="init">
|
|
<mkdir dir="${kotlin-home}"/>
|
|
<mkdir dir="${kotlin-home}/lib"/>
|
|
|
|
<fail unless="env.JDK_16" message="JDK_16 environment variable is not set."/>
|
|
<fail unless="env.JDK_18" message="JDK_18 environment variable is not set."/>
|
|
</target>
|
|
|
|
<target name="prepare-dist">
|
|
<copy todir="${kotlin-home}/bin">
|
|
<fileset dir="${basedir}/compiler/cli/bin"/>
|
|
</copy>
|
|
<fixcrlf srcdir="${kotlin-home}/bin" excludes="**/*.bat" eol="unix"/>
|
|
|
|
<copy todir="${kotlin-home}/license">
|
|
<fileset dir="${basedir}/license"/>
|
|
</copy>
|
|
|
|
<echo file="${kotlin-home}/build.txt" message="${build.number}"/>
|
|
|
|
<chmod dir="${kotlin-home}/bin" excludes="**/*.bat" perm="755"/>
|
|
|
|
<sequential if:true="${bootstrap.or.local.build}">
|
|
<copy file="${bootstrap.runtime}" tofile="${kotlin-home}/lib/kotlin-stdlib-internal-bootstrap.jar"/>
|
|
<copy file="${bootstrap.reflect}" tofile="${kotlin-home}/lib/kotlin-reflect-internal-bootstrap.jar"/>
|
|
<copy file="${bootstrap.script.runtime}" tofile="${kotlin-home}/lib/kotlin-script-runtime-internal-bootstrap.jar"/>
|
|
<copy file="${bootstrap.kotlin.test}" tofile="${kotlin-home}/lib/kotlin-test-internal-bootstrap.jar" failonerror="false"/>
|
|
<jar destfile="${kotlin-home}/lib/kotlin-reflect-internal-bootstrap.jar" update="true">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="kotlin-stdlib-internal-bootstrap.jar"/>
|
|
</manifest>
|
|
</jar>
|
|
<jar destfile="${kotlin-home}/lib/kotlin-test-internal-bootstrap.jar" update="true">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="kotlin-stdlib-internal-bootstrap.jar"/>
|
|
</manifest>
|
|
</jar>
|
|
</sequential>
|
|
|
|
<sequential unless:true="${bootstrap.or.local.build}">
|
|
<copy file="${bootstrap.runtime}" todir="${kotlin-home}/lib"/>
|
|
<copy file="${bootstrap.reflect}" todir="${kotlin-home}/lib"/>
|
|
<copy file="${bootstrap.script.runtime}" todir="${kotlin-home}/lib"/>
|
|
<copy file="${bootstrap.kotlin.test}" todir="${kotlin-home}/lib"/>
|
|
</sequential>
|
|
</target>
|
|
|
|
<target name="copy-dist-to-bootstrap">
|
|
<delete dir="${basedir}/dependencies/bootstrap-compiler/Kotlin/kotlinc" />
|
|
<copy todir="${basedir}/dependencies/bootstrap-compiler/Kotlin/kotlinc">
|
|
<fileset dir="${basedir}/dist/kotlinc" />
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="copy-bootstrap-to-dist"
|
|
depends="clean"
|
|
description="Use bootstrap compiler instead of building one from sources">
|
|
<mkdir dir="${kotlin-home}"/>
|
|
<copy todir="${kotlin-home}">
|
|
<fileset dir="${bootstrap.compiler.home}"/>
|
|
</copy>
|
|
</target>
|
|
|
|
<target name="compiler-sources">
|
|
<jar jarfile="${output}/kotlin-compiler-sources.jar">
|
|
<!-- TODO How to convert it from pathset or dirset ? -->
|
|
<fileset dir="core/descriptor.loader.java/src"/>
|
|
<fileset dir="core/descriptors/src"/>
|
|
<fileset dir="core/deserialization/src"/>
|
|
<fileset dir="core/util.runtime/src"/>
|
|
<fileset dir="compiler/backend/src"/>
|
|
<fileset dir="compiler/backend-common/src"/>
|
|
<fileset dir="compiler/ir/backend.common/src"/>
|
|
<fileset dir="compiler/ir/backend.jvm/src"/>
|
|
<fileset dir="compiler/ir/ir.psi2ir/src"/>
|
|
<fileset dir="compiler/ir/ir.tree/src"/>
|
|
<fileset dir="compiler/builtins-serializer/src"/>
|
|
<fileset dir="compiler/javac-wrapper/src"/>
|
|
<fileset dir="compiler/cli/src"/>
|
|
<fileset dir="compiler/cli/cli-common/src"/>
|
|
<fileset dir="compiler/conditional-preprocessor/src"/>
|
|
<fileset dir="compiler/daemon/src"/>
|
|
<fileset dir="compiler/daemon/daemon-common/src"/>
|
|
<fileset dir="build-common/src"/>
|
|
<fileset dir="compiler/incremental-compilation-impl/src"/>
|
|
<fileset dir="compiler/container/src"/>
|
|
<fileset dir="compiler/frontend/src"/>
|
|
<fileset dir="compiler/resolution/src"/>
|
|
<fileset dir="compiler/frontend.java/src"/>
|
|
<fileset dir="compiler/light-classes/src"/>
|
|
<fileset dir="compiler/frontend.script/src"/>
|
|
<fileset dir="compiler/plugin-api/src"/>
|
|
<fileset dir="plugins/annotation-collector/src"/>
|
|
<fileset dir="compiler/serialization/src"/>
|
|
<fileset dir="compiler/util/src"/>
|
|
<fileset dir="js/js.ast/src"/>
|
|
<fileset dir="js/js.translator/src"/>
|
|
<fileset dir="js/js.frontend/src"/>
|
|
<fileset dir="js/js.inliner/src"/>
|
|
<fileset dir="js/js.parser/src"/>
|
|
<fileset dir="js/js.serializer/src"/>
|
|
<fileset dir="js/js.dce/src"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.compiler.sources}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="preloader">
|
|
<cleandir dir="${output}/classes/preloader"/>
|
|
<javac destdir="${output}/classes/preloader" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
|
source="1.6" target="1.6">
|
|
<src location="${basedir}/compiler/preloader/src"/>
|
|
</javac>
|
|
|
|
<jar jarfile="${kotlin-home}/lib/kotlin-preloader.jar">
|
|
<fileset dir="${output}/classes/preloader"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="Kotlin Preloader"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
<attribute name="Main-Class" value="org.jetbrains.kotlin.preloading.Preloader"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="runner">
|
|
<cleandir dir="${output}/classes/runner"/>
|
|
<kotlinc output="${output}/classes/runner">
|
|
<src location="${basedir}/compiler/cli/cli-runner/src"/>
|
|
<compilerarg line="-jvm-target 1.6"/>
|
|
<compilerarg value="-jdk-home"/>
|
|
<compilerarg value="${env.JDK_16}"/>
|
|
</kotlinc>
|
|
|
|
<local name="runtime.jar"/>
|
|
<condition property="runtime.jar" value="kotlin-stdlib-internal-bootstrap.jar" else="kotlin-stdlib.jar">
|
|
<istrue value="${bootstrap.or.local.build}"/>
|
|
</condition>
|
|
|
|
<jar jarfile="${kotlin-home}/lib/kotlin-runner.jar">
|
|
<fileset dir="${output}/classes/runner"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="Kotlin Runner"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
<attribute name="Main-Class" value="org.jetbrains.kotlin.runner.Main"/>
|
|
<attribute name="Class-Path" value="${runtime.jar}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="serialize-builtins">
|
|
<cleandir dir="${output}/builtins"/>
|
|
<java classname="org.jetbrains.kotlin.preloading.Preloader"
|
|
classpath="${bootstrap.compiler.home}/lib/kotlin-preloader.jar"
|
|
failonerror="true"
|
|
fork="true"
|
|
maxmemory="${max.heap.size.for.forked.jvm}">
|
|
<assertions>
|
|
<enable/>
|
|
</assertions>
|
|
<arg value="-cp"/>
|
|
<arg value="${bootstrap.compiler.home}/lib/kotlin-compiler.jar"/>
|
|
<arg value="org.jetbrains.kotlin.serialization.builtins.RunKt"/>
|
|
<arg value="${output}/builtins"/>
|
|
<arg value="core/builtins/native"/>
|
|
<arg value="core/builtins/src"/>
|
|
</java>
|
|
</target>
|
|
|
|
<macrodef name="pack-compiler">
|
|
<attribute name="jarfile"/>
|
|
<attribute name="compress" default="true"/>
|
|
|
|
<sequential>
|
|
<jar jarfile="@{jarfile}" compress="@{compress}" duplicate="preserve">
|
|
<fileset dir="${output}/classes/compiler"/>
|
|
<fileset dir="${output}/builtins">
|
|
<include name="kotlin/**"/>
|
|
</fileset>
|
|
<fileset dir="${basedir}/core/deserialization/src" includes="META-INF/services/**"/>
|
|
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="META-INF/services/**"/>
|
|
<fileset dir="${basedir}/compiler/frontend.java/src" includes="META-INF/services/**"/>
|
|
<fileset dir="${basedir}/compiler/backend/src" includes="META-INF/services/**"/>
|
|
<fileset dir="${basedir}/compiler/cli/src" includes="META-INF/services/**"/>
|
|
<fileset dir="${basedir}/resources" includes="kotlinManifest.properties"/>
|
|
|
|
<fileset dir="idea/src">
|
|
<include name="META-INF/extensions/common.xml"/>
|
|
<include name="META-INF/extensions/kotlin2jvm.xml"/>
|
|
<include name="META-INF/extensions/kotlin2js.xml"/>
|
|
</fileset>
|
|
|
|
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/annotations.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/asm-all.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/guava-21.0.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/intellij-core.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/jdom.jar" excludes="META-INF/jb/** META-INF/LICENSE"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/jna.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/log4j.jar" excludes="META-INF/jb/** META-INF/LICENSE"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/picocontainer.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/snappy-in-java-0.5.1.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/streamex-0.6.2.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/trove4j.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/xpp3-1.1.4-min.jar"/>
|
|
<zipfileset src="${basedir}/ideaSDK/core/xstream-1.4.8.jar"/>
|
|
<zipfileset src="${idea.sdk}/lib/jna-platform.jar"/>
|
|
<zipfileset src="${idea.sdk}/lib/oromatcher.jar" excludes="META-INF/jb/** META-INF/LICENSE"/>
|
|
<zipfileset src="${idea.sdk}/jps/jps-model.jar" excludes="META-INF/services/**"/>
|
|
<zipfileset src="${dependencies}/jline3.jar"/>
|
|
<zipfileset src="${dependencies}/jansi.jar"/>
|
|
<zipfileset src="${dependencies}/javaslang-2.0.6.jar"/>
|
|
<zipfileset src="${dependencies}/json-org.jar"/>
|
|
<zipfileset src="${protobuf.jar}"/>
|
|
<zipfileset src="${dependencies}/kotlinx-coroutines-core.jar"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.compiler}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
|
|
<attribute name="Class-Path" value="${compiler.manifest.class.path}"/>
|
|
<attribute name="Main-Class" value="org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"/>
|
|
</manifest>
|
|
</jar>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="compiler-quick">
|
|
<delete dir="${output}/classes/compiler"/>
|
|
<copy todir="${output}/classes/compiler">
|
|
<fileset dir="${idea.out}/">
|
|
<patternset refid="compilerClassesFromIDEA.fileset"/>
|
|
</fileset>
|
|
<!-- out/production contains classes under module directories, here we are merging them all into one root-->
|
|
<cutdirsmapper dirs="1"/>
|
|
</copy>
|
|
<delete file="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<pack-compiler jarfile="${kotlin-home}/lib/kotlin-compiler.jar" compress="false"/>
|
|
</target>
|
|
|
|
<target name="compiler-fork">
|
|
<local name="jvmargs" />
|
|
<condition property="jvmargs" value="${compiler.ant.fork.jvmargs}" else="">
|
|
<isset property="compiler.ant.fork.jvmargs" />
|
|
</condition>
|
|
|
|
<java classname="org.apache.tools.ant.launch.Launcher"
|
|
fork="true"
|
|
failonerror="true"
|
|
timeout="4000000"
|
|
taskname="ant-fork">
|
|
<jvmarg line="${jvmargs}" />
|
|
<classpath>
|
|
<pathelement location="${ant.home}/lib/ant-launcher.jar"/>
|
|
</classpath>
|
|
<arg line="-Dbootstrap.or.local.build=${bootstrap.or.local.build}" />
|
|
<arg line="-Dbuild.number=${build.number}" />
|
|
<arg line="-f" />
|
|
<arg line="build.xml" />
|
|
<arg line="compiler" />
|
|
</java>
|
|
</target>
|
|
|
|
<target name="compiler">
|
|
<cleandir dir="${output}/classes/compiler"/>
|
|
|
|
<javac2 destdir="${output}/classes/compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
|
source="${java.target}" target="${java.target}">
|
|
<withKotlin modulename="kotlin-compiler">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src refid="compilerSources.path"/>
|
|
<classpath refid="classpath"/>
|
|
</javac2>
|
|
|
|
<pack-compiler jarfile="${output}/kotlin-compiler-before-shrink.jar"/>
|
|
|
|
<delete file="${kotlin-home}/lib/kotlin-compiler.jar" failonerror="false"/>
|
|
|
|
<copy file="${output}/kotlin-compiler-before-shrink.jar"
|
|
tofile="${kotlin-home}/lib/kotlin-compiler.jar"
|
|
unless:true="${shrink}" />
|
|
|
|
<sequential if:true="${shrink}">
|
|
<shrink configuration="${basedir}/compiler/compiler.pro"/>
|
|
</sequential>
|
|
|
|
<pack-compiler-for-maven/>
|
|
</target>
|
|
|
|
<macrodef name="shrink">
|
|
<attribute name="configuration"/>
|
|
|
|
<sequential>
|
|
<taskdef resource="proguard/ant/task.properties">
|
|
<classpath>
|
|
<pathelement path="${dependencies}/proguard.jar"/>
|
|
<pathelement path="${dependencies}/proguard-anttask.jar"/>
|
|
</classpath>
|
|
</taskdef>
|
|
|
|
<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="jssejar" value="${java.home}/lib/jsse.jar" file="${java.home}/lib/jsse.jar"/>
|
|
<available property="jssejar" value="${java.home}/../Classes/jsse.jar" file="${java.home}/../Classes/jsse.jar"/>
|
|
|
|
<proguard configuration="@{configuration}"/>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<macrodef name="pack-compiler-for-maven">
|
|
<sequential>
|
|
<jar jarfile="${output}/kotlin-compiler-for-maven.jar" duplicate="preserve">
|
|
<patternset id="lib.metainf.patternset">
|
|
<include name="**"/>
|
|
<exclude name="META-INF/build.txt"/>
|
|
<exclude name="META-INF/MANIFEST.MF"/>
|
|
</patternset>
|
|
|
|
<!-- TODO: don't include both to the jar: it's impossible to test changes to core in the local maven build without bootstrap -->
|
|
<zipfileset src="${kotlin-home}/lib/kotlin-compiler.jar" includes="**"/>
|
|
<zipfileset src="${bootstrap.runtime}">
|
|
<patternset refid="lib.metainf.patternset"/>
|
|
</zipfileset>
|
|
<zipfileset src="${bootstrap.reflect}">
|
|
<patternset refid="lib.metainf.patternset"/>
|
|
</zipfileset>
|
|
<zipfileset src="${bootstrap.script.runtime}">
|
|
<patternset refid="lib.metainf.patternset"/>
|
|
</zipfileset>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="${manifest.impl.title.kotlin.compiler}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
|
|
<attribute name="Main-Class" value="org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"/>
|
|
</manifest>
|
|
</jar>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="pack-compiler-for-maven">
|
|
<pack-compiler-for-maven/>
|
|
</target>
|
|
|
|
<target name="compiler-quick-for-maven" depends="compiler-quick,pack-compiler-for-maven"/>
|
|
|
|
<target name="kotlin-build-common-test">
|
|
<cleandir dir="${output}/classes/kotlin-build-common-test"/>
|
|
|
|
<javac2 destdir="${output}/classes/kotlin-build-common-test" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
|
source="${java.target}" target="${java.target}">
|
|
<withKotlin modulename="kotlin-build-common"/>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="build-common/test"/>
|
|
<pathelement path="compiler/incremental-compilation-impl/test"/>
|
|
</src>
|
|
<exclude name="**/*Generated.java"/>
|
|
|
|
<classpath>
|
|
<pathelement path="${bootstrap.runtime}"/>
|
|
<pathelement path="${bootstrap.reflect}"/>
|
|
<pathelement path="${bootstrap.script.runtime}"/>
|
|
<pathelement path="${bootstrap.kotlin.test}"/>
|
|
<pathelement path="${protobuf.jar}"/>
|
|
<pathelement path="${idea.sdk}/lib/junit-4.12.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="dependencies/jarjar.jar"/>
|
|
|
|
<jarjar jarfile="${kotlin-home}/lib/kotlin-build-common-test.jar">
|
|
<fileset dir="${output}/classes/kotlin-build-common-test"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<zipfileset src="${protobuf.jar}"/>
|
|
<rule pattern="com.intellij.**" result="org.jetbrains.kotlin.com.intellij.@1"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="Kotlin Build Common"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jarjar>
|
|
</target>
|
|
|
|
<target name="daemon-client">
|
|
<cleandir dir="${output}/classes/daemon-client"/>
|
|
|
|
<kotlinc output="${output}/classes/daemon-client" modulename="client">
|
|
<src>
|
|
<pathelement path="compiler/daemon/daemon-client/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<pathelement path="${dependencies}/native-platform-uberjar.jar"/>
|
|
</classpath>
|
|
</kotlinc>
|
|
|
|
<jar destfile="${kotlin-home}/lib/kotlin-daemon-client.jar">
|
|
<fileset dir="${output}/classes/daemon-client"/>
|
|
<zipfileset src="${dependencies}/native-platform-uberjar.jar" includes="**" />
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="Kotlin Compile Daemon Client"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="compiler-client-embeddable">
|
|
<cleandir dir="${output}/classes/compiler-client-embeddable"/>
|
|
<javac2 destdir="${output}/classes/compiler-client-embeddable" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
|
<withKotlin modulename="compiler-deps">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<src>
|
|
<pathelement path="compiler/daemon/daemon-common/src"/>
|
|
<pathelement path="compiler/cli/cli-common/"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="dependencies/jarjar.jar"/>
|
|
|
|
<jarjar jarfile="${kotlin-home}/lib/kotlin-compiler-client-embeddable.jar">
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<zipfileset src="${kotlin-home}/lib/kotlin-daemon-client.jar" excludes="net/rubygrapefruit/platform/** net/ net/rubygrapefruit/"/>
|
|
<fileset dir="${output}/classes/compiler-client-embeddable"
|
|
includes="META-INF/** org/jetbrains/kotlin/daemon/common/** org/jetbrains/kotlin/cli/common/messages/CompilerMessage* org/jetbrains/kotlin/cli/common/messages/Message* org/jetbrains/kotlin/cli/common/repl/**"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="Kotlin Compiler Client Embeddable"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
<attribute name="Class-Path" value="kotlin-stdlib.jar"/>
|
|
</manifest>
|
|
</jarjar>
|
|
</target>
|
|
|
|
<target name="android-extensions-compiler">
|
|
<cleandir dir="${output}/classes/android-extensions/android-extensions-compiler"/>
|
|
<javac2 destdir="${output}/classes/android-extensions/android-extensions-compiler" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
|
<withKotlin modulename="kotlin-android-extensions-compiler">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="plugins/android-extensions/android-extensions-compiler/src"/>
|
|
<pathelement path="plugins/android-extensions/android-extensions-runtime/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
<pathelement path="${idea.sdk}/plugins/android/lib/layoutlib.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/android-extensions-compiler.jar">
|
|
<fileset dir="${output}/classes/android-extensions/android-extensions-compiler"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<fileset dir="${basedir}/plugins/android-extensions/android-extensions-compiler/src" includes="META-INF/services/**"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="allopen-compiler-plugin">
|
|
<cleandir dir="${output}/classes/allopen-compiler-plugin"/>
|
|
<javac2 destdir="${output}/classes/allopen-compiler-plugin" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
|
<withKotlin modulename="allopen">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="plugins/allopen/allopen-cli/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/allopen-compiler-plugin.jar">
|
|
<fileset dir="${output}/classes/allopen-compiler-plugin"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<fileset dir="${basedir}/plugins/allopen/allopen-cli/src" includes="META-INF/services/**"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="noarg-compiler-plugin">
|
|
<cleandir dir="${output}/classes/noarg-compiler-plugin"/>
|
|
<javac2 destdir="${output}/classes/noarg-compiler-plugin" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
|
<withKotlin modulename="noarg">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="plugins/noarg/noarg-cli/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/noarg-compiler-plugin.jar">
|
|
<fileset dir="${output}/classes/noarg-compiler-plugin"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<fileset dir="${basedir}/plugins/noarg/noarg-cli/src" includes="META-INF/services/**"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="sam-with-receiver-compiler-plugin">
|
|
<cleandir dir="${output}/classes/sam-with-receiver-compiler-plugin"/>
|
|
<javac2 destdir="${output}/classes/sam-with-receiver-compiler-plugin" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
|
<withKotlin modulename="noarg">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="plugins/sam-with-receiver/sam-with-receiver-cli/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/sam-with-receiver-compiler-plugin.jar">
|
|
<fileset dir="${output}/classes/sam-with-receiver-compiler-plugin"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<fileset dir="${basedir}/plugins/sam-with-receiver/sam-with-receiver-cli/src" includes="META-INF/services/**"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="source-sections-compiler-plugin">
|
|
<cleandir dir="${output}/classes/source-sections-compiler-plugin"/>
|
|
<javac2 destdir="${output}/classes/source-sections-compiler-plugin" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
|
<withKotlin modulename="source-sections">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="plugins/source-sections/source-sections-compiler/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/kotlin-source-sections-compiler-plugin.jar">
|
|
<fileset dir="${output}/classes/source-sections-compiler-plugin"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<fileset dir="${basedir}/plugins/source-sections/source-sections-compiler/src" includes="META-INF/services/**"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="annotation-processing">
|
|
<cleandir dir="${output}/classes/annotation-processing"/>
|
|
|
|
<property environment="env"/>
|
|
|
|
<javac2 destdir="${output}/classes/annotation-processing" debug="true" debuglevel="lines,vars,source"
|
|
includeAntRuntime="false" source="${java.target}" target="${java.target}">
|
|
<withKotlin modulename="annotation-processing">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="plugins/kapt3/src"/>
|
|
</src>
|
|
<classpath>
|
|
<!-- JAVA_HOME is set in annotation-processing-under-jdk8 -->
|
|
<pathelement path="${env.JAVA_HOME}/lib/tools.jar"/>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<pathelement path="${bootstrap.runtime}"/>
|
|
<pathelement path="${bootstrap.reflect}"/>
|
|
<pathelement path="${bootstrap.script.runtime}"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/kotlin-annotation-processing.jar">
|
|
<fileset dir="${output}/classes/annotation-processing"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<fileset dir="${basedir}/plugins/kapt3/src" includes="META-INF/services/**"/>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="ant-tools">
|
|
<cleandir dir="${output}/classes/ant"/>
|
|
<javac2 destdir="${output}/classes/ant" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
|
source="${java.target}" target="${java.target}">
|
|
<withKotlin modulename="kotlin-ant-tools">
|
|
<compilerarg value="-version"/>
|
|
</withKotlin>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<dirset dir="${basedir}/ant">
|
|
<include name="src"/>
|
|
</dirset>
|
|
</src>
|
|
<compilerarg value="-Xlint:all"/>
|
|
<classpath>
|
|
<pathelement location="${dependencies}/ant-1.8/lib/ant.jar"/>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-preloader.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/kotlin-ant.jar">
|
|
<fileset dir="${output}/classes/ant"/>
|
|
<fileset dir="${basedir}/ant/src" includes="**/*.xml"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="Kotlin Compiler Ant Tasks"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
|
|
<attribute name="Class-Path" value="${compiler.manifest.class.path} kotlin-preloader.jar"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<macrodef name="new-kotlinc">
|
|
<attribute name="output"/>
|
|
<attribute name="moduleName"/>
|
|
<attribute name="additionalOptions" default=""/>
|
|
<element name="src"/>
|
|
<element name="class-path"/>
|
|
|
|
<sequential>
|
|
<cleandir dir="@{output}"/>
|
|
|
|
<dirset dir="${basedir}" id="src.dirset">
|
|
<src/>
|
|
</dirset>
|
|
|
|
<path id="classpath.path">
|
|
<class-path/>
|
|
</path>
|
|
|
|
<!-- Source paths separated by space (to pass to "arg line" below) -->
|
|
<local name="src.line"/>
|
|
<pathconvert property="src.line" refid="src.dirset" pathsep=" "/>
|
|
|
|
<java classname="org.jetbrains.kotlin.preloading.Preloader" failonerror="true" fork="true" maxmemory="${max.heap.size.for.forked.jvm}">
|
|
<classpath>
|
|
<pathelement location="${kotlin-home}/lib/kotlin-preloader.jar"/>
|
|
</classpath>
|
|
<assertions>
|
|
<enable/>
|
|
</assertions>
|
|
<arg value="-cp"/>
|
|
<arg value="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<arg value="org.jetbrains.kotlin.cli.jvm.K2JVMCompiler"/>
|
|
<arg line="${src.line}"/>
|
|
<arg value="-d"/>
|
|
<arg value="@{output}"/>
|
|
<arg value="-no-stdlib"/>
|
|
<arg value="-version"/>
|
|
<arg line="@{additionalOptions}"/>
|
|
<arg value="-classpath"/>
|
|
<arg value="${toString:classpath.path}"/>
|
|
<arg value="-module-name"/>
|
|
<arg value="@{moduleName}"/>
|
|
<arg value="-Xallow-kotlin-package"/>
|
|
</java>
|
|
|
|
<javac2 srcdir="${toString:src.dirset}" destdir="@{output}" debug="true" debuglevel="lines,vars,source"
|
|
includeAntRuntime="false" source="1.6" target="1.6">
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<classpath>
|
|
<path refid="classpath.path"/>
|
|
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
|
|
<pathelement location="@{output}"/>
|
|
</classpath>
|
|
</javac2>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<macrodef name="pack-runtime-jar">
|
|
<attribute name="jar-dir" default="${kotlin-home}/lib"/>
|
|
<attribute name="jar-name"/>
|
|
<attribute name="implementation-title"/>
|
|
<element name="jar-content"/>
|
|
|
|
<sequential>
|
|
<delete file="@{jar-dir}/@{jar-name}" failonerror="false"/>
|
|
|
|
<jar destfile="@{jar-dir}/@{jar-name}" duplicate="fail">
|
|
<jar-content/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Title" value="@{implementation-title}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<macrodef name="run-gradle-build">
|
|
<attribute name="tasks" />
|
|
<sequential>
|
|
<local name="deployVersion" />
|
|
<condition property="deployVersion" value="" else="-PdeployVersion=${build.number}">
|
|
<equals arg1="${build.number}" arg2="snapshot" />
|
|
</condition>
|
|
|
|
<java classname="org.gradle.wrapper.GradleWrapperMain"
|
|
fork="true"
|
|
dir="${basedir}/libraries"
|
|
failonerror="true"
|
|
timeout="4000000"
|
|
maxmemory="400m"
|
|
taskname="gradle">
|
|
<classpath>
|
|
<pathelement location="${basedir}/libraries/gradle/wrapper/gradle-wrapper.jar"/>
|
|
</classpath>
|
|
<arg line="@{tasks}" />
|
|
<arg line="--no-daemon -Dkotlin.daemon.jvm.options=-Xmx700m -Dkotlin.daemon.verbose=true" />
|
|
<arg line="${deployVersion}" />
|
|
<arg line="${gradle.logging.level}" />
|
|
</java>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="gradle-runtime">
|
|
<run-gradle-build tasks="clean dist publish" />
|
|
|
|
<!-- legacy artifact, required for migration on teamcity -->
|
|
<jar destfile="${output}/kotlin-reflect-sources-for-maven.jar" />
|
|
</target>
|
|
|
|
<target name="stdlib-js">
|
|
<run-gradle-build tasks=":kotlin-stdlib-js:dist :kotlin-test:kotlin-test-js:dist --rerun-tasks" />
|
|
</target>
|
|
|
|
<target name="compiler-quick-and-stdlib-js"
|
|
depends="compiler-quick-for-maven,stdlib-js"/>
|
|
|
|
<target name="runtime"
|
|
depends="gradle-runtime,mock-runtime-for-test"/>
|
|
|
|
<target name="other-artifacts"
|
|
depends="android-extensions-compiler,allopen-compiler-plugin,noarg-compiler-plugin,sam-with-receiver-compiler-plugin,source-sections-compiler-plugin,annotation-processing,daemon-client,compiler-client-embeddable,kotlin-build-common-test" />
|
|
|
|
<target name="dist"
|
|
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler-fork,compiler-sources,ant-tools,runtime,other-artifacts"
|
|
description="Builds redistributables from sources"/>
|
|
|
|
<target name="dist-no-fork"
|
|
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,ant-tools,runtime,other-artifacts"
|
|
description="Builds redistributables from sources"/>
|
|
|
|
<target name="dist-quick-compiler-only"
|
|
depends="init,prepare-dist,preloader,serialize-builtins,compiler-quick-for-maven"
|
|
description="Builds compiler jar from project out dir"/>
|
|
|
|
<target name="zip-compiler">
|
|
<zip destfile="${output}/kotlin-compiler-${build.number}.zip">
|
|
<zipfileset prefix="kotlinc" dir="${kotlin-home}" excludes="bin/*"/>
|
|
<zipfileset prefix="kotlinc/bin" dir="${kotlin-home}/bin" includes="*.bat" filemode="644"/>
|
|
<zipfileset prefix="kotlinc/bin" dir="${kotlin-home}/bin" excludes="*.bat" filemode="755"/>
|
|
</zip>
|
|
</target>
|
|
|
|
<target name="zip-test-data">
|
|
<zip destfile="${output}/kotlin-test-data.zip">
|
|
<zipfileset dir="compiler/testData" prefix="compiler"/>
|
|
<zipfileset dir="idea/testData" prefix="ide"/>
|
|
<zipfileset dir="idea/idea-completion/testData" prefix="ide/completion"/>
|
|
</zip>
|
|
</target>
|
|
|
|
<target name="mock-runtime-for-test">
|
|
<delete dir="${output}/mock-runtime-src" failonerror="false"/>
|
|
<mkdir dir="${output}/mock-runtime-src"/>
|
|
<copy file="${basedir}/core/runtime.jvm/src/kotlin/TypeAliases.kt" todir="${output}/mock-runtime-src"/>
|
|
<copy file="${basedir}/core/runtime.jvm/src/kotlin/text/TypeAliases.kt" todir="${output}/mock-runtime-src/text"/>
|
|
<copy file="${basedir}/libraries/stdlib/src/kotlin/collections/TypeAliases.kt" todir="${output}/mock-runtime-src/collections"/>
|
|
<copy file="${basedir}/libraries/stdlib/src/kotlin/jvm/JvmVersion.kt" todir="${output}/mock-runtime-src"/>
|
|
<copy file="${basedir}/libraries/stdlib/src/kotlin/util/Standard.kt" todir="${output}/mock-runtime-src"/>
|
|
<copy file="${basedir}/libraries/stdlib/src/kotlin/internal/Annotations.kt" todir="${output}/mock-runtime-src"/>
|
|
|
|
<new-kotlinc output="${output}/classes/mock-runtime" moduleName="kotlin-stdlib">
|
|
<src>
|
|
<include name="dist/mock-runtime-src"/>
|
|
</src>
|
|
<class-path>
|
|
<pathelement path="${output}/kotlinc/lib/kotlin-stdlib.jar" />
|
|
</class-path>
|
|
</new-kotlinc>
|
|
|
|
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-mock-runtime-for-test.jar" implementation-title="Kotlin Mock Runtime">
|
|
<jar-content>
|
|
<fileset dir="${output}/classes/mock-runtime"/>
|
|
<zipfileset dir="${output}/builtins">
|
|
<include name="kotlin/**"/>
|
|
<!-- exclude name="kotlin/reflect/**"/ -->
|
|
</zipfileset>
|
|
</jar-content>
|
|
</pack-runtime-jar>
|
|
</target>
|
|
|
|
<target name="build-bootstrap-artifacts" depends="dist,zip-compiler"/>
|
|
|
|
<target name="build-artifacts" depends="dist,zip-compiler,zip-test-data"/>
|
|
</project>
|