summaryrefslogtreecommitdiffstats
path: root/media/webrtc/trunk/build/android/ant/chromium-jars.xml
blob: 7007df5dc1fa472dfc5b2e230676fee3d1b444ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!--
  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>