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:
Alexander Udalov
2015-01-31 18:50:20 +03:00
parent e802044c60
commit 5b70995ce1
+16 -30
View File
@@ -664,20 +664,12 @@
<macrodef name="new-kotlinc">
<attribute name="output"/>
<attribute name="withJava" default="true"/>
<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"/>
<sequential>
<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">
<src/>
</dirset>
@@ -686,12 +678,9 @@
<class-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) -->
<local name="src.line"/>
<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">
<classpath>
@@ -706,24 +695,18 @@
<arg value="@{output}"/>
<arg value="-no-stdlib"/>
<arg value="-classpath"/>
<!-- Include source paths to classpath for Kotlin compiler to resolve symbols from Java sources -->
<arg value="${src.paths}${path.separator}${classpath.paths}"/>
<arg value="${toString:classpath.path}"/>
</java>
<if>
<equals arg1="@{withJava}" arg2="true"/>
<then>
<javac2 srcdir="${src.paths}" destdir="@{output}" debug="true" debuglevel="lines,vars,source" includeAntRuntime="false"
source="${java.target}" target="${java.target}">
<skip pattern="kotlin/jvm/internal/.*"/>
<classpath>
<path refid="classpath.path"/>
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
<pathelement location="@{output}"/>
</classpath>
</javac2>
</then>
</if>
<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/.*"/>
<classpath>
<path refid="classpath.path"/>
<!-- Include @{output} here for Java compiler to resolve symbols from Kotlin sources -->
<pathelement location="@{output}"/>
</classpath>
</javac2>
</sequential>
</macrodef>
@@ -734,12 +717,15 @@
<include name="core/runtime.jvm/src"/>
<include name="core/reflection/src"/>
</src>
<class-path/>
<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" withJava="false">
<new-kotlinc output="${output}/classes/stdlib">
<src>
<include name="libraries/stdlib/src"/>
</src>