ellis.jamm.0.3.0.source-code.build.xml Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jamm Show documentation
Show all versions of jamm Show documentation
Jamm provides MemoryMeter, a java agent to measure actual object memory use including JVM overhead.
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <project basedir="." default="build" name="jamm" xmlns:ivy="antlib:org.apache.ivy.ant"> <property name="debuglevel" value="source,lines,vars"/> <property name="version" value="0.3.0"/> <property name="basedir" value="."/> <property name="build.src" value="${basedir}/src"/> <property name="build.dir" value="${basedir}/target"/> <property name="build.lib" value="${build.dir}/lib"/> <property name="build.classes" value="${build.dir}/classes"/> <property name="build.javadoc" value="${build.dir}/javadoc"/> <property name="build.sonatype" value="${build.dir}/sonatype"/> <property name="jar.name" value="jamm-${version}.jar"/> <property name="jar.src.name" value="jamm-${version}-sources.jar"/> <property name="jar.javadoc.name" value="jamm-${version}-javadoc.jar"/> <property name="jar.pom.name" value="jamm-${version}.pom"/> <property name="test.src" value="${basedir}/test"/> <property name="test.classes" value="${build.dir}/test/classes"/> <property name="test.out" value="${build.dir}/test/output"/> <property name="test.name" value="*Test"/> <property name="ivy.version" value="2.1.0" /> <property name="ivy.url" value="http://repo2.maven.org/maven2/org/apache/ivy/ivy" /> <condition property="ivy.jar.exists"> <available file="${build.dir}/ivy-${ivy.version}.jar" /> </condition> <target name="ivy-download" unless="ivy.jar.exists"> <echo>Downloading Ivy...</echo> <mkdir dir="${build.dir}" /> <get src="${ivy.url}/${ivy.version}/ivy-${ivy.version}.jar" dest="${build.dir}/ivy-${ivy.version}.jar" usetimestamp="true" /> </target> <target name="ivy-init" depends="ivy-download" unless="ivy.initialized"> <mkdir dir="${build.lib}"/> <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpathref="autoivy.classpath"/> <property name="ivy.initialized" value="true"/> </target> <target name="ivy-retrieve-build" depends="ivy-init"> <ivy:retrieve type="jar,source" sync="true" pattern="${build.lib}/[type]s/[artifact]-[revision].[ext]" /> </target> <path id="autoivy.classpath"> <fileset dir="${build.lib}"> <include name="**/*.jar" /> </fileset> <pathelement location="${build.dir}/ivy-${ivy.version}.jar"/> </path> <target name="init" depends="ivy-retrieve-build"> <mkdir dir="${build.classes}"/> <mkdir dir="${test.classes}"/> </target> <target name="clean" description="deletes generated artifacts"> <delete dir="${build.dir}"/> </target> <target depends="init" name="build"> <echo message="${ant.project.name}: ${ant.file}"/> <javac source="1.6" target="1.6" debug="true" debuglevel="${debuglevel}" destdir="${build.classes}" includeantruntime="false"> <src path="${build.src}"/> <compilerarg value="-XDignore.symbol.file"/> </javac> </target> <target name="jar" depends="build" description="generates the jamm jar"> <jar jarfile="${build.dir}/${jar.name}" basedir="${build.classes}"> <manifest> <!-- see http://download.oracle.com/javase/6/docs/api/java/lang/instrument/package-summary.html --> <attribute name="Agent-Class" value="org.github.jamm.MemoryMeter"/> <attribute name="Premain-Class" value="org.github.jamm.MemoryMeter"/> </manifest> </jar> </target> <target name="build-test" depends="jar" description="Compile test classes"> <javac source="1.6" target="1.6" debug="true" debuglevel="${debuglevel}" destdir="${test.classes}" includeantruntime="false"> <classpath> <path refid="autoivy.classpath"/> <pathelement location="${build.classes}"/> </classpath> <src path="${test.src}"/> <compilerarg value="-XDignore.symbol.file"/> </javac> </target> <target name="checkos"> <condition property="isMac"> <os family="mac"/> </condition> </target> <target name="test" depends="build-test, test-mac" description="runs unit tests"> <echo message="running tests"/> <mkdir dir="${test.out}"/> <echo message="Testing with default Java"/> <junit fork="on" failureproperty="testfailed"> <formatter type="xml" usefile="true"/> <formatter type="brief" usefile="false"/> <classpath> <path refid="autoivy.classpath"/> <pathelement location="${build.classes}"/> <pathelement location="${test.classes}"/> </classpath> <jvmarg value="-ea"/> <jvmarg value="-javaagent:${build.dir}/${jar.name}"/> <batchtest todir="${test.out}"> <fileset dir="${test.classes}" includes="**/${test.name}.class" /> </batchtest> </junit> <fail if="testfailed" message="Some test(s) failed."/> </target> <target name="test-mac" depends="checkos" if="isMac"> <echo message="Testing with modified object alignment"/> <junit fork="on" failureproperty="testfailed"> <formatter type="xml" usefile="true"/> <formatter type="brief" usefile="false"/> <classpath> <path refid="autoivy.classpath"/> <pathelement location="${build.classes}"/> <pathelement location="${test.classes}"/> </classpath> <jvmarg value="-ea"/> <jvmarg value="-XX:ObjectAlignmentInBytes=16"/> <jvmarg value="-javaagent:${build.dir}/${jar.name}"/> <batchtest todir="${test.out}"> <fileset dir="${test.classes}" includes="**/${test.name}.class" /> </batchtest> </junit> </target> <target name="javadoc" depends="build" description="build the javadoc for the project"> <javadoc packagenames="*" sourcepath="${build.src}" classpathref="autoivy.classpath" destdir="${build.javadoc}" windowtitle="jamm api"> <doctitle><![CDATA[<h1>jamm javadoc</h1>]]></doctitle> </javadoc> </target> <target name="srcjar" description="builds the source distribution jar file"> <zip destfile="${build.dir}/${jar.src.name}"> <fileset dir="${basedir}"> <include name="**/*.java" /> <include name="**/*.xml" /> <include name="**/*.license" /> <include name="**/*.txt" /> <exclude name="target"/> </fileset> </zip> </target> <target name="sonatype" depends="jar,srcjar,javadoc" description="builds a sonatype (maven) bundle"> <delete dir="${build.sonatype}"/> <mkdir dir="${build.sonatype}"/> <copy todir="${build.sonatype}" file="${build.dir}/${jar.name}"/> <copy todir="${build.sonatype}" file="${build.dir}/${jar.src.name}"/> <jar destfile="${build.sonatype}/${jar.javadoc.name}" basedir="${build.dir}" includes="javadoc/**"/> <copy tofile="${build.sonatype}/${jar.pom.name}" file="${basedir}/pom.xml"/> <exec executable="gpg"> <arg value="-abi" /> <arg value="${build.sonatype}/${jar.name}" /> </exec> <exec executable="gpg"> <arg value="-abi" /> <arg value="${build.sonatype}/${jar.src.name}" /> </exec> <exec executable="gpg"> <arg value="-abi" /> <arg value="${build.sonatype}/${jar.javadoc.name}" /> </exec> <exec executable="gpg"> <arg value="-abi" /> <arg value="${build.sonatype}/${jar.pom.name}" /> </exec> <jar destfile="${build.sonatype}/bundle.jar" basedir="${build.sonatype}" includes="jamm*"> </jar> </target> <target name="sonatype-help" description="describes steps needed to publish artifact on sonatype"> <echo message="To publish a jar to maven thru the sonatype oss repository do the following" /> <echo message=" Create a gpg key, using, gpg --gen-key" /> <echo message=" Generate an armored text key, using gpg --armor --export {YOUR_PUBLIC_KEY_ID}"/> <echo message=" Upload this key to http://keyserver.ubuntu.com" /> <echo message="" /> <echo message="Run ant sonatype to create an upload bundle in ${build.sonatype}/bundle.jar"/> <echo message=" Make sure that the pom.xml is up to date with what you have in ant's build.xml"/> <echo message="" /> <echo message="upload this jar at https://oss.sonatype.org" /> <echo message="" /> <echo message="see link for details-> https://docs.sonatype.org/display/Repository/Uploading+3rd-party+Artifacts+to+The+Central+Repository" /> <echo message="====================================================================================================================================" /> </target> </project>