build.xml: simplify new-kotlinc macro
- passing sources to "-classpath" is no longer needed because the logic was implemented in K2JVMCompiler - skipping javac2 for stdlib is no longer needed because the corresponding error is no longer reproducible since "skip" was added to javac2 - get rid of unneeded properties in favor of Ant's toString feature
This commit is contained in:
@@ -664,20 +664,12 @@
|
|||||||
|
|
||||||
<macrodef name="new-kotlinc">
|
<macrodef name="new-kotlinc">
|
||||||
<attribute name="output"/>
|
<attribute name="output"/>
|
||||||
<attribute name="withJava" default="true"/>
|
|
||||||
<element name="src"/>
|
<element name="src"/>
|
||||||
<!-- This element should have been named "classpath" but it conflicts with classpath elements present in java and javac tasks -->
|
|
||||||
<element name="class-path"/>
|
<element name="class-path"/>
|
||||||
|
|
||||||
<sequential>
|
<sequential>
|
||||||
<cleandir dir="@{output}"/>
|
<cleandir dir="@{output}"/>
|
||||||
|
|
||||||
<!-- All properties declared in this macro should be local because otherwise their value won't change after the first run,
|
|
||||||
which effectively would make this macro non-reusable -->
|
|
||||||
<local name="src.paths"/>
|
|
||||||
<local name="src.line"/>
|
|
||||||
<local name="classpath.paths"/>
|
|
||||||
|
|
||||||
<dirset dir="${basedir}" id="src.dirset">
|
<dirset dir="${basedir}" id="src.dirset">
|
||||||
<src/>
|
<src/>
|
||||||
</dirset>
|
</dirset>
|
||||||
@@ -686,12 +678,9 @@
|
|||||||
<class-path/>
|
<class-path/>
|
||||||
</path>
|
</path>
|
||||||
|
|
||||||
<!-- Source paths separated by the system path separator -->
|
|
||||||
<pathconvert property="src.paths" refid="src.dirset"/>
|
|
||||||
<!-- Source paths separated by space (to pass to "arg line" below) -->
|
<!-- Source paths separated by space (to pass to "arg line" below) -->
|
||||||
|
<local name="src.line"/>
|
||||||
<pathconvert property="src.line" refid="src.dirset" pathsep=" "/>
|
<pathconvert property="src.line" refid="src.dirset" pathsep=" "/>
|
||||||
<!-- Classpath separated by the system path separator -->
|
|
||||||
<pathconvert property="classpath.paths" refid="classpath.path"/>
|
|
||||||
|
|
||||||
<java classname="org.jetbrains.kotlin.cli.jvm.K2JVMCompiler" failonerror="true" fork="true">
|
<java classname="org.jetbrains.kotlin.cli.jvm.K2JVMCompiler" failonerror="true" fork="true">
|
||||||
<classpath>
|
<classpath>
|
||||||
@@ -706,24 +695,18 @@
|
|||||||
<arg value="@{output}"/>
|
<arg value="@{output}"/>
|
||||||
<arg value="-no-stdlib"/>
|
<arg value="-no-stdlib"/>
|
||||||
<arg value="-classpath"/>
|
<arg value="-classpath"/>
|
||||||
<!-- Include source paths to classpath for Kotlin compiler to resolve symbols from Java sources -->
|
<arg value="${toString:classpath.path}"/>
|
||||||
<arg value="${src.paths}${path.separator}${classpath.paths}"/>
|
|
||||||
</java>
|
</java>
|
||||||
|
|
||||||
<if>
|
<javac2 srcdir="${toString:src.dirset}" destdir="@{output}" debug="true" debuglevel="lines,vars,source"
|
||||||
<equals arg1="@{withJava}" arg2="true"/>
|
includeAntRuntime="false" source="${java.target}" target="${java.target}">
|
||||||
<then>
|
<skip pattern="kotlin/jvm/internal/.*"/>
|
||||||
<javac2 srcdir="${src.paths}" destdir="@{output}" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
|
<classpath>
|
||||||
source="${java.target}" target="${java.target}">
|
<path refid="classpath.path"/>
|
||||||
<skip pattern="kotlin/jvm/internal/.*"/>
|
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
|
||||||
<classpath>
|
<pathelement location="@{output}"/>
|
||||||
<path refid="classpath.path"/>
|
</classpath>
|
||||||
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
|
</javac2>
|
||||||
<pathelement location="@{output}"/>
|
|
||||||
</classpath>
|
|
||||||
</javac2>
|
|
||||||
</then>
|
|
||||||
</if>
|
|
||||||
</sequential>
|
</sequential>
|
||||||
</macrodef>
|
</macrodef>
|
||||||
|
|
||||||
@@ -734,12 +717,15 @@
|
|||||||
<include name="core/runtime.jvm/src"/>
|
<include name="core/runtime.jvm/src"/>
|
||||||
<include name="core/reflection/src"/>
|
<include name="core/reflection/src"/>
|
||||||
</src>
|
</src>
|
||||||
<class-path/>
|
<class-path>
|
||||||
|
<!-- Need something to pass to compiler's "-classpath" here -->
|
||||||
|
<pathelement location="core/builtins/src"/>
|
||||||
|
</class-path>
|
||||||
</new-kotlinc>
|
</new-kotlinc>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="stdlib">
|
<target name="stdlib">
|
||||||
<new-kotlinc output="${output}/classes/stdlib" withJava="false">
|
<new-kotlinc output="${output}/classes/stdlib">
|
||||||
<src>
|
<src>
|
||||||
<include name="libraries/stdlib/src"/>
|
<include name="libraries/stdlib/src"/>
|
||||||
</src>
|
</src>
|
||||||
|
|||||||
Reference in New Issue
Block a user