J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | |
| 3 | <!-- |
| 4 | Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. |
| 5 | |
| 6 | Redistribution and use in source and binary forms, with or without |
| 7 | modification, are permitted provided that the following conditions |
| 8 | are met: |
| 9 | |
| 10 | - Redistributions of source code must retain the above copyright |
| 11 | notice, this list of conditions and the following disclaimer. |
| 12 | |
| 13 | - Redistributions in binary form must reproduce the above copyright |
| 14 | notice, this list of conditions and the following disclaimer in the |
| 15 | documentation and/or other materials provided with the distribution. |
| 16 | |
| 17 | - Neither the name of Sun Microsystems nor the names of its |
| 18 | contributors may be used to endorse or promote products derived |
| 19 | from this software without specific prior written permission. |
| 20 | |
| 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 22 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 23 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 24 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 25 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 26 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 27 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 28 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 29 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 30 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 32 | --> |
| 33 | |
| 34 | |
| 35 | <!-- |
| 36 | This is ant (http://ant.apache.org) build script to build the |
| 37 | "jmx-scandir" sample. Either this build.xml can be used standalone |
| 38 | with "ant" tool or can be opened as a project with NetBeans IDE |
| 39 | (http://www.netbeans.org). |
| 40 | --> |
| 41 | |
| 42 | <project name="jmx-scandir" default="jar" basedir="."> |
| 43 | |
| 44 | <import file="nbproject/jdk.xml"/> |
| 45 | |
| 46 | |
| 47 | <target name="-prop-init"> |
| 48 | <property file="user.build.properties"/> |
| 49 | <property file="build.properties"/> |
| 50 | </target> |
| 51 | |
| 52 | <target name="-init" depends="-prop-init,-jdk-init"/> |
| 53 | |
| 54 | <target name="compile" depends="-init" description="Compile main sources."> |
| 55 | <mkdir dir="${classes.dir}"/> |
| 56 | <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="${debug}" deprecation="${deprecation}"> |
| 57 | <classpath path="${cp}"/> |
| 58 | </javac> |
| 59 | <copy todir="${classes.dir}"> |
| 60 | <fileset dir="${src.dir}"/> |
| 61 | </copy> |
| 62 | </target> |
| 63 | |
| 64 | <target name="jar" depends="compile" description="Build JAR file for main sources."> |
| 65 | <mkdir dir="${dist.dir}" /> |
| 66 | <jar jarfile="${jar}" compress="true"> |
| 67 | <manifest> |
| 68 | <attribute name="Main-Class" value="${main.agent.class}"/> |
| 69 | </manifest> |
| 70 | <fileset dir="${classes.dir}"/> |
| 71 | </jar> |
| 72 | </target> |
| 73 | |
| 74 | <target name="run-client" depends="compile" description="Run client."> |
| 75 | <fail unless="main.client.class">Must set property 'main.client.class' (e.g. in build.properties)</fail> |
| 76 | <java classname="${main.client.class}" fork="true" failonerror="true"> |
| 77 | <classpath path="${run.cp}"/> |
| 78 | <jvmarg line="${client.jvmargs}" /> |
| 79 | <arg line="${client.args}" /> |
| 80 | </java> |
| 81 | </target> |
| 82 | |
| 83 | <target name="run-agent" depends="compile" description="Run agent."> |
| 84 | <fail unless="main.agent.class">Must set property 'main.agent.class' (e.g. in build.properties)</fail> |
| 85 | <java classname="${main.agent.class}" fork="true" failonerror="true"> |
| 86 | <classpath path="${run.cp}"/> |
| 87 | <jvmarg line="${agent.jvmargs}" /> |
| 88 | </java> |
| 89 | </target> |
| 90 | |
| 91 | <target name="run" depends="run-agent" description="Run agent." /> |
| 92 | |
| 93 | <target name="run-single" depends="-init,compile"> |
| 94 | <fail unless="run.class">Must select one file in the IDE or set run.class</fail> |
| 95 | <java classname="${run.class}" fork="true" failonerror="true"> |
| 96 | <classpath path="${run.cp}"/> |
| 97 | </java> |
| 98 | </target> |
| 99 | |
| 100 | <target name="javadoc" depends="-init" description="Build Javadoc."> |
| 101 | <mkdir dir="${javadoc.dir}"/> |
| 102 | <javadoc destdir="${javadoc.dir}"> |
| 103 | <classpath path="${cp}"/> |
| 104 | <sourcepath> |
| 105 | <pathelement location="${src.dir}"/> |
| 106 | </sourcepath> |
| 107 | <fileset dir="${src.dir}"/> |
| 108 | </javadoc> |
| 109 | </target> |
| 110 | |
| 111 | <target name="clean" depends="-init" description="Clean build products."> |
| 112 | <delete dir="${build.dir}"/> |
| 113 | <delete file="${jar}"/> |
| 114 | <delete dir="${dist.dir}"/> |
| 115 | </target> |
| 116 | |
| 117 | <target name="profile"> |
| 118 | <ant antfile="nbproject/netbeans-targets.xml" target="profile"/> |
| 119 | </target> |
| 120 | |
| 121 | <!-- JUnit targets --> |
| 122 | |
| 123 | <target name="compile-test" depends="-init,compile"> |
| 124 | <fail unless="libs.junit.classpath">Must set libs.junit.classpath variable to the JUnit classpath in the build.properties file.</fail> |
| 125 | <mkdir dir="${build.test.classes.dir}"/> |
| 126 | <javac srcdir="${test.src.dir}" destdir="${build.test.classes.dir}" debug="${debug}" classpath="${javac.test.classpath}"/> |
| 127 | <copy todir="${build.test.classes.dir}"> |
| 128 | <fileset dir="${test.src.dir}" excludes="**/*.java"/> |
| 129 | </copy> |
| 130 | </target> |
| 131 | |
| 132 | <target name="-do-test-run" depends="-init,compile-test"> |
| 133 | <mkdir dir="${build.test.results.dir}"/> |
| 134 | <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed"> |
| 135 | <batchtest todir="${build.test.results.dir}"> |
| 136 | <fileset dir="${test.src.dir}" includes="**/*Test.java"/> |
| 137 | </batchtest> |
| 138 | <classpath> |
| 139 | <path path="${run.test.classpath}"/> |
| 140 | </classpath> |
| 141 | <syspropertyset> |
| 142 | <propertyref prefix="test-sys-prop."/> |
| 143 | <mapper type="glob" from="test-sys-prop.*" to="*"/> |
| 144 | </syspropertyset> |
| 145 | <formatter type="brief" usefile="false"/> |
| 146 | <formatter type="xml"/> |
| 147 | <jvmarg line="${run.jvmargs}"/> |
| 148 | </junit> |
| 149 | <fail if="tests.failed">Some tests failed; see details above.</fail> |
| 150 | </target> |
| 151 | |
| 152 | <target name="test" depends="-init,compile-test,-do-test-run" description="Run unit tests."/> |
| 153 | |
| 154 | <target name="-do-test-run-single" depends="-init,compile-test"> |
| 155 | <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> |
| 156 | <junit showoutput="true" fork="true" dir="${basedir}" failureproperty="tests.failed" errorproperty="tests.failed"> |
| 157 | <batchtest todir="${build.test.results.dir}"> |
| 158 | <fileset dir="${test.src.dir}" includes="${test.includes}"/> |
| 159 | </batchtest> |
| 160 | <classpath> |
| 161 | <path path="${run.test.classpath}"/> |
| 162 | </classpath> |
| 163 | <syspropertyset> |
| 164 | <propertyref prefix="test-sys-prop."/> |
| 165 | <mapper type="glob" from="test-sys-prop.*" to="*"/> |
| 166 | </syspropertyset> |
| 167 | <formatter type="brief" usefile="false"/> |
| 168 | <formatter type="xml"/> |
| 169 | <jvmarg line="${run.jvmargs}"/> |
| 170 | </junit> |
| 171 | <fail if="tests.failed">Some tests failed; see details above.</fail> |
| 172 | </target> |
| 173 | |
| 174 | <target name="test-single" depends="-init,compile-test,-do-test-run-single" description="Run single unit test."/> |
| 175 | </project> |