{"id":2597,"date":"2017-12-09T07:48:27","date_gmt":"2017-12-09T07:48:27","guid":{"rendered":"http:\/\/www.scmgalaxy.com\/tutorials\/?p=2597"},"modified":"2020-01-09T07:48:42","modified_gmt":"2020-01-09T07:48:42","slug":"ant-example-code-for-emma-instrumentation-and-reports","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/ant-example-code-for-emma-instrumentation-and-reports\/","title":{"rendered":"Ant Example code for Emma Instrumentation and reports"},"content":{"rendered":"<p><strong>rajeshkumar created the topic: Ant Example code for Emma Instrumentation and reports<\/strong><\/p>\n<p>In-place instrument a certain subset of already compiled classes using overwrite mode and several coverage filters:<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;emma enabled=&#8221;${emma.enabled}&#8221; &gt;<br \/>\n&lt;instr instrpathref=&#8221;${out.dir}\/classes&#8221;<br \/>\nmode=&#8221;overwrite&#8221;<br \/>\n&gt;<br \/>\n&lt;!&#8211; always exclude every class with a &#8220;Test&#8221; in the name: &#8211;&gt;<br \/>\n&lt;filter excludes=&#8221;*Test*&#8221; \/&gt;<br \/>\n&lt;!&#8211; don&#8217;t instrument everything in &#8220;${out.dir}\/classes&#8221;,<br \/>\nonly the stuff I am working on now: &#8211;&gt;<br \/>\n&lt;filter file=&#8221;myincludes.txt&#8221; \/&gt;<br \/>\n&lt;!&#8211; additional ANT command line hook: &#8211;&gt;<br \/>\n&lt;filter value=&#8221;${emma.filter}&#8221; \/&gt;<br \/>\n&lt;\/instr&gt;<br \/>\n&lt;\/emma&gt;<br \/>\n[\/code]<\/p>\n<p>Don&#8217;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:<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;emma enabled=&#8221;${emma.enabled}&#8221; &gt;<br \/>\n&lt;instr instrpathref=&#8221;${out.dir}\/classes&#8221;<br \/>\noutdir=&#8221;${out.dir}\/classes-instrumented&#8221;<br \/>\nmerge=&#8221;yes&#8221;<br \/>\nfilter=&#8221;${emma.filter}&#8221;<br \/>\n\/&gt;<br \/>\n&lt;\/emma&gt;<\/p>\n<p>[\/code]<\/p>\n<p>Take all jars already produced by the product build and make test (coverage-enabled) copies of them:<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;emma enabled=&#8221;${emma.enabled}&#8221; &gt;<br \/>\n&lt;instr mode=&#8221;fullcopy&#8221;<br \/>\noutdir=&#8221;${out.instr.dir}&#8221;<br \/>\nmerge=&#8221;no&#8221;<br \/>\nfilter=&#8221;${emma.filter}&#8221;<br \/>\n&gt;<br \/>\n&lt;instrpath&gt;<br \/>\n&lt;fileset dir=&#8221;${out.dir}&#8221; includes=&#8221;**\/*.jar&#8221; \/&gt;<br \/>\n&lt;\/instrpath&gt;<br \/>\n&lt;\/instr&gt;<br \/>\n&lt;\/emma&gt;<br \/>\n[\/code]<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;copy todir=&#8221;${dist}&#8221;&gt;<br \/>\n&lt;fileset dir=&#8221;${src}&#8221;<br \/>\nincludes=&#8221;**\/images\/*&#8221;<br \/>\nexcludes=&#8221;**\/*.gif&#8221;<br \/>\n\/&gt;<br \/>\n&lt;\/copy&gt;<br \/>\n[\/code]<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;copy todir=&#8221;${dist}&#8221;&gt;<br \/>\n&lt;fileset dir=&#8221;${src}&#8221;&gt;<br \/>\n&lt;include name=&#8221;**\/images\/*&#8221;\/&gt;<br \/>\n&lt;exclude name=&#8221;**\/*.gif&#8221;\/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n&lt;\/copy&gt;<\/p>\n<p>[\/code]<\/p>\n<p>Groups all files in directory ${server.src} that are Java source files and don&#8217;t have the text Test in their name.<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;fileset dir=&#8221;${server.src}&#8221; casesensitive=&#8221;yes&#8221;&gt;<br \/>\n&lt;include name=&#8221;**\/*.java&#8221;\/&gt;<br \/>\n&lt;exclude name=&#8221;**\/*Test*&#8221;\/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n[\/code]<\/p>\n<p>Groups the same files as the above example, but also establishes a PatternSet that can be referenced in other <fileset> elements, rooted at a different directory.<\/fileset><\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;fileset dir=&#8221;${server.src}&#8221; casesensitive=&#8221;yes&#8221;&gt;<br \/>\n&lt;patternset id=&#8221;non.test.sources&#8221;&gt;<br \/>\n&lt;include name=&#8221;**\/*.java&#8221;\/&gt;<br \/>\n&lt;exclude name=&#8221;**\/*Test*&#8221;\/&gt;<br \/>\n&lt;\/patternset&gt;<br \/>\n&lt;\/fileset&gt;<\/p>\n<p>[\/code]<\/p>\n<p>Groups all files in directory ${client.src}, using the same patterns as the above example.<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;fileset dir=&#8221;${client.src}&#8221; &gt;<br \/>\n&lt;patternset refid=&#8221;non.test.sources&#8221;\/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n[\/code]<\/p>\n<p>Groups the same files as the top example, but using the <filename> selector.<br \/>\n[code language=&#8221;css&#8221;]<br \/>\n&lt;fileset dir=&#8221;${server.src}&#8221; casesensitive=&#8221;yes&#8221;&gt;<br \/>\n&lt;filename name=&#8221;**\/*.java&#8221;\/&gt;<br \/>\n&lt;filename name=&#8221;**\/*Test*&#8221; negate=&#8221;true&#8221;\/&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n[\/code]<\/filename><\/p>\n<p>Groups the same files as the previous example using a combination of the <filename> selector and the <not> selector container.<\/not><\/filename><\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;fileset dir=&#8221;${server.src}&#8221; casesensitive=&#8221;yes&#8221;&gt;<br \/>\n&lt;filename name=&#8221;**\/*.java&#8221;\/&gt;<br \/>\n&lt;not&gt;<br \/>\n&lt;filename name=&#8221;**\/*Test*&#8221;\/&gt;<br \/>\n&lt;\/not&gt;<br \/>\n&lt;\/fileset&gt;<br \/>\n[\/code]<\/p>\n<p>Selects all files in src\/main<\/p>\n<p>[code language=&#8221;css&#8221;]<br \/>\n&lt;fileset dir=&#8221;src&#8221; includes=&#8221;main\/&#8221; \/&gt;<\/p>\n<p>&lt;emma enabled=&#8221;${emma.enabled}&#8221; &gt;<br \/>\n&lt;instr mode=&#8221;overwrite&#8221;<br \/>\ninstrpath=&#8221;${jar.location}&#8221;<br \/>\ndestdir=&#8221;${inst.jar.location}&#8221;<br \/>\nmetadatafile=&#8221;${inst.jar.location}\/metadata.emma&#8221;<br \/>\nmerge=&#8221;no&#8221; &gt;<br \/>\n&lt;instrpath&gt;<br \/>\n&lt;fileset dir=&#8221;${jar.location}&#8221; includes=&#8221;elance-services.jar,web-classes.jar,applet.jar,application-ejb.jar&#8221; \/&gt;<br \/>\n&lt;\/instrpath&gt;<\/p>\n<p>&lt;\/instr&gt;<br \/>\n&lt;\/emma&gt;<\/p>\n<p>&lt;emma enabled=&#8221;${emma.enabled}&#8221; &gt;<br \/>\n&lt;instr mode=&#8221;fullcopy&#8221;<br \/>\ninstrpath=&#8221;${jar.location}&#8221;<br \/>\noutdir=&#8221;${inst.jar.location}&#8221;<\/p>\n<p>metadatafile=&#8221;${inst.jar.location}\/metadata.emma&#8221;<br \/>\nmerge=&#8221;no&#8221; &gt;<br \/>\n&lt;instrpath&gt;<br \/>\n&lt;fileset dir=&#8221;${jar.location}&#8221; includes=&#8221;elance-services.jar,web-classes.jar,applet.jar,application-ejb.jar&#8221; \/&gt;<br \/>\n&lt;\/instrpath&gt;<\/p>\n<p>&lt;\/instr&gt;<br \/>\n&lt;\/emma&gt;<\/p>\n<p>[\/code]<\/p>\n<p>Regards,<br \/>\nRajesh Kumar<br \/>\nTwitt me @ <a href=\"http:\/\/twitter.com\/RajeshKumarIn\" target=\"_blank\" rel=\"noopener\">twitter.com\/RajeshKumarIn<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>rajeshkumar created the topic: Ant Example code for Emma Instrumentation and reports In-place instrument a certain subset of already compiled classes using overwrite mode and several coverage filters: [code language=&#8221;css&#8221;] &lt;emma enabled=&#8221;${emma.enabled}&#8221; &gt; &lt;instr instrpathref=&#8221;${out.dir}\/classes&#8221; mode=&#8221;overwrite&#8221; &gt; &lt;!&#8211; always exclude every class with a &#8220;Test&#8221; in the name: &#8211;&gt; &lt;filter excludes=&#8221;*Test*&#8221; \/&gt; &lt;!&#8211; don&#8217;t instrument&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[2],"tags":[509],"class_list":["post-2597","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-reports"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2597","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=2597"}],"version-history":[{"count":2,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2597\/revisions"}],"predecessor-version":[{"id":8531,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/2597\/revisions\/8531"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=2597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=2597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=2597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}