Permalink
Fetching contributors…
Cannot retrieve contributors at this time
1172 lines (1060 sloc) 52.3 KB
<project name="buck" default="default">
<property environment="env"/>
<property name="src.dir" value="${basedir}/src" />
<property name="aosp.src.dir" value="third-party/java/aosp/src" />
<property name="test.dir" value="${basedir}/test" />
<property name="third-party.dir" value="${basedir}/third-party" />
<property name="build.dir" value="${basedir}/ant-out" />
<property name="build.successful.file" value="${build.dir}/successful-build" />
<property name="classes.dir.name" value="classes" />
<property name="classes.dir" value="${build.dir}/${classes.dir.name}" />
<property name="buck.modules.classes.dir.name" value="buck-modules-classes" />
<property name="buck.modules.classes.dir" value="${build.dir}/${buck.modules.classes.dir.name}" />
<property name="buck.modules.annotation.processor.src.dir" value="com/facebook/buck/core/module/annotationprocessor" />
<property name="buck.modules.ap.classes.dir.name" value="buck-modules-ap-classes" />
<property name="buck.modules.annotation.processor.classes.dir" value="${build.dir}/${buck.modules.ap.classes.dir.name}" />
<property name="buck.modules.annotation.processor.jar" value="${build.dir}/buck-modules-ap.jar" />
<property name="aosp.classes.dir.name" value="aosp/classes" />
<property name="aosp.classes.dir" value="${build.dir}/${aosp.classes.dir.name}" />
<property name="testrunner.classes.dir" value="${build.dir}/testrunner/classes" />
<property name="bootstrapper.src.dir" value="com/facebook/buck/cli/bootstrapper/" />
<property name="bootstrapper.classes.dir.name" value="bootstrapper/classes" />
<property name="bootstrapper.classes.dir" value="${build.dir}/${bootstrapper.classes.dir.name}" />
<property name="bootstrapper.jar" value="${build.dir}/bootstrapper/bootstrapper.jar" />
<property name="tracing-api.src.dir" value="com/facebook/buck/event/api/" />
<property name="tracing-api.classes.dir.name" value="tracing-api/classes" />
<property name="tracing-api.classes.dir" value="${build.dir}/${tracing-api.classes.dir.name}" />
<property name="tracing-api.jar" value="${build.dir}/tracing-api/tracing-api.jar"/>
<property name="javac-plugin.classes.dir.name" value="javac-plugin/classes" />
<property name="javac-plugin.classes.dir" value="${build.dir}/${javac-plugin.classes.dir.name}" />
<property name="javac-plugin.jar.name" value="javac-plugin.jar" />
<property name="javac-plugin.jar" value="${build.dir}/javac-plugin/${javac-plugin.jar.name}" />
<property name="javac-plugin.location.dir.name" value="com/facebook/buck/jvm/java/plugin" />
<property name="javac-plugin.location.dir" value="${classes.dir}/${javac-plugin.location.dir.name}" />
<property name="buck.path_to_sh_binary_template" value="${basedir}/src/com/facebook/buck/shell/sh_binary_template" />
<property name="buck.path_to_isolated_trampoline" value="${basedir}/src/com/facebook/buck/rules/modern/builders/trampoline.sh" />
<property name="buck.logging_config_file" value="${basedir}/config/logging.properties.st" />
<property name="javadoc.dir" value="${build.dir}/javadoc" />
<property name="javadoc-with-android.dir" value="${build.dir}/javadoc-with-android" />
<property name="javadoc-all.dir" value="${build.dir}/javadoc-all" />
<property name="lint.outputpath" value="${build.dir}/lint.output" />
<property name="dx.base.dir" value="${basedir}/third-party/java/dx" />
<property name="dx.src.dir" value="${dx.base.dir}/src" />
<property name="dx.test.dir" value="${dx.base.dir}/tests" />
<property name="dx.etc.dir" value="${dx.base.dir}/etc" />
<property name="dx.classes.dir.name" value="dx_classes" />
<property name="dx.classes.dir" value="${build.dir}/${dx.classes.dir.name}" />
<property name="eclipse.dir" value="${basedir}/third-party/java/eclipse" />
<property name="pathlib.dir" value="${third-party.dir}/py/pathlib" />
<property name="pywatchman.dir" value="${third-party.dir}/py/pywatchman" />
<property name="typing.dir" value="${third-party.dir}/py/typing/python2" />
<property name="nailgun.dir" value="${third-party.dir}/nailgun" />
<property name="immutables-builder-standalone.jar" value="${third-party.dir}/java/immutables/builder-2.5.7-SNAPSHOT.jar" />
<property name="immutables-value-standalone.jar" value="${third-party.dir}/java/immutables/value-2.5.7-SNAPSHOT.jar" />
<property name="pf4j-standalone.jar" value="${third-party.dir}/java/pf4j/pf4j-2.0.0-SNAPSHOT.jar" />
<property name="pf4j-annotation-processor-storage-config" value="-Apf4j.storageClassName=org.pf4j.processor.ServiceProviderExtensionStorage" />
<property name="manual.gensrc.dir" value="${basedir}/src-gen" />
<property name="manual.gensrc.classes.dir.name" value="src-gen/classes" />
<property name="manual.gensrc.classes.dir" value="${build.dir}/${manual.gensrc.classes.dir.name}" />
<property name="gensrc.dir" value="${build.dir}/gen" />
<property name="aosp.gensrc.dir" value="${build.dir}/aosp-gen" />
<property name="devbuild" value="0" />
<condition property="eclipse.jdt.core.prefs.file"
value="org.eclipse.jdt.core.prefs"
else="org.eclipse.jdt.core.prefs-dev"
>
<equals arg1="${devbuild}" arg2="0" />
</condition>
<property name="buck.hash.dir" value="${build.dir}/classes/META-INF"/>
<property name="buck.hash.file" value="${buck.hash.dir}/buck-binary-hash.txt"/>
<property name="buck.combined.hash.file" value="${buck.hash.dir}/buck-combined-binary-hash.txt"/>
<property name="buck.info.file" value="${build.dir}/buck-info.json"/>
<property name="modules.dir.name" value="buck-modules" />
<property name="modules.resources.dir.name" value="buck-modules-resources" />
<property name="ecj.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter" />
<property name="ecj.compiler.path" value="${eclipse.dir}/ecj-4.7.1.jar" />
<property name="error.prone.compiler" value="com.google.errorprone.ErrorProneAntCompilerAdapter" />
<property name="error.prone.compiler.path" value="${third-party.dir}/java/errorprone/error_prone_ant-2.2.0.jar" />
<!-- Control whether ErrorProne compiler is enabled. Disabled by default. -->
<property name="error.prone" value="false" />
<condition property="buck.build.compiler" value="${error.prone.compiler}" else="${ecj.compiler}">
<istrue value="${error.prone}" />
</condition>
<condition property="buck.build.compiler.jar.path" value="${error.prone.compiler.path}"
else="${ecj.compiler.path}">
<istrue value="${error.prone}" />
</condition>
<!-- Javadoc in 1.8 became stricter about parsing the docs. This disables some of those checks -->
<available property="jdk1.8" classname="java.util.stream.Stream"/>
<condition
property="javadoc.doclint"
value="-Xdoclint:-reference"
else="">
<and>
<isset property="jdk1.8"/>
</and>
</condition>
<fileset dir="${third-party.dir}/java" id="buck.jars">
<include name="args4j/args4j-2.0.30.jar" />
<include name="android/ddmlib-25.3.0.jar" />
<include name="diffutils/diffutils-1.3.0.jar" />
<include name="ini4j/ini4j-0.5.2.jar" />
<include name="jackson/jackson-annotations-2.7.8.jar" />
<include name="jackson/jackson-core-2.7.8.jar" />
<include name="jackson/jackson-databind-2.7.8.jar" />
<include name="jackson/jackson-datatype-jdk8-2.7.8.jar" />
<include name="jackson/jackson-datatype-guava-2.7.8.jar" />
<include name="android/sdklib-25.3.0.jar" />
<include name="nailgun/nailgun-server-0.9.3-SNAPSHOT.jar" />
<include name="jna/jna-4.5.1.jar" />
<include name="jna/jna-platform-4.5.1.jar" />
<include name="sqlite/sqlite-jdbc-3.20.0.jar" />
<include name="bazel/skylark-lang_deploy.jar" />
<include name="googleapis/googleapis.jar" />
</fileset>
<fileset dir="${third-party.dir}/java" id="third-party.jars">
<include name="ObjCBridge/ObjCBridge.jar" />
<include name="android/common-25.3.0.jar" />
<include name="android/layoutlib-api-25.3.0.jar" />
<include name="android/sdk-common-25.3.0.jar" />
<include name="aopalliance/aopalliance.jar" />
<include name="aosp/apksig.jar" />
<include name="asm/asm*-6.0.jar" />
<include name="bazel/skylark-lang_deploy.jar" />
<include name="bundletool/bundle.jar" />
<include name="closure-templates/soy-excluding-deps.jar" />
<include name="commons-compress/commons-compress-1.17.jar" />
<include name="commons-logging/commons-logging-1.2.jar" />
<include name="concurrent-locks/concurrent-locks-1.0.0.jar" />
<include name="d8/d8.jar" />
<include name="dd-plist/dd-plist.jar" />
<include name="eclipse/org.eclipse.core.contenttype_3.5.100.v20160418-1621.jar"/>
<include name="eclipse/org.eclipse.core.jobs_3.8.0.v20160319-0610.jar"/>
<include name="eclipse/org.eclipse.core.resources_3.11.0.v20160422-0304.jar"/>
<include name="eclipse/org.eclipse.core.runtime_3.12.0.v20160427-1901.jar"/>
<include name="eclipse/org.eclipse.equinox.common_3.8.0.v20160422-1942.jar"/>
<include name="eclipse/org.eclipse.equinox.preferences_3.6.0.v20160120-1756.jar"/>
<include name="eclipse/org.eclipse.jdt.core_3.12.0.v20160426-1326.jar"/>
<include name="eclipse/org.eclipse.osgi_3.11.0.v20160427-2120.jar"/>
<include name="eden/eden.jar" />
<include name="eden/java-thrift-dependencies.jar" />
<include name="errorprone/error_prone_annotations-2.0.19.jar" />
<include name="fastutil/fastutil-7.2.0.jar" />
<include name="guava/guava-20.0.jar" />
<include name="guava/guava-23.3-jre.jar" />
<include name="grpc/grpc-context-1.11.0.jar" />
<include name="grpc/grpc-core-1.10.1.jar" />
<include name="grpc/grpc-netty-1.10.1.jar" />
<include name="grpc/grpc-protobuf-1.10.1.jar" />
<include name="grpc/grpc-protobuf-lite-1.11.0.jar" />
<include name="grpc/grpc-stub-1.10.1.jar" />
<include name="netty/netty-all-4.1.24.Final.jar" />
<include name="gson/gson-2.8.2.jar" />
<include name="guice/guice-3.0.jar" />
<include name="guice/guice-assistedinject-3.0.jar" />
<include name="guice/guice-multibindings-3.0.jar" />
<include name="icu4j/icu4j-54.1.1.jar" />
<include name="immutables/builder-2.5.7-SNAPSHOT.jar" />
<include name="immutables/value-2.5.7-SNAPSHOT.jar" />
<include name="infer-annotations/infer-annotations-4.2.jar" />
<include name="jacoco/org.jacoco.core-0.8.0.jar" />
<include name="jacoco/org.jacoco.report-0.8.0.jar" />
<include name="jdom/jdom-2.0.6.jar" />
<include name="jetty/jetty-all-9.4.9.v20180320-uber.jar" />
<include name="jimfs/jimfs-1.1.jar" />
<include name="jopt-simple/jopt-simple-4.6.jar" />
<include name="json-simple/json-simple-1.1.1.jar" />
<include name="kotlinx-metadata-jvm/kotlinx-metadata-jvm-0.0.3.jar" />
<include name="jsr/javax.inject-1.jar" />
<include name="jsr/jsr305.jar" />
<include name="nuprocess/nuprocess-1.2.4.jar" />
<include name="objenesis/objenesis-1.2.jar" />
<include name="okhttp/okhttp-3.9.0.jar" />
<include name="okio/okio-1.13.0.jar" />
<include name="opencensus/opencensus-api-0.12.2.jar" />
<include name="opencensus/opencensus-contrib-grpc-metrics-0.12.2.jar" />
<include name="oshi/oshi-core-3.3-SNAPSHOT.jar" />
<include name="pf4j/pf4j-2.0.0-SNAPSHOT.jar" />
<include name="protobuf/protobuf-java-3.5.1.jar" />
<include name="protobuf/protobuf-java-util-3.5.1.jar" />
<include name="protobuf/protobuf-lite-3.0.1.jar" />
<include name="slf4j/slf4j-jdk14-1.7.5.jar" /><!-- redirect slf4j to java.util.logging -->
<include name="stringtemplate/ST-4.0.8.jar" />
<include name="thrift/libthrift-0.10.0-patched.jar" />
<include name="xz-java-1.5/xz-1.5.jar" />
<include name="zstd-jni/zstd-jni-1.3.5-2.jar" />
<!-- maven interop -->
<include name="aether/aether-api-1.0.2.v20150114.jar" />
<include name="aether/aether-connector-basic-1.0.2.v20150114.jar" />
<include name="aether/aether-impl-1.0.0.v20140518.jar" />
<include name="aether/aether-spi-1.0.2.v20150114.jar" />
<include name="aether/aether-transport-http-1.0.2.v20150114.jar" />
<include name="aether/aether-transport-file-1.0.2.v20150114.jar" />
<include name="aether/aether-util-1.0.2.v20150114.jar" />
<include name="httpcomponents/httpclient-4.4.1.jar" />
<include name="httpcomponents/httpcore-4.4.1.jar" />
<include name="maven/maven-aether-provider-3.2.5.jar" />
<include name="maven/maven-model-3.2.5.jar" />
<include name="maven/maven-model-builder-3.2.5.jar" />
<include name="maven/maven-repository-metadata-3.2.5.jar" />
<include name="plexus/plexus-component-annotations-1.5.5.jar" />
<include name="plexus/plexus-utils-3.0.20.jar" />
<include name="plexus/plexus-interpolation-1.21.jar" />
<include name="slf4j/jcl-over-slf4j-1.6.2.jar" />
<include name="slf4j/slf4j-api-1.7.5.jar" />
</fileset>
<path id="classpath-no-src-no-aosp">
<fileset refid="buck.jars" />
<fileset refid="third-party.jars" />
<pathelement location="${classes.dir}" />
<pathelement location="${dx.classes.dir}" />
<pathelement location="${bootstrapper.jar}" />
<pathelement location="${manual.gensrc.classes.dir}" />
</path>
<path id="classpath-no-src">
<path refid="classpath-no-src-no-aosp" />
<pathelement location="${aosp.classes.dir}" />
</path>
<path id="classpath">
<path refid="classpath-no-src" />
<pathelement location="${src.dir}" />
<pathelement location="${manual.gensrc.dir}" />
</path>
<path id="classpath-compile-manual-gen-src">
<fileset refid="third-party.jars" />
</path>
<path id="processorpath">
<pathelement location="${immutables-value-standalone.jar}"/>
<pathelement location="${immutables-builder-standalone.jar}"/>
<pathelement location="${pf4j-standalone.jar}"/>
</path>
<pathconvert refid="processorpath" property="processorpath" />
<path id="module.processorpath">
<pathelement location="${immutables-value-standalone.jar}"/>
<pathelement location="${immutables-builder-standalone.jar}"/>
<pathelement location="${pf4j-standalone.jar}"/>
<pathelement location="${buck.modules.annotation.processor.jar}"/>
</path>
<pathconvert refid="module.processorpath" property="module.processorpath" />
<target name="clean" description="remove all generated files" depends="clear-successful-build">
<delete dir="${build.dir}" />
</target>
<target name="clear-successful-build">
<delete file="${build.successful.file}"/>
</target>
<target name="mark-successful-build">
<touch file="${build.successful.file}"/>
</target>
<!-- Default target so that a command line build can
do more than one thing.
clear-successful-build must be first, and mark-successful-build last, in the list of dependencies.-->
<target name="default" depends="clear-successful-build, compile, build-modules, copy-resources,
dx, javac-plugin, report-generator-jar, create-classpath,
create-classpath-hash, gen-buck-info, mark-successful-build" />
<target name="checkversion">
<!-- The function Function class was only introduced in Java 8. -->
<available property="jdk8" classname="java.util.function.Function"/>
<fail message="Require JDK 8 or higher" unless="jdk8"/>
</target>
<target name="compile-manual-gen-src" depends="checkversion">
<mkdir dir="${manual.gensrc.classes.dir}" />
<javac srcdir="${manual.gensrc.dir}"
destdir="${manual.gensrc.classes.dir}"
classpathref="classpath-compile-manual-gen-src"
debug="on"
includeAntRuntime="no"
>
</javac>
</target>
<path id="testrunner.classpath">
<fileset refid="testrunner.jars" />
</path>
<fileset dir="${third-party.dir}/java" id="testrunner.jars">
<include name="android/ddmlib-25.3.0.jar" />
<include name="guava/guava-20.0.jar" />
<include name="guava/guava-23.3-jre.jar" />
<include name="guice/guice-3.0.jar" />
<include name="jsr/javax.inject-1.jar" />
<include name="jsr/jsr305.jar" />
<include name="junit/junit-4.12.jar" />
<include name="testng/testng-6.8.jar" />
</fileset>
<target name="compile-testrunner" depends="checkversion">
<mkdir dir="${testrunner.classes.dir}" />
<javac srcdir="${src.dir}"
includes="com/facebook/buck/log/AppendableLogRecord.java,com/facebook/buck/testrunner/**,com/facebook/buck/util/concurrent/MoreExecutors.java,com/facebook/buck/jvm/java/runner/**"
destdir="${testrunner.classes.dir}"
classpathref="testrunner.classpath"
debug="on"
includeAntRuntime="no"
>
<compilerarg value="-Xlint:rawtypes" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-Werror" />
</javac>
</target>
<path id="bootstrapper-classpath">
<!-- Do not add dependencies. The bootstrapper is intended to keep the system ClassLoader free
of classes that might conflict with those used by compiler plugins and annotation
processors. As such it cannot depend on third-party libraries, directly or indirectly. -->
</path>
<target name="bootstrapper" depends="checkversion, tracing-api">
<mkdir dir="${bootstrapper.classes.dir}" />
<compiler destdir="${bootstrapper.classes.dir}" classpathref="bootstrapper-classpath">
<javac-params>
<include name="${bootstrapper.src.dir}/**/*.java" />
<include name="com/facebook/buck/util/liteinfersupport/Nullable.java" />
<include name="com/facebook/buck/util/liteinfersupport/Preconditions.java" />
<include name="com/facebook/buck/util/liteinfersupport/PropagatesNullable.java" />
<include name="com/facebook/buck/jvm/java/plugin/api/*.java" />
<include name="com/facebook/buck/jvm/java/abi/source/api/*.java" />
<include name="com/facebook/buck/jvm/java/lang/model/*.java" />
</javac-params>
</compiler>
<jar destfile="${bootstrapper.jar}">
<fileset dir="${bootstrapper.classes.dir}" />
<!-- Be very careful what is added here, and leave comments justifying each addition. See the
comment in bootstrapper-classpath above for more details on why. -->
<!-- The Tracing API jar must be accessible to both Buck and compiler plugins, so we put it
in the bootstrapper. Compiler plugins will have their own copy linked in, but the ClassLoaders
will end up loading this one instead when they are run inside Buck. -->
<zipfileset src="${tracing-api.jar}" />
</jar>
</target>
<path id="tracing-api.classpath">
<!-- The Tracing API is a very light JAR meant to be included in compiler plugins that may
be run outside of Buck. As such, it can take no dependencies. -->
</path>
<target name="tracing-api" depends="checkversion">
<mkdir dir="${tracing-api.classes.dir}" />
<compiler destdir="${tracing-api.classes.dir}" classpathref="tracing-api.classpath">
<javac-params>
<include name="${tracing-api.src.dir}/**/*.java"/>
</javac-params>
</compiler>
<jar destfile="${tracing-api.jar}">
<fileset dir="${tracing-api.classes.dir}"/>
</jar>
</target>
<path id="javac-plugin.classpath">
<!-- This jar is loaded in each compiler class loader, which is unrelated to Buck's class
loader. Do not take dependencies on Buck code outside of the bootstrapper here. Compiler
code (tools.jar) and third-party libraries are OK, though keep in mind that every class included
in the jar will be freshly loaded for each invocation of the compiler. -->
<pathelement location="${third-party.dir}/java/jdk/stub-compiler-tree-api.jar" />
<pathelement location="${bootstrapper.jar}" />
</path>
<target name="javac-plugin" depends="checkversion, tracing-api">
<mkdir dir="${javac-plugin.classes.dir}" />
<compiler destdir="${javac-plugin.classes.dir}" classpathref="javac-plugin.classpath">
<javac-params>
<include name="com/facebook/buck/util/liteinfersupport/Nullable.java" />
<include name="com/facebook/buck/util/liteinfersupport/Preconditions.java" />
<include name="com/facebook/buck/util/liteinfersupport/PropagatesNullable.java" />
<include name="com/facebook/buck/jvm/java/abi/source/*.java" />
<include name="com/facebook/buck/jvm/java/plugin/adapter/**/*.java" />
</javac-params>
</compiler>
<jar destfile="${javac-plugin.jar}">
<fileset dir="${javac-plugin.classes.dir}"/>
</jar>
<!-- Put the tracing jar in resources so it can be dynamically loaded at runtime. See
com.facebook.buck.jvm.java.plugin.Plugin -->
<copy file="${javac-plugin.jar}" todir="${javac-plugin.location.dir}" />
</target>
<target name="compile-aosp" depends="checkversion">
<mkdir dir="${aosp.classes.dir}" />
<compiler srcdir="${aosp.src.dir}" destdir="${aosp.classes.dir}" gensrcdir="${aosp.gensrc.dir}">
<compiler-params>
<!-- suppress ManifestMerger2 warnings -->
<compilerarg value="-err:-all" compiler="${ecj.compiler}"/>
<compilerarg value="-warn:-all" compiler="${ecj.compiler}"/>
</compiler-params>
</compiler>
</target>
<macrodef name="compiler" description="Compile Java using the buck.build.compiler compiler.">
<attribute name="srcdir" default="${src.dir}" />
<attribute name="classpathref" default="classpath-no-src" />
<attribute name="destdir" default="${classes.dir}" />
<attribute name="gensrcdir" default="${gensrc.dir}" />
<!--
javac-params can contain any extra parameters to the javac ant command.
include and exclude elements are automatically relative to ${src.dir}.
According to http://ant.apache.org/manual/Tasks/javac.html, the only way
to enumerate the .java inputs to javac in Ant is to set the sourcepath
to the empty string, set the srcdir to something, and use include/exclude
elements to filter things under the srcdir.
-->
<element name="javac-params" optional="true" />
<!--
compiler-params can contain any extra parameters to the buck.build.compiler compiler.
-->
<element name="compiler-params" optional="true" />
<sequential>
<mkdir dir="@{gensrcdir}" />
<mkdir dir="@{destdir}" />
<javac srcdir="@{srcdir}"
sourcepath=""
destdir="@{destdir}"
classpathref="@{classpathref}"
debug="on"
deprecation="on"
includeAntRuntime="no"
compiler="${buck.build.compiler}"
>
<javac-params />
<!--
ecj does not appear to support -Werror. As suggested by
http://stackoverflow.com/a/14927725/396304, we specify an Eclipse preferences
file to ECJ with the rules we want to enforce set to error.
To see the full list of compiler options available, read the Javadoc for JavaCore at:
http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fjdt%2Fcore%2FJavaCore.html
Apparently Eclipse refuses to publish traditional Javadoc with manageable URLs.
-->
<compilerarg line="-properties '${eclipse.dir}/${eclipse.jdt.core.prefs.file}'" compiler="${ecj.compiler}" />
<compilerarg value="-Xlint:rawtypes" />
<compilerarg value="-Xlint:unchecked" />
<compilerarg value="-time" compiler="${ecj.compiler}" />
<compilerclasspath>
<pathelement location="${buck.build.compiler.jar.path}" />
</compilerclasspath>
<compilerarg value="-s" />
<compilerarg value="@{gensrcdir}" />
<!-- error-prone does not like referencing concrete immutables classes -->
<compilerarg value="-Xep:NonCanonicalStaticImport:OFF" compiler="${error.prone.compiler}" />
<!-- there is no point in checking generated code -->
<compilerarg value="-XepDisableWarningsInGeneratedCode" compiler="${error.prone.compiler}" />
<compiler-params />
</javac>
</sequential>
</macrodef>
<target name="package-resources">
<mkdir dir="${classes.dir}/com/facebook/buck/android"/>
<copy file="${third-party.dir}/java/android/ddmlib-25.3.0.jar"
tofile="${classes.dir}/com/facebook/buck/android/ddmlib.jar"/>
<copy file="${third-party.dir}/java/android/common-25.3.0.jar"
tofile="${classes.dir}/com/facebook/buck/android/android-tools-common.jar"/>
<copy file="${third-party.dir}/java/kxml2/kxml2-2.3.0.jar"
tofile="${classes.dir}/com/facebook/buck/android/kxml2.jar"/>
<copy file="${third-party.dir}/java/guava/guava-20.0.jar"
tofile="${classes.dir}/com/facebook/buck/android/guava.jar"/>
</target>
<target name="compile"
depends="compile-buck-modules-annotation-processor, compile-testrunner, compile-aosp,
compile-manual-gen-src, bootstrapper, package-resources, tracing-api, dx"
description="compile Java source code">
<mkdir dir="${classes.dir}" />
<compiler>
<javac-params>
<compilerarg value="-processorpath" />
<compilerarg value="${processorpath}" />
<compilerarg value="${pf4j-annotation-processor-storage-config}" />
<patternset>
<!--
These patterns are excluded because they are compiled elsewhere
and are deliberately isolated from Buck's core.
-->
<exclude name="com/facebook/buck/cli/bootstrapper/**" />
<exclude name="com/facebook/buck/core/module/annotationprocessor/**" />
<exclude name="com/facebook/buck/event/api/**" />
<exclude name="com/facebook/buck/features/**" />
<exclude name="com/facebook/buck/jvm/java/abi/source/**" />
<exclude name="com/facebook/buck/jvm/java/lang/model/**" />
<exclude name="com/facebook/buck/jvm/java/plugin/adapter/**" />
<exclude name="com/facebook/buck/testrunner/**" />
</patternset>
</javac-params>
</compiler>
</target>
<target name="compile-buck-modules-annotation-processor">
<mkdir dir="${buck.modules.annotation.processor.classes.dir}" />
<compiler destdir="${buck.modules.annotation.processor.classes.dir}">
<javac-params>
<include name="${buck.modules.annotation.processor.src.dir}/**/*.java" />
</javac-params>
</compiler>
<jar destfile="${buck.modules.annotation.processor.jar}">
<fileset dir="${buck.modules.annotation.processor.classes.dir}" />
<fileset dir="src">
<include name="${buck.modules.annotation.processor.src.dir}/**/*.st"/>
</fileset>
<zipfileset src="${basedir}/third-party/java/stringtemplate/ST-4.0.8.jar" />
<service type="javax.annotation.processing.Processor"
provider="com.facebook.buck.core.module.annotationprocessor.BuckModuleAnnotationProcessor"/>
</jar>
</target>
<target name="build-modules" depends="
build-module-d,
build-module-dotnet,
build-module-filebundler,
build-module-filegroup,
build-module-go,
build-module-gwt,
build-module-halide,
build-module-haskell,
build-module-intellij,
build-module-js,
build-module-lua,
build-module-ocaml,
build-module-python,
build-module-rust,
build-module-xcode,
build-module-ziprules
"/>
<target name="build-module-d" depends="compile">
<build-buck-module-jar module-name="d">
<module-javac-params>
<include name="com/facebook/buck/features/d/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-dotnet" depends="compile">
<build-buck-module-jar module-name="dotnet">
<module-javac-params>
<include name="com/facebook/buck/features/dotnet/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-filebundler" depends="compile">
<build-buck-module-jar module-name="filebundler">
<module-javac-params>
<include name="com/facebook/buck/features/filebundler/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-filegroup" depends="compile, build-module-filebundler">
<build-buck-module-jar module-name="filegroup">
<module-javac-params>
<include name="com/facebook/buck/features/filegroup/**/*.java" />
</module-javac-params>
<additional-classpath-entries>
<include name="filebundler.jar"/>
</additional-classpath-entries>
</build-buck-module-jar>
</target>
<target name="build-module-go" depends="compile">
<build-buck-module-jar-with-resources module-name="go">
<module-javac-params>
<include name="com/facebook/buck/features/go/**/*.java" />
</module-javac-params>
<module-resources>
<include name="com/facebook/buck/features/go/*.in"/>
</module-resources>
</build-buck-module-jar-with-resources>
</target>
<target name="build-module-gwt" depends="compile">
<build-buck-module-jar module-name="gwt">
<module-javac-params>
<include name="com/facebook/buck/features/gwt/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-halide" depends="compile">
<build-buck-module-jar module-name="halide">
<module-javac-params>
<include name="com/facebook/buck/features/halide/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-haskell" depends="compile">
<build-buck-module-jar module-name="haskell">
<module-javac-params>
<include name="com/facebook/buck/features/haskell/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-intellij" depends="compile">
<build-buck-module-jar-with-resources module-name="intellij">
<module-javac-params>
<include name="com/facebook/buck/features/project/intellij/**/*.java" />
</module-javac-params>
<module-resources>
<include name="com/facebook/buck/features/project/intellij/templates/*.st"/>
</module-resources>
</build-buck-module-jar-with-resources>
</target>
<target name="build-module-js" depends="compile">
<build-buck-module-jar module-name="js">
<module-javac-params>
<include name="com/facebook/buck/features/js/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-lua" depends="compile, build-module-python">
<build-buck-module-jar-with-resources module-name="lua">
<module-javac-params>
<include name="com/facebook/buck/features/lua/**/*.java" />
</module-javac-params>
<additional-classpath-entries>
<include name="python.jar"/>
</additional-classpath-entries>
<module-resources>
<include name="com/facebook/buck/features/lua/*.in"/>
</module-resources>
</build-buck-module-jar-with-resources>
</target>
<target name="build-module-ocaml" depends="compile">
<build-buck-module-jar module-name="ocaml">
<module-javac-params>
<include name="com/facebook/buck/features/ocaml/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-python" depends="compile">
<build-buck-module-jar-with-resources module-name="python">
<module-javac-params>
<include name="com/facebook/buck/features/python/**/*.java" />
</module-javac-params>
<module-resources>
<include name="com/facebook/buck/features/python/*.in"/>
<include name="com/facebook/buck/features/python/__test_main__.py"/>
</module-resources>
</build-buck-module-jar-with-resources>
<copy-buck-module-external-resources module-name="python">
<module-external-resources>
<fileset dir="${src.dir}/com/facebook/buck/features/python">
<include name="make_pex.py"/>
</fileset>
</module-external-resources>
</copy-buck-module-external-resources>
</target>
<target name="build-module-rust" depends="compile">
<build-buck-module-jar module-name="rust">
<module-javac-params>
<include name="com/facebook/buck/features/rust/**/*.java" />
</module-javac-params>
</build-buck-module-jar>
</target>
<target name="build-module-xcode" depends="compile, build-module-halide, build-module-js">
<build-buck-module-jar-with-resources module-name="xcode">
<module-javac-params>
<include name="com/facebook/buck/features/apple/project/*.java" />
</module-javac-params>
<module-resources>
<include name="com/facebook/buck/features/apple/project/*.st"/>
</module-resources>
<additional-classpath-entries>
<include name="js.jar"/>
<include name="halide.jar"/>
</additional-classpath-entries>
</build-buck-module-jar-with-resources>
</target>
<target name="build-module-ziprules" depends="compile, build-module-filebundler">
<build-buck-module-jar module-name="ziprules">
<module-javac-params>
<include name="com/facebook/buck/features/zip/rules/**/*.java" />
</module-javac-params>
<additional-classpath-entries>
<include name="filebundler.jar"/>
</additional-classpath-entries>
</build-buck-module-jar>
</target>
<fileset dir="${third-party.dir}/java" id="dx.jars">
<include name="guava/guava-23.3-jre.jar" />
</fileset>
<path id="dx.classpath">
<fileset refid="dx.jars" />
</path>
<target name="dx-check-build">
<uptodate property="dx-build-not-required" targetfile="${build.dir}/dx.jar">
<srcfiles dir="${dx.src.dir}" includes="**/*.java" />
<srcfiles dir="${third-party.dir}/java/guava" includes="guava-*.jar" />
<srcfiles dir="${third-party.dir}/java/junit" includes="junit-*.jar" />
</uptodate>
</target>
<target name="dx" depends="dx-check-build" unless="dx-build-not-required">
<mkdir dir="${dx.classes.dir}" />
<javac destdir="${dx.classes.dir}"
classpathref="dx.classpath"
debug="on"
deprecation="on"
includeAntRuntime="no"
>
<src path="${dx.src.dir}" />
</javac>
<jar destfile="${build.dir}/dx.jar">
<zipfileset includes="**/*.class" src="${third-party.dir}/java/guava/guava-23.3-jre.jar"/>
<zipfileset includes="**/*.class" src="${third-party.dir}/java/junit/junit-4.12.jar" />
<fileset dir="${dx.classes.dir}" />
<manifest>
<attribute name="Main-Class" value="com.android.dx.command.Main" />
</manifest>
</jar>
</target>
<!--
Note: two of the dx tests (the two tests for the merger) run the command
"dalvik" and expect it to be a working dalvik virtual machine.
Fulfilling this expectation is no easy task. Here's how I did it.
- Be on Linux (Dalvik doesn't build for Mac).
- Check out Android (I used ICS because I had it lying around).
- make -kj25 dalvik-host
- If you built on a remote machine, rsync "out" to where you are
developing Buck, inside of a dedicated directory called "android"
or something.
- Edit android/out/host/linux-x86/dalvik to change the log tags to
"*:w", because a spurious info message was messing up the test.
- Delete android/out/host/linux-x86/dx so the tests will use our dx.
- Run this rule as
ANDROID_BUILD_TOP=/path/to/android PATH=$PATH:$ANDROID_BUILD_TOP/out/host/linux-x86/bin ant dx-tests
-->
<target name="dx-tests" depends="dx">
<exec
failonerror="true"
dir="${dx.test.dir}"
executable="./run-all-tests">
<env key="PATH" path="${env.PATH}:${dx.etc.dir}"/>
</exec>
</target>
<target name="copy-resources" description="Copy resources used by Buck at runtime to the build directory">
<copy todir="${classes.dir}">
<fileset dir="${src.dir}">
<include name="com/facebook/buck/httpserver/*.stg"/>
<include name="com/facebook/buck/httpserver/resources/static/*"/>
<include name="com/facebook/buck/maven/build-file.st"/>
<include name="com/facebook/buck/python/*.py"/>
<include name="com/facebook/buck/python/run_inplace.py.in"/>
<include name="com/facebook/buck/parser/function/BuckPyFunction.stg"/>
<include name="com/facebook/buck/shell/sh_binary_template"/>
<include name="com/facebook/buck/jvm/java/FatJar.java" />
<include name="com/facebook/buck/jvm/java/FatJarMain.java" />
<include name="com/facebook/buck/util/liteinfersupport/Nullable.java" />
<include name="com/facebook/buck/util/liteinfersupport/Preconditions.java" />
</fileset>
</copy>
</target>
<target name="report-generator-jar" depends="compile">
<jar destfile="${build.dir}/report-generator.jar">
<zipfileset excludes="**/*SF **/*RSA" src="${third-party.dir}/java/jacoco/org.jacoco.core-0.8.0.jar"/>
<zipfileset excludes="**/*SF **/*RSA" src="${third-party.dir}/java/jacoco/org.jacoco.report-0.8.0.jar"/>
<zipfileset excludes="**/*SF **/*RSA" src="${third-party.dir}/java/plexus/plexus-utils-3.0.20.jar"/>
<zipfileset includes="**/*.class" src="${third-party.dir}/java/asm/asm-6.0.jar" />
<zipfileset includes="**/*.class" src="${third-party.dir}/java/asm/asm-analysis-6.0.jar" />
<zipfileset includes="**/*.class" src="${third-party.dir}/java/asm/asm-commons-6.0.jar" />
<zipfileset includes="**/*.class" src="${third-party.dir}/java/asm/asm-tree-6.0.jar" />
<zipfileset includes="**/*.class" src="${third-party.dir}/java/asm/asm-util-6.0.jar" />
<zipfileset includes="**/*.class" src="${third-party.dir}/java/asm/asm-xml-6.0.jar" />
<zipfileset includes="**/*.class" src="${third-party.dir}/java/guava/guava-23.3-jre.jar"/>
<fileset dir="${classes.dir}">
<include name="com/facebook/buck/jvm/java/coverage/ReportGenerator.class"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="com.facebook.buck.jvm.java.coverage.ReportGenerator" />
</manifest>
</jar>
</target>
<path id="pmd-classpath">
<fileset dir="${basedir}/pmd" includes="*.jar" />
<pathelement location="${third-party.dir}/java/guava/guava-23.3-jre.jar" />
</path>
<!--
Runs pmd on the file(s) specified in the property "lint.files",
separated by commas. Writes output to ${lint.outputpath}.
-->
<target name="pmd-files-xml" if="lint.files">
<taskdef name="pmd"
classpathref="pmd-classpath"
classname="net.sourceforge.pmd.ant.PMDTask"
/>
<pmd failOnRuleViolation="true" rulesetfiles="pmd/rules.xml">
<ruleset>buck</ruleset>
<formatter type="xml" toFile="${lint.outputpath}" />
<fileset dir="${basedir}" includes="${lint.files}">
<exclude name="**/testdata/**"/>
</fileset>
</pmd>
</target>
<!--
Runs pmd on all source and test files.
-->
<target name="pmd">
<taskdef name="pmd"
classpathref="pmd-classpath"
classname="net.sourceforge.pmd.ant.PMDTask"
/>
<pmd failOnRuleViolation="true" rulesetfiles="pmd/rules.xml">
<ruleset>buck</ruleset>
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>
<fileset dir="${test.dir}">
<include name="**/*.java"/>
<exclude name="**/testdata/**"/>
</fileset>
</pmd>
</target>
<target name="missing-test-files-check" depends="default">
<exec dir="${user.dir}/scripts" executable="python" failonerror="true">
<arg line="verify-test-files.py" />
</exec>
</target>
<target name="verify-core-rules-boundaries" depends="default">
<exec dir="${user.dir}/tools/build/core-boundaries" executable="python" failonerror="true">
<arg line="verify-core-rules-boundaries.py" />
</exec>
</target>
<!--
Copy classpath jars to a directory buck_repo.py can use, so that buck built with ant continues
to work after checking out a different revision or making changes to classpaths file.
This also generates a classpaths file that contains all classpath entries that should be added
when running buck binary.
-->
<target name="create-classpath">
<copy todir="${build.dir}/classpath" flatten="true">
<path>
<fileset refid="buck.jars" />
<fileset refid="third-party.jars" />
</path>
</copy>
<union id="all.classpath.jars">
<string value="${classes.dir}" />
<string value="${manual.gensrc.classes.dir}" />
<string value="${aosp.classes.dir}" />
<string value="${dx.classes.dir}" />
<string value="${tracing-api.classes.dir}" />
<string value="${bootstrapper.classes.dir}" />
<fileset refid="buck.jars"/>
<fileset refid="third-party.jars"/>
</union>
<pathconvert pathsep="${line.separator}" property="classpaths" refid="all.classpath.jars">
<!-- turn all paths into repo relative as buck_repo.py expects -->
<map from="${basedir}/" to=""/>
</pathconvert>
<echo file="${build.dir}/classpath/classpaths">${classpaths}</echo>
</target>
<target name="create-classpath-hash" depends="copy-resources, compile, dx, javac-plugin,
report-generator-jar, create-classpath">
<delete file="${buck.hash.file}"/>
<checksum todir="${build.dir}/checksums" totalproperty="buck.hash.value">
<fileset dir="${build.dir}">
<include name="${classes.dir.name}/**"/>
<include name="${manual.gensrc.classes.dir.name}/**"/>
<include name="${aosp.classes.dir.name}/**"/>
<include name="${dx.classes.dir.name}/**"/>
<include name="${tracing-api.classes.dir.name}/**"/>
<include name="${bootstrapper.classes.dir.name}/**"/>
<include name="${javac-plugin.classes.dir.name}/**"/>
<exclude name="${classes.dir.name}/${javac-plugin.location.dir.name}/${javac-plugin.jar.name}"/>
</fileset>
<fileset refid="buck.jars"/>
<fileset refid="third-party.jars"/>
</checksum>
<echo file="${buck.hash.file}">${buck.hash.value}</echo>
<echo>Generated Buck hash: ${buck.hash.value}</echo>
</target>
<target name="gen-buck-info">
<exec executable="python" output="${buck.info.file}" logError="true" failonerror="true">
<arg value="programs/gen_buck_info.py"/>
</exec>
</target>
<macrodef name="build-buck-module-jar">
<attribute name="module-name" />
<attribute name="module-classes-dir" default="${buck.modules.classes.dir}/@{module-name}" />
<attribute name="module-jar" default="${build.dir}/${modules.dir.name}/@{module-name}.jar" />
<attribute name="module-gen-dir" default="${buck.modules.classes.dir}/gen/@{module-name}"/>
<attribute name="module-binary-hash-file" default="@{module-classes-dir}/META-INF/module-binary-hash.txt"/>
<element name="module-javac-params" optional="true" />
<element name="additional-classpath-entries" optional="true" />
<sequential>
<mkdir dir="@{module-classes-dir}" />
<mkdir dir="${build.dir}/${modules.dir.name}" />
<path id="@{module-name}-classpath">
<pathelement location="${classes.dir}" />
<path refid="classpath-no-src" />
<fileset dir="${build.dir}/${modules.dir.name}">
<additional-classpath-entries/>
</fileset>
</path>
<compiler destdir="@{module-classes-dir}" classpathref="@{module-name}-classpath"
gensrcdir="@{module-gen-dir}">
<javac-params>
<compilerarg value="-processorpath" />
<compilerarg value="${module.processorpath}" />
<compilerarg value="${pf4j-annotation-processor-storage-config}" />
<module-javac-params/>
</javac-params>
</compiler>
<delete file="@{module-binary-hash-file}"/>
<checksum todir="${build.dir}/buck-modules-checksums/@{module-name}" totalproperty="@{module-name}.module.hash.value">
<fileset dir="@{module-classes-dir}">
<include name="**"/>
</fileset>
</checksum>
<echo file="@{module-binary-hash-file}">${@{module-name}.module.hash.value}</echo>
<echo>Generated module hash: ${@{module-name}.module.hash.value}</echo>
<jar destfile="@{module-jar}" manifest="@{module-classes-dir}/META-INF/MANIFEST.MF">
<fileset dir="@{module-classes-dir}" />
</jar>
</sequential>
</macrodef>
<!--
Builds a jar of a module with resources
-->
<macrodef name="build-buck-module-jar-with-resources">
<attribute name="module-name" />
<attribute name="module-classes-dir" default="${buck.modules.classes.dir}/@{module-name}" />
<attribute name="module-jar" default="${build.dir}/${modules.dir.name}/@{module-name}.jar" />
<attribute name="module-gen-dir" default="${buck.modules.classes.dir}/gen/@{module-name}"/>
<attribute name="module-binary-hash-file" default="@{module-classes-dir}/META-INF/module-binary-hash.txt"/>
<element name="module-javac-params" optional="true" />
<element name="additional-classpath-entries" optional="true" />
<element name="module-resources" />
<sequential>
<mkdir dir="@{module-classes-dir}" />
<mkdir dir="${build.dir}/${modules.dir.name}" />
<path id="@{module-name}-classpath">
<pathelement location="${classes.dir}" />
<path refid="classpath-no-src" />
<fileset dir="${build.dir}/${modules.dir.name}">
<additional-classpath-entries/>
</fileset>
</path>
<compiler destdir="@{module-classes-dir}" classpathref="@{module-name}-classpath"
gensrcdir="@{module-gen-dir}">
<javac-params>
<compilerarg value="-processorpath" />
<compilerarg value="${module.processorpath}" />
<compilerarg value="${pf4j-annotation-processor-storage-config}" />
<module-javac-params/>
</javac-params>
</compiler>
<copy todir="@{module-classes-dir}">
<fileset dir="${src.dir}">
<module-resources/>
</fileset>
</copy>
<delete file="@{module-binary-hash-file}"/>
<checksum todir="${build.dir}/buck-modules-checksums/@{module-name}" totalproperty="@{module-name}.module.hash.value">
<fileset dir="@{module-classes-dir}">
<include name="**"/>
</fileset>
</checksum>
<echo file="@{module-binary-hash-file}">${@{module-name}.module.hash.value}</echo>
<echo>Generated module hash: ${@{module-name}.module.hash.value}</echo>
<jar destfile="@{module-jar}" manifest="@{module-classes-dir}/META-INF/MANIFEST.MF">
<fileset dir="@{module-classes-dir}" />
</jar>
</sequential>
</macrodef>
<!--
Copies module resources that should be kept outside of module's jar file.
-->
<macrodef name="copy-buck-module-external-resources">
<attribute name="module-name" />
<attribute name="module-resources-dir" default="${build.dir}/${modules.resources.dir.name}/@{module-name}" />
<element name="module-external-resources" />
<sequential>
<mkdir dir="@{module-resources-dir}" />
<copy todir="@{module-resources-dir}">
<module-external-resources/>
</copy>
</sequential>
</macrodef>
<target name="lint" depends="pmd, missing-test-files-check, verify-core-rules-boundaries" />
<macrodef name="buck-javadoc" description="generates HTML documentation for Java code">
<attribute name="destdir" />
<attribute name="classpathref" />
<attribute name="access" default="protected" />
<element name="additional-links" optional="true" />
<sequential>
<delete dir="@{destdir}" />
<mkdir dir="@{destdir}" />
<record name="@{destdir}/javadoc.log" action="start" />
<javadoc destdir="@{destdir}"
access="@{access}"
classpathref="@{classpathref}"
windowtitle="Buck"
failonerror="true"
additionalparam="${javadoc.doclint}"
useexternalfile="true"
>
<arg value="-notimestamp"/>
<fileset dir="${src.dir}">
<include name="**/*.java" />
<exclude name="com/facebook/buck/android/support/exopackage/**" />
</fileset>
<fileset dir="${gensrc.dir}" />
<fileset dir="${buck.modules.classes.dir}/gen/" />
<link href="http://docs.oracle.com/javase/7/docs/api/"
offline="true"
packagelistloc="third-party/java/javase" />
<link href="http://docs.guava-libraries.googlecode.com/git-history/v18.0/javadoc/"
offline="true"
packagelistloc="third-party/java/guava"/>
<!-- The latest version of the javadocs is only for 4.12 -->
<link href="https://junit-team.github.io/junit/javadoc/latest/"
offline="true"
packagelistloc="third-party/java/junit" />
<additional-links />
</javadoc>
<record name="@{destdir}/javadoc.log" action="stop" />
</sequential>
</macrodef>
<target name="-javadoc-deps" depends="compile, build-modules" />
<path id="javadoc.classpath">
<path refid="classpath" />
<!-- Buck test runner has references to JUnit and TestNG. -->
<pathelement location="${third-party.dir}/java/junit/junit-4.12.jar" />
<pathelement location="${third-party.dir}/java/testng/testng-6.8.jar" />
<!-- Include the Compiler Tree API stub because its types are used in some places. -->
<pathelement location="${third-party.dir}/java/jdk/stub-compiler-tree-api.jar" />
<!-- Guava depends on some j2objc stuff when dealing with javadocs. -->
<pathelement location="${third-party.dir}/java/j2objc/j2objc-annotations-1.3.jar" />
</path>
<target name="javadoc"
description="generates HTML documentation for Java code"
depends="-javadoc-deps">
<buck-javadoc destdir="${javadoc.dir}"
classpathref="javadoc.classpath"
>
</buck-javadoc>
</target>
<path id="javadoc-with-android.classpath">
<path refid="javadoc.classpath" />
<!-- Buck's Android support library has references to Android. -->
<pathelement location="${env.ANDROID_HOME}/platforms/android-16/android.jar" />
</path>
<macrodef name="javadoc-with-android">
<attribute name="destdir" />
<attribute name="access" />
<sequential>
<fail unless="env.ANDROID_HOME" message="ANDROID_HOME not set." />
<buck-javadoc destdir="@{destdir}"
classpathref="javadoc-with-android.classpath"
access="@{access}"
>
<additional-links>
<!--
This is the recommended way to link to Android's Javadoc.
This problem derives from Android's refusal to publish the package-list file
with their Javadoc: http://stackoverflow.com/a/2823592/396304.
Surprisingly, the generated Javadoc does link to http://d.android.com/
rather than a local file:/// URI that points to the local $ANDROID_HOME.
-->
<link offline="true" href="http://d.android.com/reference" packagelistLoc="${env.ANDROID_HOME}/docs/reference"/>
</additional-links>
</buck-javadoc>
</sequential>
</macrodef>
<target name="javadoc-with-android"
description="generates HTML documentation for Java code with links to Android"
depends="-javadoc-deps">
<javadoc-with-android destdir="${javadoc-with-android.dir}" access="protected" />
</target>
<target name="verify-javadoc"
description="verify that full Javadoc ran without errors"
depends="-javadoc-deps">
<!-- Runs javadoc with -private to catch errors in all possible docblocks. -->
<javadoc-with-android destdir="${javadoc-all.dir}" access="private" />
<exec executable="${basedir}/scripts/verify-javadoc.py" failonerror="true">
<arg value="${javadoc-all.dir}/javadoc.log" />
</exec>
</target>
<target name="verify-soydoc"
description="verify that soy docs can be generated without errors">
<exec executable="${basedir}/docs/soy_syntax_check.py" failonerror="true">
</exec>
</target>
<target name="travis" depends="verify-javadoc, verify-soydoc, lint" />
<target name="pre-checkin" depends="clean, default, lint"/>
<target name="all" depends="default, javadoc" />
</project>