dart-sdk/compiler/build.xml
dgrove@google.com 977977e6ea Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:00:35 +00:00

202 lines
6.9 KiB
XML

<project default="dist">
<!--
DO NOT EDIT THIS FILE. This file is no longer used to build
dartc proper. It is only here to avoid breaking dartium.gyp
short term. Change dartc.xml instead.
-->
<import file="sources.xml"/>
<import file="test_sources.xml"/>
<import file="corelib_sources.xml"/>
<import file="compiler_corelib_sources.xml"/>
<!--
The file build.properties does not exist. If provided, properties can be customized.
-->
<property file="build.properties" />
<!--
Configuration properties.
-->
<property name="build.dir" value="out"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.test.classes.dir" value="${build.dir}/test/classes"/>
<property name="dartc.jar" value="${build.dir}/dartc.jar"/>
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="test.report.dir" value="${build.dir}/test"/>
<property name="third_party.dir" value="../third_party"/>
<property name="d8" location="${third_party.dir}/v8/d8"/>
<property name="test_py" location="../tools/test.py"/>
<property name="closure_compiler.jar" value="${build.dir}/../closure_out/compiler.jar"/>
<!--
Define buildtime and runtime classpaths.
-->
<path id="classpath.compile">
<pathelement location="${third_party.dir}/args4j/2.0.12/args4j-2.0.12.jar"/>
<pathelement location="${closure_compiler.jar}" />
<pathelement location="${third_party.dir}/guava/r09/guava-r09.jar"/>
<pathelement location="${third_party.dir}/json/r2_20080312/json.jar"/>
<pathelement location="${third_party.dir}/rhino/1_7R3/js.jar"/>
</path>
<path id="classpath.runtime">
<path refid="classpath.compile"/>
</path>
<path id="classpath.compile.tests">
<path refid="classpath.compile"/>
<pathelement location="${build.classes.dir}"/>
<pathelement location="${third_party.dir}/junit/v4_8_2/junit.jar"/>
</path>
<path id="classpath.run.tests">
<path refid="classpath.compile.tests"/>
<pathelement location="${build.test.classes.dir}"/>
<pathelement location="${third_party.dir}/hamcrest/v1_3/hamcrest-core-1.3.0RC2.jar"/>
<pathelement location="${third_party.dir}/hamcrest/v1_3/hamcrest-generator-1.3.0RC2.jar"/>
<pathelement location="${third_party.dir}/hamcrest/v1_3/hamcrest-integration-1.3.0RC2.jar"/>
<pathelement location="${third_party.dir}/hamcrest/v1_3/hamcrest-library-1.3.0RC2.jar"/>
</path>
<target name="compile" description="Compiles all of the java source and copies resources to the classes directory.">
<!--
Ensure the necessary subdirectories exist.
-->
<mkdir dir="${build.classes.dir}"/>
<javac destdir="${build.classes.dir}"
sourcepath=""
srcdir="java"
includes="${java_sources}"
fork="true"
debug="true">
<classpath refid="classpath.compile"/>
</javac>
<!--
Copy all non-java resources.
-->
<copy todir="${build.classes.dir}">
<filelist refid="java_resources"/>
</copy>
<!--
Copy the corelib files.
TODO - Extract this into its own jar.
-->
<copy todir="${build.classes.dir}/com/google/dart/corelib/src">
<filelist refid="corelib_resources"/>
</copy>
<copy todir="${build.classes.dir}/com/google/dart/corelib">
<filelist refid="compiler_corelib_resources"/>
</copy>
</target>
<target name="compile-tests" depends="compile" description="Compiles all of the java tests and copies the resources to the test classes directory." >
<mkdir dir="${build.test.classes.dir}"/>
<javac destdir="${build.test.classes.dir}"
sourcepath=""
srcdir="javatests"
includes="${javatests_sources}"
excludes="com/google/dart/compiler/vm/**"
fork="true"
debug="true">
<classpath refid="classpath.compile.tests"/>
</javac>
<!--
Copy the non-java resources.
-->
<copy todir="${build.test.classes.dir}">
<filelist refid="javatests_resources"/>
</copy>
</target>
<target name="dartc.jar" depends="compile" description="Creates a jar for dartc without bundling the dependencies.">
<jar destfile="${dartc.jar}" basedir="${build.classes.dir}" manifest="dartc.mf"/>
</target>
<target name="dist" depends="dartc.jar" description="Creates a directory that contains a standalone distribution for dartc.">
<!--
Ensure the necessary subdirectories exist.
-->
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/lib"/>
<!--
Copy the dart jar to the lib folder.
-->
<copy file="${dartc.jar}" todir="${dist.dir}/lib"/>
<!--
Copy the closure-compiler jar to the lib folder.
-->
<copy file="${closure_compiler.jar}" tofile="${dist.dir}/lib/closure-compiler.jar"/>
<!--
Re-root the classpaths from third_party into the lib folder of the distro.
-->
<pathconvert property="dartc.classpath.runtime.unix" targetos="unix" refid="classpath.runtime">
<regexpmapper from="${third_party.dir}/(.*)" to="$DARTC_LIBS/\1"/>
</pathconvert>
<copy file="scripts/dartc.sh" tofile="${dist.dir}/bin/dartc">
<filterset>
<filter token="CLASSPATH" value="$DARTC_LIBS/dartc.jar:$DARTC_LIBS/closure-compiler.jar:${dartc.classpath.runtime.unix}"/>
</filterset>
</copy>
<chmod file="${dist.dir}/bin/dartc" perm="a+rx"/>
<copy file="scripts/dartc_test.sh" tofile="${dist.dir}/bin/dartc_test">
<filterset>
<filter token="CLASSPATH" value="$DARTC_LIBS/dartc.jar:$DARTC_LIBS/closure-compiler.jar:${dartc.classpath.runtime.unix}"/>
<filter token="D8_EXEC" value="${d8}"/>
</filterset>
</copy>
<chmod file="${dist.dir}/bin/dartc_test" perm="a+rx"/>
<!--
TODO: The following files are not strictly due to dist, move them out.
-->
<copy todir="${build.dir}">
<fileset dir="scripts">
<include name="dartc_run.sh"/>
<include name="dartc_size.sh"/>
<include name="dartc_metrics.sh"/>
</fileset>
<filterset>
<filter token="CLASSPATH" value="$DARTC_LIBS/dartc.jar:$DARTC_LIBS/closure-compiler.jar:${dartc.classpath.runtime.unix}"/>
</filterset>
</copy>
<chmod file="${build.dir}/dartc_run.sh" perm="a+rx"/>
<chmod file="${build.dir}/dartc_size.sh" perm="a+rx"/>
<chmod file="${build.dir}/dartc_metrics.sh" perm="a+rx"/>
<!--
Copy of all of the dartc dependencies to the lib folder.
-->
<copy todir="${dist.dir}/lib">
<path refid="classpath.runtime"/>
<regexpmapper from="${third_party.dir}/(.*)" to="\1"/>
</copy>
</target>
<target name="clean" description="Deletes the build output directory.">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="tests.jar" depends="compile-tests">
<jar destfile="${build.dir}/tests.jar" basedir="${build.test.classes.dir}"/>
</target>
</project>