1160 lines
53 KiB
XML
1160 lines
53 KiB
XML
<project name="Kotlin" default="dist" xmlns:if="ant:if" xmlns:unless="ant:unless">
|
|
<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"/>
|
|
<!-- Set to false to disable compiler's javadoc generation. Speeds up the build -->
|
|
<property name="generate.javadoc" value="true"/>
|
|
|
|
<!-- Set to false to prevent jarjar and metadata stripping on kotlin-reflect.jar and reflection sources. Use to debug reflection -->
|
|
<property name="obfuscate.reflect" 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-runtime.jar"/>
|
|
<property name="bootstrap.reflect" value="${bootstrap.compiler.home}/lib/kotlin-reflect.jar"/>
|
|
<property name="bootstrap.kotlin.test" value="${bootstrap.compiler.home}/lib/kotlin-test.jar" />
|
|
|
|
<property name="output" value="${basedir}/dist"/>
|
|
<property name="js.stdlib.output.dir" value="${output}/js"/>
|
|
<property name="intermediate-sources" value="out/src" />
|
|
<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="${idea.sdk}/lib/protobuf-2.5.0.jar"/>
|
|
<property name="protobuf-lite.jar" value="${basedir}/dependencies/protobuf-2.5.0-lite.jar"/>
|
|
<property name="javax.inject.jar" value="${basedir}/lib/javax.inject.jar"/>
|
|
|
|
<property name="java.target" value="1.6"/>
|
|
|
|
<property name="dependencies.dir" value="${basedir}/dependencies"/>
|
|
|
|
<condition property="bootstrap.or.local.build" value="true">
|
|
<or>
|
|
<istrue value="${bootstrap.build.no.tests}"/>
|
|
<not>
|
|
<isset property="teamcity.version"/>
|
|
</not>
|
|
</or>
|
|
</condition>
|
|
|
|
<include file="jslib_files.xml" />
|
|
|
|
<!--
|
|
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-runtime.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-runtime-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-runtime-internal-bootstrap.jar kotlin-reflect-internal-bootstrap.jar"
|
|
else="kotlin-runtime.jar kotlin-reflect.jar">
|
|
<istrue value="${bootstrap.or.local.build}"/>
|
|
</condition>
|
|
|
|
<path id="classpath">
|
|
<file file="${bootstrap.runtime}"/>
|
|
<file file="${bootstrap.kotlin.test}" />
|
|
<file file="${bootstrap.reflect}"/>
|
|
<fileset dir="${idea.sdk}" includes="core/*.jar"/>
|
|
<pathelement location="${protobuf.jar}"/>
|
|
|
|
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
|
|
<fileset dir="${dependencies.dir}" includes="jansi.jar"/>
|
|
<fileset dir="${dependencies.dir}" includes="jline.jar"/>
|
|
<fileset dir="${dependencies.dir}" includes="cli-parser-1.1.1.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/builtins-serializer/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/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/serialization/src"/>
|
|
<include name="compiler/util/src"/>
|
|
<include name="js/js.dart-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="plugins/annotation-collector/src"/>
|
|
</dirset>
|
|
|
|
<property name="idea.out" value="${basedir}/out/production"/>
|
|
<patternset id="compilerClassesFromIDEA.fileset">
|
|
<include name="frontend/**"/>
|
|
<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="cli/**"/>
|
|
<include name="cli-common/**"/>
|
|
<include name="conditional-preprocessor/**"/>
|
|
<include name="daemon/**"/>
|
|
<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="js.dart-ast/**"/>
|
|
<include name="js.translator/**"/>
|
|
<include name="js.frontend/**"/>
|
|
<include name="js.inliner/**"/>
|
|
<include name="js.parser/**"/>
|
|
<include name="js.serializer/**"/>
|
|
</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"/>
|
|
</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-runtime-internal-bootstrap.jar"/>
|
|
<copy file="${bootstrap.reflect}" tofile="${kotlin-home}/lib/kotlin-reflect-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-runtime-internal-bootstrap.jar"/>
|
|
</manifest>
|
|
</jar>
|
|
<jar destfile="${kotlin-home}/lib/kotlin-test-internal-bootstrap.jar" update="true">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="kotlin-runtime-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.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="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/builtins-serializer/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="compiler/container/src"/>
|
|
<fileset dir="compiler/frontend/src"/>
|
|
<fileset dir="compiler/frontend.java/src"/>
|
|
<fileset dir="compiler/light-classes/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.dart-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"/>
|
|
<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>
|
|
|
|
<sequential if:true="${generate.javadoc}">
|
|
<delete dir="${output}/kotlin-compiler-javadoc" failonerror="false"/>
|
|
<javadoc destdir="${output}/kotlin-compiler-javadoc"
|
|
sourcepathref="compilerSources.path"
|
|
classpathref="classpath"
|
|
linksource="yes"
|
|
windowtitle="${manifest.impl.title.kotlin.compiler}"/>
|
|
<jar jarfile="${output}/kotlin-compiler-javadoc.jar">
|
|
<fileset dir="${output}/kotlin-compiler-javadoc"/>
|
|
<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.javadoc}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</sequential>
|
|
|
|
<sequential unless:true="${generate.javadoc}">
|
|
<jar jarfile="${output}/kotlin-compiler-javadoc.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.javadoc}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</sequential>
|
|
</target>
|
|
|
|
<macrodef name="new-kotlin2js">
|
|
<attribute name="output"/>
|
|
<element name="src"/>
|
|
|
|
<sequential>
|
|
<local name="src.line"/>
|
|
|
|
<path id="src.path">
|
|
<src/>
|
|
</path>
|
|
|
|
<pathconvert property="src.line" refid="src.path" 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.js.K2JSCompiler"/>
|
|
<arg line="${src.line}"/>
|
|
<arg value="-output"/>
|
|
<arg value="@{output}"/>
|
|
<arg value="-no-stdlib"/>
|
|
<arg value="-meta-info"/>
|
|
<arg value="-kjsm"/>
|
|
<arg line="-main noCall"/>
|
|
</java>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="js-stdlib">
|
|
<property name="compiled.builtins.js" value="builtins.js"/>
|
|
<property name="compiled.builtins.meta.js" value="builtins.meta.js"/>
|
|
<property name="compiled.stdlib.js" value="stdlib.js"/>
|
|
<property name="compiled.stdlib.meta.js" value="stdlib.meta.js"/>
|
|
<property name="stdlib.js.dir" value="${basedir}/js/js.translator/testData"/>
|
|
|
|
<kotlin-pp src="libraries/stdlib/src" output="${intermediate-sources}/stdlib/js" profile="JS" />
|
|
|
|
<new-kotlin2js output="${js.stdlib.output.dir}/${compiled.builtins.js}">
|
|
<src>
|
|
<fileset refid="kotlin.builtin.files"/>
|
|
</src>
|
|
</new-kotlin2js>
|
|
|
|
<new-kotlin2js output="${js.stdlib.output.dir}/${compiled.stdlib.js}">
|
|
<src>
|
|
<resources refid="js.lib.files"/>
|
|
</src>
|
|
</new-kotlin2js>
|
|
|
|
<taskdef name="closure-compiler"
|
|
classname="com.google.javascript.jscomp.ant.CompileTask"
|
|
classpath="${dependencies.dir}/closure-compiler.jar"/>
|
|
|
|
<!-- value should be one of: whitespace, simple, advanced -->
|
|
<property name="compilationLevel" value="whitespace"/>
|
|
<!-- value should be one of: default, quiet, verbose -->
|
|
<property name="warningLevel" value="default"/>
|
|
|
|
<closure-compiler
|
|
compilationLevel="${compilationLevel}"
|
|
prettyprint="true"
|
|
languagein="ECMASCRIPT5_STRICT"
|
|
warning="${warningLevel}"
|
|
output="${js.stdlib.output.dir}/kotlin.js">
|
|
|
|
<sources dir="${stdlib.js.dir}">
|
|
<file name="kotlin_lib_ecma5.js"/>
|
|
<file name="kotlin_lib.js"/>
|
|
<file name="maps.js"/>
|
|
<file name="long.js"/>
|
|
</sources>
|
|
|
|
<sources dir="${js.stdlib.output.dir}">
|
|
<file name="${compiled.builtins.js}"/>
|
|
</sources>
|
|
|
|
<sources dir="${js.stdlib.output.dir}">
|
|
<file name="${compiled.stdlib.js}"/>
|
|
</sources>
|
|
|
|
<sources dir="${stdlib.js.dir}">
|
|
<file name="export_Kotlin_if_possible.js"/>
|
|
</sources>
|
|
|
|
<externs dir="${stdlib.js.dir}">
|
|
<file name="externs.js"/>
|
|
</externs>
|
|
</closure-compiler>
|
|
|
|
<jar jarfile="${kotlin-home}/lib/kotlin-jslib.jar" duplicate="fail">
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<zipfileset dir="${js.stdlib.output.dir}" prefix="">
|
|
<include name="kotlin.js"/>
|
|
<include name="${compiled.stdlib.meta.js}"/>
|
|
<include name="stdlib/**"/>
|
|
</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.javascript.stdlib}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
<attribute name="Specification-Title" value="${manifest.spec.title.kotlin.javascript.lib}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="pack-js-stdlib-sources">
|
|
<jar destfile="${kotlin-home}/lib/kotlin-jslib-sources.jar" duplicate="fail">
|
|
<resources refid="js.lib.files" />
|
|
<fileset refid="kotlin.builtin.files" />
|
|
|
|
<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.jvm.runtime.sources}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="kotlin-js-stdlib" depends="js-stdlib,pack-js-stdlib-sources"/>
|
|
|
|
<target name="preloader">
|
|
<cleandir dir="${output}/classes/preloader"/>
|
|
<javac destdir="${output}/classes/preloader" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
|
source="${java.target}" target="${java.target}">
|
|
<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="${manifest.impl.title.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"/>
|
|
</kotlinc>
|
|
|
|
<local name="runtime.jar"/>
|
|
<condition property="runtime.jar" value="kotlin-runtime-internal-bootstrap.jar" else="kotlin-runtime.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="${manifest.impl.title.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/**"/>
|
|
<exclude name="kotlin/internal/**"/>
|
|
</fileset>
|
|
<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"/>
|
|
<zipgroupfileset dir="${basedir}/ideaSDK/core" includes="*.jar" excludes="util.jar"/>
|
|
<zipfileset src="${idea.sdk}/lib/jna-platform.jar"/>
|
|
<zipfileset src="${idea.sdk}/lib/oromatcher.jar"/>
|
|
<zipfileset src="${idea.sdk}/jps/jps-model.jar"/>
|
|
<zipfileset src="${dependencies.dir}/jline.jar"/>
|
|
<zipfileset src="${dependencies.dir}/cli-parser-1.1.1.jar"/>
|
|
<zipfileset src="${protobuf.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">
|
|
<taskdef resource="proguard/ant/task.properties">
|
|
<classpath>
|
|
<pathelement path="${dependencies.dir}/proguard.jar"/>
|
|
<pathelement path="${dependencies.dir}/proguard-anttask.jar"/>
|
|
</classpath>
|
|
</taskdef>
|
|
|
|
<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"/>
|
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
|
<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}">
|
|
<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="${basedir}/compiler/compiler.pro"/>
|
|
</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>
|
|
|
|
<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>
|
|
</target>
|
|
|
|
<target name="kotlin-build">
|
|
<cleandir dir="${output}/classes/kotlin-build"/>
|
|
|
|
<javac2 destdir="${output}/classes/kotlin-build" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
|
source="${java.target}" target="${java.target}">
|
|
<withKotlin modulename="kotlin-build"/>
|
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
|
<src>
|
|
<pathelement path="build/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${bootstrap.runtime}"/>
|
|
<pathelement path="${bootstrap.reflect}"/>
|
|
<pathelement path="${idea.sdk}/lib/util.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/kotlin-build.jar">
|
|
<fileset dir="${output}/classes/kotlin-build"/>
|
|
<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.build}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
|
|
<jar jarfile="${output}/kotlin-build-sources.jar">
|
|
<fileset dir="build/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.build.sources}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</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="${bootstrap.runtime}"/>
|
|
<pathelement path="${bootstrap.reflect}"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<pathelement path="${dependencies.dir}/native-platform-uberjar.jar"/>
|
|
</classpath>
|
|
</kotlinc>
|
|
|
|
<jar destfile="${kotlin-home}/lib/kotlin-daemon-client.jar">
|
|
<fileset dir="${output}/classes/daemon-client"/>
|
|
<zipfileset src="${dependencies.dir}/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="${manifest.impl.title.kotlin.daemon-client}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="android-compiler-plugin">
|
|
<cleandir dir="${output}/classes/android-compiler-plugin"/>
|
|
<javac2 destdir="${output}/classes/android-compiler-plugin" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false">
|
|
<withKotlin modulename="kotlin-android-compiler-plugin"/>
|
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<pathelement path="plugins/android-compiler-plugin/src"/>
|
|
</src>
|
|
<classpath>
|
|
<pathelement path="${idea.sdk}/core/intellij-core.jar"/>
|
|
<pathelement path="${kotlin-home}/lib/kotlin-compiler.jar"/>
|
|
<pathelement path="${bootstrap.runtime}"/>
|
|
<pathelement path="${bootstrap.reflect}"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<jar destfile="${kotlin-home}/lib/android-compiler-plugin.jar">
|
|
<fileset dir="${output}/classes/android-compiler-plugin"/>
|
|
<zipfileset file="${kotlin-home}/build.txt" prefix="META-INF"/>
|
|
<fileset dir="${basedir}/plugins/android-compiler-plugin/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"/>
|
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<dirset dir="${basedir}/ant">
|
|
<include name="src"/>
|
|
</dirset>
|
|
</src>
|
|
<compilerarg value="-Xlint:all"/>
|
|
<classpath>
|
|
<file file="${bootstrap.runtime}"/>
|
|
<file file="${bootstrap.reflect}"/>
|
|
<pathelement location="${dependencies.dir}/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="${manifest.impl.title.kotlin.compiler.ant.task}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
|
|
<attribute name="Class-Path" value="${compiler.manifest.class.path} kotlin-preloader.jar"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="jdk-annotations">
|
|
<jar destfile="${kotlin-home}/lib/kotlin-jdk-annotations.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.jdk.annotations}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="android-sdk-annotations">
|
|
<jar destfile="${kotlin-home}/lib/kotlin-android-sdk-annotations.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.android.sdk.annotations}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</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 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="${java.target}" target="${java.target}">
|
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
|
<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="kotlin-pp">
|
|
<attribute name="src"/>
|
|
<attribute name="output"/>
|
|
<attribute name="profile"/>
|
|
|
|
<sequential>
|
|
<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.preprocessor.PreprocessorCLI"/>
|
|
<arg value="@{src}"/>
|
|
<arg value="@{output}"/>
|
|
<arg value="@{profile}"/>
|
|
</java>
|
|
</sequential>
|
|
</macrodef>
|
|
|
|
<target name="builtins">
|
|
<new-kotlinc output="${output}/classes/builtins" moduleName="kotlin-builtins">
|
|
<src>
|
|
<include name="core/builtins/src"/>
|
|
<include name="core/runtime.jvm/src"/>
|
|
</src>
|
|
<class-path>
|
|
<!-- Need something to pass to compiler's "-classpath" here -->
|
|
<pathelement location="core/builtins/src"/>
|
|
</class-path>
|
|
</new-kotlinc>
|
|
</target>
|
|
|
|
<target name="stdlib">
|
|
<new-kotlinc output="${output}/classes/stdlib" moduleName="kotlin-stdlib" additionalOptions="-Xmultifile-facades-open">
|
|
<src>
|
|
<include name="libraries/stdlib/src"/>
|
|
</src>
|
|
<class-path>
|
|
<pathelement path="${output}/classes/builtins"/>
|
|
</class-path>
|
|
</new-kotlinc>
|
|
</target>
|
|
|
|
<target name="kotlin-test">
|
|
<new-kotlinc output="${output}/classes/kotlin-test" moduleName="kotlin-test">
|
|
<src>
|
|
<include name="libraries/kotlin.test/shared/src/main/kotlin" />
|
|
<include name="libraries/kotlin.test/shared/src/main/kotlin.jvm" />
|
|
<include name="libraries/kotlin.test/junit/src/main/kotlin" />
|
|
</src>
|
|
<class-path>
|
|
<pathelement path="${output}/classes/builtins"/>
|
|
<pathelement path="libraries/lib/junit-4.11.jar"/>
|
|
</class-path>
|
|
</new-kotlinc>
|
|
|
|
<pack-runtime-jar jar-name="kotlin-test.jar" implementation-title="${manifest.impl.title.kotlin.test}">
|
|
<jar-content>
|
|
<fileset dir="${output}/classes/kotlin-test" includes="**/*" excludes="kotlin/internal/OnlyInputTypes*,kotlin/internal"/>
|
|
</jar-content>
|
|
</pack-runtime-jar>
|
|
</target>
|
|
|
|
<target name="core">
|
|
<new-kotlinc output="${output}/classes/core" moduleName="kotlin-core">
|
|
<src>
|
|
<include name="core/descriptor.loader.java/src"/>
|
|
<include name="core/descriptors/src"/>
|
|
<include name="core/descriptors.runtime/src"/>
|
|
<include name="core/deserialization/src"/>
|
|
<include name="core/util.runtime/src"/>
|
|
</src>
|
|
<class-path>
|
|
<pathelement path="${output}/classes/builtins"/>
|
|
<pathelement path="${output}/classes/stdlib"/>
|
|
<pathelement path="${protobuf-lite.jar}"/>
|
|
<pathelement path="${javax.inject.jar}"/>
|
|
</class-path>
|
|
</new-kotlinc>
|
|
</target>
|
|
|
|
<target name="reflection">
|
|
<new-kotlinc output="${output}/classes/reflection" moduleName="kotlin-reflection">
|
|
<src>
|
|
<include name="core/reflection.jvm/src"/>
|
|
</src>
|
|
<class-path>
|
|
<pathelement path="${output}/classes/builtins"/>
|
|
<pathelement path="${output}/classes/stdlib"/>
|
|
<pathelement path="${output}/classes/core"/>
|
|
<pathelement path="${protobuf-lite.jar}"/>
|
|
</class-path>
|
|
</new-kotlinc>
|
|
</target>
|
|
|
|
<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>
|
|
|
|
<target name="pack-runtime">
|
|
<pack-runtime-jar jar-name="kotlin-runtime.jar" implementation-title="${manifest.impl.title.kotlin.jvm.runtime}">
|
|
<jar-content>
|
|
<fileset dir="${output}/classes/builtins"/>
|
|
<fileset dir="${output}/classes/stdlib"/>
|
|
<zipfileset dir="${output}/builtins">
|
|
<include name="kotlin/**"/>
|
|
<exclude name="kotlin/internal/**"/>
|
|
<!-- TODO: load metadata from @KotlinClass annotation in KotlinBuiltIns on JVM and restore this exclusion -->
|
|
<!-- exclude name="kotlin/reflect/**"/ -->
|
|
</zipfileset>
|
|
</jar-content>
|
|
</pack-runtime-jar>
|
|
|
|
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-reflect-before-jarjar.jar" implementation-title="${manifest.impl.title.kotlin.jvm.reflect}">
|
|
<jar-content>
|
|
<fileset dir="${basedir}/core/descriptor.loader.java/src" includes="META-INF/services/**"/>
|
|
<fileset dir="${output}/classes/reflection"/>
|
|
<fileset dir="${output}/classes/core"/>
|
|
<zipfileset src="${protobuf-lite.jar}"/>
|
|
<zipfileset src="${javax.inject.jar}"/>
|
|
</jar-content>
|
|
</pack-runtime-jar>
|
|
|
|
<jar destfile="${output}/kotlin-reflect-before-jarjar.jar" update="true">
|
|
<manifest>
|
|
<attribute name="Class-Path" value="kotlin-runtime.jar"/>
|
|
</manifest>
|
|
</jar>
|
|
|
|
<delete file="${output}/kotlin-reflect-jarjar.jar" failonerror="false"/>
|
|
|
|
<sequential if:true="${obfuscate.reflect}">
|
|
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="dependencies/jarjar.jar"/>
|
|
<jarjar jarfile="${output}/kotlin-reflect-jarjar.jar" filesonly="true" filesetmanifest="merge">
|
|
<zipfileset src="${output}/kotlin-reflect-before-jarjar.jar"/>
|
|
<rule pattern="org.jetbrains.kotlin.**" result="kotlin.reflect.jvm.internal.impl.@1"/>
|
|
<rule pattern="com.google.protobuf.**" result="kotlin.reflect.jvm.internal.impl.com.google.protobuf.@1"/>
|
|
<rule pattern="javax.inject.**" result="kotlin.reflect.jvm.internal.impl.javax.inject.@1"/>
|
|
</jarjar>
|
|
|
|
<kotlinc src="${basedir}/generators/infrastructure/strip-kotlin-annotations.kts" output="">
|
|
<compilerarg value="-script"/>
|
|
<compilerarg value="kotlin/jvm/internal/.*|kotlin/Metadata"/> <!-- Annotations to strip -->
|
|
<compilerarg value="kotlin/reflect/jvm/internal/impl/.*"/> <!-- Classes to strip from -->
|
|
<compilerarg value="${output}/kotlin-reflect-jarjar.jar"/>
|
|
<compilerarg value="${kotlin-home}/lib/kotlin-reflect.jar"/>
|
|
<classpath>
|
|
<pathelement location="${idea.sdk}/lib/asm-all.jar"/>
|
|
</classpath>
|
|
</kotlinc>
|
|
</sequential>
|
|
|
|
<sequential unless:true="${obfuscate.reflect}">
|
|
<echo message="Obfuscation of kotlin-reflect is disabled"/>
|
|
<copy file="${output}/kotlin-reflect-before-jarjar.jar" tofile="${output}/kotlin-reflect-jarjar.jar" overwrite="true"/>
|
|
<copy file="${output}/kotlin-reflect-before-jarjar.jar" tofile="${kotlin-home}/lib/kotlin-reflect.jar" overwrite="true"/>
|
|
</sequential>
|
|
</target>
|
|
|
|
<target name="pack-runtime-sources">
|
|
<delete dir="${output}/core.src" failonerror="false"/>
|
|
|
|
<local name="runtime.sources.base.dir"/>
|
|
<condition property="runtime.sources.base.dir"
|
|
value="${output}/core.src/kotlin/reflect/jvm/internal/impl"
|
|
else="${output}/core.src/org/jetbrains/kotlin">
|
|
<istrue value="${obfuscate.reflect}"/>
|
|
</condition>
|
|
|
|
<copy todir="${runtime.sources.base.dir}">
|
|
<fileset dir="core">
|
|
<include name="descriptor.loader.java/src/**"/>
|
|
<include name="descriptors/src/**"/>
|
|
<include name="descriptors.runtime/src/**"/>
|
|
<include name="deserialization/src/**"/>
|
|
<include name="util.runtime/src/**"/>
|
|
</fileset>
|
|
<cutdirsmapper dirs="5"/> <!-- module/src/org/jetbrains/kotlin -->
|
|
</copy>
|
|
|
|
<sequential if:true="${obfuscate.reflect}">
|
|
<!-- Rename packages in the sources of reflection impl (core) -->
|
|
<replaceregexp match="org\.jetbrains\.kotlin" replace="kotlin.reflect.jvm.internal.impl" flags="g">
|
|
<fileset dir="${output}/core.src"/>
|
|
</replaceregexp>
|
|
</sequential>
|
|
|
|
<pack-runtime-jar jar-name="kotlin-runtime-sources.jar" implementation-title="${manifest.impl.title.kotlin.jvm.runtime.sources}">
|
|
<jar-content>
|
|
<fileset dir="${basedir}/core/builtins/native" includes="**/*"/>
|
|
<fileset dir="${basedir}/core/builtins/src" includes="**/*"/>
|
|
<fileset dir="${basedir}/core/reflection.jvm/src" includes="**/*"/>
|
|
<fileset dir="${basedir}/core/runtime.jvm/src" includes="**/*"/>
|
|
<fileset dir="${basedir}/libraries/stdlib/src" includes="**/*"/>
|
|
<fileset dir="${output}/core.src" includes="**/*"/>
|
|
</jar-content>
|
|
</pack-runtime-jar>
|
|
|
|
<pack-runtime-jar jar-dir="${output}" jar-name="kotlin-reflect-sources-for-maven.jar"
|
|
implementation-title="${manifest.impl.title.kotlin.jvm.reflect.sources}">
|
|
<jar-content>
|
|
<fileset dir="${basedir}/core/reflection.jvm/src" includes="**/*"/>
|
|
<fileset dir="${output}/core.src" includes="**/*"/>
|
|
</jar-content>
|
|
</pack-runtime-jar>
|
|
</target>
|
|
|
|
<target name="runtime"
|
|
depends="builtins,stdlib,kotlin-test,core,reflection,pack-runtime,pack-runtime-sources"/>
|
|
|
|
<target name="dist"
|
|
depends="clean,init,prepare-dist,preloader,runner,serialize-builtins,compiler,compiler-sources,kotlin-build,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin-js-stdlib,android-compiler-plugin,daemon-client"
|
|
description="Builds redistributables from sources"/>
|
|
|
|
<target name="dist-quick"
|
|
depends="clean,init,prepare-dist,preloader,serialize-builtins,compiler-quick,ant-tools,jdk-annotations,android-sdk-annotations,runtime,kotlin-js-stdlib,android-compiler-plugin"
|
|
description="Builds everything, but classes are reused from project out dir, doesn't run proguard and javadoc"/>
|
|
|
|
<target name="dist-quick-compiler-only"
|
|
depends="init,prepare-dist,preloader,serialize-builtins,compiler-quick"
|
|
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="kotlin-for-upsource">
|
|
<cleandir dir="${output}/classes/idea-analysis"/>
|
|
|
|
<javac2 destdir="${output}/classes/idea-analysis" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
|
source="${java.target}" target="${java.target}">
|
|
<withKotlin modulename="kotlin-for-upsource"/>
|
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
|
<skip pattern="kotlin/Metadata"/>
|
|
<src>
|
|
<dirset dir="${basedir}/idea/ide-common" includes="src"/>
|
|
<dirset dir="${basedir}/idea/idea-analysis" includes="src"/>
|
|
</src>
|
|
<classpath>
|
|
<fileset dir="${idea.sdk}" includes="core-analysis/*.jar"/>
|
|
<pathelement location="${output}/kotlin-compiler-before-shrink.jar"/>
|
|
<path refid="classpath"/>
|
|
</classpath>
|
|
</javac2>
|
|
|
|
<copy todir="${output}/classes/idea-analysis">
|
|
<fileset dir="${basedir}/idea/idea-analysis/src" excludes="**/*.java, **/*.kt"/>
|
|
</copy>
|
|
|
|
<jar jarfile="${output}/kotlin-for-upsource0.jar">
|
|
<fileset dir="${output}/classes/idea-analysis"/>
|
|
<fileset dir="${output}/classes/compiler"/>
|
|
<fileset dir="${output}/builtins">
|
|
<include name="kotlin/**"/>
|
|
<exclude name="kotlin/internal/**"/>
|
|
</fileset>
|
|
<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/**"/>
|
|
|
|
<zipgroupfileset dir="${basedir}/lib" includes="*.jar"/>
|
|
<zipgroupfileset file="${kotlin-home}/lib/kotlin-runtime.jar"/>
|
|
<zipgroupfileset file="${kotlin-home}/lib/kotlin-runtime-sources.jar"/>
|
|
<zipgroupfileset file="${kotlin-home}/lib/kotlin-reflect.jar"/>
|
|
|
|
<fileset dir="${basedir}/resources"/>
|
|
<!-- icons, etc. -->
|
|
<fileset dir="idea/resources"/>
|
|
<!-- plugin.xml and friends -->
|
|
<fileset dir="idea/src" includes="META-INF/**"/>
|
|
</jar>
|
|
<sleep seconds="1"/>
|
|
<jar jarfile="${output}/kotlin-for-upsource.jar">
|
|
<zipfileset src="${output}/kotlin-for-upsource0.jar">
|
|
<exclude name="javax/**/*.java"/>
|
|
</zipfileset>
|
|
</jar>
|
|
<delete file="${output}/kotlin-for-upsource0.jar"/>
|
|
|
|
<!-- sources -->
|
|
<jar jarfile="${output}/kotlin-for-upsource-sources.jar">
|
|
<zipfileset src="${output}/kotlin-compiler-sources.jar" includes="**/*"/>
|
|
<fileset dir="idea/idea-analysis/src"/>
|
|
<fileset dir="idea/ide-common/src"/>
|
|
|
|
<manifest>
|
|
<attribute name="Built-By" value="${manifest.impl.vendor}"/>
|
|
|
|
<attribute name="Implementation-Vendor" value="${manifest.impl.vendor}"/>
|
|
<attribute name="Implementation-Version" value="${build.number}"/>
|
|
</manifest>
|
|
</jar>
|
|
|
|
</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="build-bootstrap-artifacts" depends="dist,zip-compiler"/>
|
|
|
|
<target name="build-artifacts" depends="dist,zip-compiler,kotlin-for-upsource,zip-test-data"/>
|
|
</project>
|