Subversion Repositories XServices

Rev

Rev 18 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18 Rev 20
Line 35... Line 35...
35
public class RunTask {
35
public class RunTask {
Line 36... Line 36...
36
 
36
 
37
    Project antproject;
37
    Project antproject;
38
    Target anttarget;
38
    Target anttarget;
39
    Task anttask;
39
    Task anttask;
40
    ByteArrayOutputStream out = new ByteArrayOutputStream();
40
    ByteArrayOutputStream myout = new ByteArrayOutputStream();
-
 
41
    ByteArrayOutputStream myerr = new ByteArrayOutputStream();
-
 
42
    PrintStream out = new PrintStream(myout);
41
    ByteArrayOutputStream err = new ByteArrayOutputStream();
43
    PrintStream err = new PrintStream(myerr);
Line 42... Line 44...
42
    TimestampedLogger log = null;
44
    TimestampedLogger log = null;
Line 43... Line 45...
43
 
45
 
44
    public RunTask(Task anttask) {
46
    public RunTask(Task anttask) {
45
 
47
 
46
        antproject = new Project();
48
        antproject = new Project();
47
        antproject.init();
49
        antproject.init();
48
        antproject.setBasedir(System.getProperty("java.io.tmpdir"));
50
        antproject.setBasedir(System.getProperty("java.io.tmpdir"));
49
        log = new TimestampedLogger();
51
        log = new TimestampedLogger();
Line 50... Line 52...
50
        log.setOutputPrintStream(new PrintStream(out));
52
        log.setOutputPrintStream(out);
Line 51... Line 53...
51
        log.setErrorPrintStream(new PrintStream(err));
53
        log.setErrorPrintStream(err);
Line 77... Line 79...
77
        Map<String, String> newMap = null;
79
        Map<String, String> newMap = null;
78
        origMap.putAll(antproject.getProperties());
80
        origMap.putAll(antproject.getProperties());
79
        try {
81
        try {
80
            antproject.executeTarget(anttarget.getName());
82
            antproject.executeTarget(anttarget.getName());
81
        } catch (BuildException ex) {
83
        } catch (BuildException ex) {
82
            new PrintStream(err).println(ex.getMessage());
84
            err.print(ex.getMessage());
83
            returnCode = 1;
85
            returnCode = 1;
84
        }
86
        }
85
        newMap = antproject.getProperties();
87
        newMap = antproject.getProperties();
Line 86... Line 88...
86
 
88
 
87
        for (Map.Entry<String, String> e : origMap.entrySet()) {
89
        for (Map.Entry<String, String> e : origMap.entrySet()) {
88
            newMap.remove(e.getKey());
90
            newMap.remove(e.getKey());
Line 89... Line 91...
89
        }
91
        }
90
 
92
 
91
        //anttask.execute();
93
        //anttask.execute();
92
        return new ReturnCode(returnCode,
94
        return new ReturnCode(returnCode,
93
                out.toString(),
95
                myout.toString(),
Line 94... Line 96...
94
                err.toString(),
96
                myerr.toString(),
95
                AntProperty.createAntPropertyList(newMap));
97
                AntProperty.createAntPropertyList(newMap));