media/webrtc/trunk/build/android/ant/chromium-jars.xml
author shindli <shindli@mozilla.com>
Sat, 03 Nov 2018 11:40:50 +0200
changeset 444311 ef27c14b46bf58f710753ae6bb6d2c01a8c3631f
parent 121457 6a273b6bcd01420997bea81d1a0d38d9cb4eda89
parent 444308 63f135d2db22375b51cf0ded745279afe2188022
permissions -rw-r--r--
Merge inbound to mozilla-central. a=merge

<!--
  Copyright (c) 2012 The Chromium Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.
-->
<project name="chromium-jars" default="dist">
  <!--
    Common ant build file for for chromium_*.jars.
    For creating a new chromium_*.jar :
    1. Use build/java.gypi action.
    The jar will be created as chromium_${PACKAGE_NAME} in
    ${PRODUCT_DIR}/lib.java.
  -->
  <description>
    Building ${PROJECT_NAME}/ java source code with ant.
  </description>

  <import file="common.xml"/>

  <path id="javac.custom.classpath">
    <filelist files="${INPUT_JARS_PATHS}"/>
    <pathelement location="${ANDROID_SDK}/android.jar"/>
  </path>

  <path id="javac.srcdirs.additional">
    <filelist files="${ADDITIONAL_SRC_DIRS}"/>
    <filelist files="${GENERATED_SRC_DIRS}"/>
  </path>

  <property-value
    name="javac.srcdir"
    value="src:${toString:javac.srcdirs.additional}"
  />

  <property-location
    name="dest.dir"
    location="${PRODUCT_DIR}/java/${PACKAGE_NAME}"
    check-exists="false"
  />

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${dest.dir}"/>

    <!-- Remove all .class files from dest.dir. This prevents inclusion of
         incorrect .class files in the final .jar. For example, if a .java file
         was deleted, the .jar should not contain the .class files for that
         .java from previous builds.
    -->
    <delete>
      <fileset dir="${dest.dir}" includes="**/*.class"/>
    </delete>
  </target>

  <target name="compile" depends="init" description="Compiles source.">
    <fail message="Error: javac.custom.classpath is not set. Please set it to
        classpath for javac.">
      <condition>
        <not><isreference refid="javac.custom.classpath"/></not>
      </condition>
    </fail>

    <echo>
      Compiling ${javac.srcdir}, classpath: ${toString:javac.custom.classpath}
    </echo>

    <javac
      srcdir="${javac.srcdir}"
      destdir="${dest.dir}"
      classpathref="javac.custom.classpath"
      debug="true"
      includeantruntime="false"
    />
  </target>

  <target name="dist" depends="compile"
      description="Generate chromium_${PACKAGE_NAME}.jar.">
    <!-- Create the distribution directory -->
    <jar
      jarfile="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"
      basedir="${dest.dir}"
    />

    <!-- If Gyp thinks this output is stale but Ant doesn't, the modification
         time should still be updated. Otherwise, this target will continue to
         be rebuilt in future builds.
    -->
    <touch file="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"/>
  </target>

  <target name="clean" description="clean up">
    <!-- Delete the appropriate directory trees -->
    <delete dir="${dest.dir}"/>
  </target>
</project>