ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 28738] - debugging with ant
Date Mon, 03 May 2004 15:16:14 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28738>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28738

debugging with ant





------- Additional Comments From jan@materne.de  2004-05-03 15:16 -------
Nice idea. I played a little bit:



build.xml
---------
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
    <echo> ************* Debug Mode ************* </echo>
    <delete dir="classes"/>
    <mkdir dir="classes"/>
    <javac srcdir="src" destdir="classes"/>
    <java classname="HelloWorld" classpath="classes"/>

    <echo> ************* LIVE Mode ************* </echo>
    <delete dir="classes"/>
    <delete dir="src-live"/>
    <mkdir dir="classes"/>
    <copy todir="src-live">
        <fileset dir="src"/>
    </copy>

    <!-- important is the .*? because .* matches too much -->
    <replaceregexp match="//@debug start.*?//@debug end" replace="" flags="gs">
        <fileset dir="src-live"/>
    </replaceregexp>

    <javac srcdir="src-live" destdir="classes"/>
    <java classname="HelloWorld" classpath="classes"/>

</project>



src/HelloWorld.java
-------------------
// see http://issues.apache.org/bugzilla/show_bug.cgi?id=28738
public class HelloWorld {

    public static void main(String arg[]){
        //@debug start
        log("debug:let say this is a debug code or logging");
        //@debug end

        System.out.println("HELLO WORLD");
    }

    //@debug start
    private static void log(String msg) {
        System.out.println("LOG: " + msg);
    }
    //@debug end
}


src-live/HelloWorld.java
------------------------
// see http://issues.apache.org/bugzilla/show_bug.cgi?id=28738
public class HelloWorld {

    public static void main(String arg[]){
        

        System.out.println("HELLO WORLD");
    }

    
}



Build-Output:
-------------
Buildfile: build.xml
     [echo]  ************* Debug Mode *************
   [delete] Deleting directory C:\tmp\anttests\preprocessor\classes
    [mkdir] Created dir: C:\tmp\anttests\preprocessor\classes
    [javac] Compiling 1 source file to C:\tmp\anttests\preprocessor\classes
     [java] LOG: debug:let say this is a debug code or logging
     [java] HELLO WORLD
     [echo]  ************* LIVE Mode *************
   [delete] Deleting directory C:\tmp\anttests\preprocessor\classes
   [delete] Deleting directory C:\tmp\anttests\preprocessor\src-live
    [mkdir] Created dir: C:\tmp\anttests\preprocessor\classes
     [copy] Copying 1 file to C:\tmp\anttests\preprocessor\src-live
    [javac] Compiling 1 source file to C:\tmp\anttests\preprocessor\classes
     [java] HELLO WORLD

BUILD SUCCESSFUL
Total time: 3 seconds



I suggest you close this bug if this is ok for you.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message