Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

Ant Example code for Emma Instrumentation

rajeshkumar created the topic: Ant Example code for Emma Instrumentation

In-place instrument a certain subset of already compiled classes using overwrite mode and several coverage filters:

[code language=”css”]
<emma enabled=”${emma.enabled}” >
<instr instrpathref=”${out.dir}/classes”
mode=”overwrite”
>
<!– always exclude every class with a “Test” in the name: –>
<filter excludes=”*Test*” />
<!– don’t instrument everything in “${out.dir}/classes”,
only the stuff I am working on now: –>
<filter file=”myincludes.txt” />
<!– additional ANT command line hook: –>
<filter value=”${emma.filter}” />
</instr>
</emma>
[/code]

Don’t overwrite compiled classes that later need to go into official release jars (stay in copy mode). However, use incremental instrumentation for fast personal testing:

[code language=”css”]
<emma enabled=”${emma.enabled}” >
<instr instrpathref=”${out.dir}/classes”
outdir=”${out.dir}/classes-instrumented”
merge=”yes”
filter=”${emma.filter}”
/>
</emma>
[/code]

Take all jars already produced by the product build and make test (coverage-enabled) copies of them:

[code language=”css”]
<emma enabled=”${emma.enabled}” >
<instr mode=”fullcopy”
outdir=”${out.instr.dir}”
merge=”no”
filter=”${emma.filter}”
>
<instrpath>
<fileset dir=”${out.dir}” includes=”**/*.jar” />
</instrpath>
</instr>
</emma>
[/code]

[code language=”css”]
<copy todir=”${dist}”>
<fileset dir=”${src}”
includes=”**/images/*”
excludes=”**/*.gif”
/>
</copy>
[/code]

[code language=”css”]
<copy todir=”${dist}”>
<fileset dir=”${src}”>
<include name=”**/images/*”/>
<exclude name=”**/*.gif”/>
</fileset>
</copy>

[/code]

[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<include name=”**/*.java”/>
<exclude name=”**/*Test*”/>
</fileset>
[/code]

[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<patternset id=”non.test.sources”>
<include name=”**/*.java”/>
<exclude name=”**/*Test*”/>
</patternset>
</fileset>
[/code]

Groups all files in directory ${client.src}, using the same patterns as the above example.

[code language=”css”]
<fileset dir=”${client.src}” >
<patternset refid=”non.test.sources”/>
</fileset>

[/code]

Groups the same files as the top example, but using the selector.

[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<filename name=”**/*.java”/>
<filename name=”**/*Test*” negate=”true”/>
</fileset>

[/code]

Groups the same files as the previous example using a combination of the selector and the selector container.

[code language=”css”]
<fileset dir=”${server.src}” casesensitive=”yes”>
<filename name=”**/*.java”/>
<not>
<filename name=”**/*Test*”/>
</not>
</fileset>
[/code]

Selects all files in src/main

[code language=”css”]
<fileset dir=”src” includes=”main/” />

<emma enabled=”${emma.enabled}” >
<instr mode=”overwrite”
instrpath=”${jar.location}”
destdir=”${inst.jar.location}”
metadatafile=”${inst.jar.location}/metadata.emma”
merge=”no” >
<instrpath>
<fileset dir=”${jar.location}” includes=”elance-services.jar,web-classes.jar,applet.jar,application-ejb.jar” />
</instrpath>

</instr>
</emma>

<emma enabled=”${emma.enabled}” >
<instr mode=”fullcopy”
instrpath=”${jar.location}”
outdir=”${inst.jar.location}”

metadatafile=”${inst.jar.location}/metadata.emma”
merge=”no” >
<instrpath>
<fileset dir=”${jar.location}” includes=”elance-services.jar,web-classes.jar,applet.jar,application-ejb.jar” />
</instrpath>

</instr>
</emma>
[/code]

Regards,
Rajesh Kumar
Twitt me @ twitter.com/RajeshKumarIn

Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.

0
Would love your thoughts, please comment.x
()
x