Better ant tasks for (test)debugging

This commit is contained in:
Jindra Petk
2013-08-27 21:36:27 +02:00
parent a40efda5bd
commit dbeda56ea3
3 changed files with 88 additions and 10 deletions

View File

@@ -41,7 +41,7 @@
</target>
<target name="compile">
<!--<delete dir="${COMPILEDIR}"/>-->
<!--<delete dir="${COMPILEDIR}"/>-->
<mkdir dir="${COMPILEDIR}"/>
<javac srcdir="${SOURCEDIR}" destdir="${COMPILEDIR}" includes="**/*.java" target="${TARGETJAVA}" source="${TARGETJAVA}" debug="true"
debuglevel="lines,vars,source" includeantruntime="false" encoding="utf-8">
@@ -57,11 +57,8 @@
</fileset>
</copy>
</target>
<target name="test" depends="compile">
<delete dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}/raw/"/>
<target name="compile-tests">
<delete dir="${COMPILETESTSDIR}"/>
<mkdir dir="${COMPILETESTSDIR}"/>
<javac srcdir="${TESTDIR}" destdir="${COMPILETESTSDIR}" includes="**/*.java" target="${TARGETJAVA}" debug="true" includeantruntime="false" encoding="utf-8">
@@ -71,6 +68,13 @@
<fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
</classpath>
</javac>
</target>
<target name="test" depends="compile,compile-tests">
<delete dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}/raw/"/>
<antcall target="coverage.instrumentation"/>
<taskdef classname="org.testng.TestNGAntTask" classpath="${TESTLIBDIR}/testng-6.8.jar" name="testng" />
@@ -78,7 +82,7 @@
<testng
outputDir="${TESTRESULTSDIR}"
haltOnFailure="false" verbose="2" workingDir="${basedir}">
haltOnFailure="false" verbose="2" workingDir="${basedir}" >
<classpath>
<pathelement path="${COMPILETESTSDIR}"/>
@@ -221,8 +225,8 @@
<fileset dir="libsrc/jsyntaxpane/jsyntaxpane/src/main/resources/META-INF/services/jsyntaxpane/syntaxkits/flasm3methodinfosyntaxkit" includes="**/config*.properties"/>
</copy>
<echo file="${LOCALESTARGETDIR}/readme.txt">${PROJECTNAME} ${VERSION} localization pack
-------------------------------------------------------------------
Please follow instructions on http://www.free-decompiler.com/flash/translations.html
-------------------------------------------------------------------
Please follow instructions on http://www.free-decompiler.com/flash/translations.html
</echo>
<zip destfile="${RELEASESDIR}/${LOCALESZIP}" basedir="${LOCALESTARGETDIR}"/>
</target>
@@ -298,4 +302,39 @@ Please follow instructions on http://www.free-decompiler.com/flash/translations.
<delete dir="${TESTRESULTSDIR}"/>
<delete dir="${LOCALESTARGETDIR}"/>
</target>
<!-- Debug one test method (Netbeans IDE) -->
<target name="debug-test-method" depends="compile-tests">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<fail unless="test.method">Must select some method in the IDE or set test.method</fail>
<delete dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}/raw/"/>
<nbjpdastart addressproperty="jpda.address" name="ffdec" transport="dt_socket">
<classpath>
<pathelement path="${COMPILEDIR}"/>
<fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
<fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
</classpath>
</nbjpdastart>
<taskdef classname="org.testng.TestNGAntTask" classpath="${TESTLIBDIR}/testng-6.8.jar" name="testng" />
<testng
outputDir="${TESTRESULTSDIR}"
haltOnFailure="false" verbose="2" workingDir="${basedir}" methods="${test.class}.${test.method}">
<classpath>
<pathelement path="${COMPILETESTSDIR}"/>
<pathelement path="${INSTRDIR}"/>
<pathelement path="${COMPILEDIR}"/>
<fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
<fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
</classpath>
<jvmarg value="-noverify" />
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<classfileset dir="${COMPILETESTSDIR}" includes="**/*.class" />
</testng>
</target>
</project>

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project basedir=".." name="ffdec-IDE">
<target name="debug-nb">
<import file="../build.xml"/>
<target name="debug-nb" depends="compile">
<path id="cp">
<pathelement path="${basedir}/build/classes"/>
<fileset dir="${basedir}/lib" includes="**/*.jar"/>
@@ -39,4 +40,29 @@
</classpath>
</java>
</target>
<!-- TODO: edit the following target according to your needs -->
<!-- (more info: http://www.netbeans.org/kb/articles/freeform-config.html#runsingle) -->
<target name="debug-selected-file-in-test" depends="compile-tests">
<fail unless="debug.class">Must set property 'debug.class'</fail>
<delete dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}"/>
<mkdir dir="${TESTRESULTSDIR}/raw/"/>
<nbjpdastart addressproperty="jpda.address" name="ffdec" transport="dt_socket">
<classpath id="cp">
<pathelement path="${COMPILEDIR}"/>
<fileset dir="${LIBRARIESDIR}" includes="**/*.jar"/>
<fileset dir="${TESTLIBDIR}" includes="**/*.jar"/>
</classpath>
</nbjpdastart>
<java classname="${debug.class}" fork="true">
<classpath refid="cp"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
</java>
</target>
</project>

View File

@@ -82,6 +82,19 @@
</arity>
</context>
</action>
<action name="debug.single">
<script>nbproject/ide-file-targets.xml</script>
<target>debug-selected-file-in-test</target>
<context>
<property>debug.class</property>
<folder>test</folder>
<pattern>\.java$</pattern>
<format>java-name</format>
<arity>
<one-file-only/>
</arity>
</context>
</action>
</ide-actions>
<export>
<type>folder</type>