Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
206 lines (193 sloc) 9.39 KB
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2006 Rogério Liesenfeld
~ This file is subject to the terms of the MIT license (see LICENSE.txt).
-->
<project name="jmockit" basedir=".">
<taskdef resource="testngtasks" classpath="lib/testng-6.8.jar"/>
<loadfile property="version" srcFile="version.txt"/>
<path id="common.classpath">
<fileset dir="lib" includes="*.jar"/>
</path>
<target name="createJavadocs">
<property name="api" value="../jmockit.github.io/api1x"/>
<delete dir="${api}" includes="**/*.html" excludes="overview.html" quiet="true"/>
<delete dir="${api}/resources" includes="*.gif" quiet="true"/>
<delete file="${api}/stylesheet.css"/>
<javadoc
destdir="${api}" overview="${api}/overview.html"
classpathref="common.classpath" classpath="main/target/classes"
nodeprecated="true" noindex="true" notree="true" nohelp="true" breakiterator="yes"
windowtitle="JMockit Toolkit API"
encoding="UTF-8" charset="UTF-8" locale="en">
<arg line="-notimestamp -quiet -Xdoclint:none"/>
<fileset dir="${basedir}/main/src">
<include name="mockit/*.java"/>
<include name="mockit/integration/junit4/*.java"/>
</fileset>
<link href="http://docs.oracle.com/javase/8/docs/api/" offline="true" packagelistloc="${api}/javase"/>
<link href="http://docs.oracle.com/javaee/7/docs/api/" offline="true" packagelistloc="${api}/javaee"/>
<doctitle><![CDATA[
<a href="http://jmockit.org" target="_top"><img src="resources/logo.png" style="vertical-align:middle">
JMockit</a>
- API Documentation
]]></doctitle>
<header><![CDATA[
<a href="http://jmockit.org" target="_top">
<img src="resources/logo.png" style="padding:4px;vertical-align:middle">JMockit Home</a>
]]></header>
<footer><![CDATA[
<a href="http://jmockit.org" target="_top">
<img src="resources/logo.png" style="padding:4px;vertical-align:middle">JMockit Home</a>
]]></footer>
</javadoc>
<delete file="${api}/constant-values.html"/>
<replace dir="${api}/mockit" includes="*.html" token="resources/logo.png" value="../resources/logo.png"/>
<replace
dir="${api}/mockit/integration/junit4" includes="*.html"
token="resources/logo.png" value="../../../resources/logo.png"/>
<replace dir="${api}" includes="*.html">
<replacetoken><![CDATA[</head>]]></replacetoken>
<replacevalue><![CDATA[<link rel="shortcut icon" type="image/x-icon" href="resources/favicon.ico">
</head>]]></replacevalue>
</replace>
<replace dir="${api}/mockit" includes="*.html">
<replacetoken><![CDATA[</head>]]></replacetoken>
<replacevalue><![CDATA[<link rel="shortcut icon" type="image/x-icon" href="../resources/favicon.ico">
</head>]]></replacevalue>
</replace>
<replace dir="${api}/mockit/integration" includes="*/*.html">
<replacetoken><![CDATA[</head>]]></replacetoken>
<replacevalue><![CDATA[<link rel="shortcut icon" type="image/x-icon" href="../../../resources/favicon.ico">
</head>]]></replacevalue>
</replace>
</target>
<target name="createJar">
<delete file="jmockit.jar"/>
<jar destfile="jmockit.jar">
<fileset file="LICENSE.txt"/>
<fileset file="NOTICE.txt"/>
<fileset dir="main/src" includes="mockit/**/*.java **/attach/**/*.java org/junit/**/*.java"/>
<fileset dir="main/src" includes="**/*.css **/*.js **/*.png"/>
<fileset dir="main/target/classes" includes="mockit/**/*.class **/attach/**/*.class org/junit/**/*.class"/>
<manifest>
<attribute name="Main-Class" value="mockit.coverage.CodeCoverage"/>
<attribute name="Premain-Class" value="mockit.internal.startup.Startup"/>
<attribute name="Agent-Class" value="mockit.internal.startup.Startup"/>
<attribute name="Can-Redefine-Classes" value="true"/>
<attribute name="Can-Retransform-Classes" value="true"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
<service type="org.junit.platform.engine.TestEngine" provider="mockit.integration.junit5.JMockitTestEngine"/>
<service type="org.testng.ITestNGListener" provider="mockit.integration.testng.TestNGRunnerDecorator"/>
</jar>
</target>
<target name="createZip">
<zip
destfile="../artifacts1x/jmockit-${version}.zip"
basedir=".." includes="jmockit1.org/**, jmockit.github.io/**"
excludes="jmockit1.org/**/*.i*, jmockit.github.io/*.i*, jmockit1.org/ISSUE_TEMPLATE.txt, jmockit1.org/*.zip,
jmockit1.org/**/*.ser, jmockit1.org/**/lib/**, jmockit1.org/*/**/*.jar, jmockit1.org/.shelf/**,
jmockit1.org/**/target/**, jmockit1.org/**/classes/**, jmockit1.org/**/test-classes/**,
jmockit1.org/**/test-output/**, jmockit1.org/**/coverage-report/**, jmockit1.org/**/*.html"
encoding="UTF-8"/>
</target>
<macrodef name="testReport">
<attribute name="name"/>
<sequential>
<junitreport>
<fileset dir="." includes="TEST-*.xml"/>
<report format="noframes" styledir="${ant.home}/etc"/>
</junitreport>
<delete dir="." includes="TEST*-*.xml" quiet="true"/>
<move file="junit-noframes.html" tofile="@{name}.html"/>
</sequential>
</macrodef>
<target name="tests">
<junit fork="yes" forkmode="once" dir="main" showoutput="true" printsummary="true">
<assertions><enable/></assertions>
<jvmarg value="-javaagent:../jmockit.jar"/>
<classpath refid="common.classpath"/>
<classpath location="main/target/test-classes"/>
<classpath location="main/target/classes"/>
<batchtest>
<fileset dir="main/target/test-classes">
<include name="**/*Test.class"/>
<exclude name="**/*CodeUnderTest.class"/>
<exclude name="**/Base*Test.class"/>
<exclude name="mockit/integration/testng/*Test.class"/>
<exclude name="**/MockStateBetweenTestMethodsNGTest.class"/>
<exclude name="**/ExecutingTest.class"/>
</fileset>
</batchtest>
<formatter type="xml"/>
</junit>
<testReport name="main/JMockitTests"/>
<testng workingdir="main">
<classpath refid="common.classpath"/>
<classpath path="jmockit.jar"/>
<classpath>
<pathelement location="main/target/test-classes"/>
</classpath>
<classfileset
dir="main/target/test-classes"
includes="mockit/integration/testng/*Test.class"
excludes="mockit/integration/testng/BaseTestNGDecoratorTest.class
mockit/integration/testng/TestNGViolatedExpectationsTest.class"/>
</testng>
</target>
<target name="coverageTests">
<junit fork="yes" forkmode="once" dir="coverageTests" showoutput="true" printsummary="true">
<classpath path="jmockit.jar"/>
<classpath refid="common.classpath"/>
<classpath location="coverageTests/target/test-classes"/>
<classpath location="coverageTests/target/classes"/>
<sysproperty key="coverage-metrics" value="all"/>
<batchtest>
<fileset
dir="coverageTests/target/test-classes" includes="**/*Test.class" excludes="**/CoverageTest.class"/>
</batchtest>
<formatter type="xml"/>
</junit>
<testReport name="coverageTests/CoverageTests"/>
</target>
<target name="sampleTests">
<junit fork="yes" forkmode="once" dir="samples" showoutput="true" printsummary="true">
<assertions><enable/></assertions>
<classpath path="jmockit.jar"/>
<sysproperty key="coverage-output" value="serial"/>
<classpath refid="common.classpath"/>
<classpath>
<fileset dir="samples" includes="**/lib/*.jar"/>
<dirset dir="samples">
<include name="*/target/classes"/>
<include name="*/target/test-classes"/>
</dirset>
</classpath>
<batchtest>
<fileset dir="samples/orderMngmntWebapp/target/test-classes" includes="**/*Test.class"/>
<fileset dir="samples/tutorial/target/test-classes" includes="**/*Test.class"/>
</batchtest>
<formatter type="xml"/>
</junit>
<testReport name="samples/JMockitSampleTests"/>
<property name="sampleDir" value="samples/LoginService"/>
<testng workingdir="${sampleDir}">
<classpath refid="common.classpath"/>
<classpath path="jmockit.jar"/>
<sysproperty key="coverage-output" value="serial"/>
<classpath>
<fileset dir="samples" includes="lib/*.jar"/>
<pathelement location="${sampleDir}/target/classes"/>
<pathelement location="${sampleDir}/target/test-classes"/>
</classpath>
<classfileset dir="${sampleDir}/target/test-classes" includes="**/*Test.class"/>
</testng>
<java fork="yes" dir="samples" jar="jmockit.jar">
<jvmarg line="-Dcoverage-output=html"/>
<arg line=". LoginService"/>
</java>
<delete file="samples/coverage.ser"/>
<delete file="samples/LoginService/coverage.ser"/>
</target>
</project>