#7 Set Ant properties on error / failure

0.4
closed
Ant task (3)
3
2003-08-13
2003-06-21
No

Xandy Johnson writes:

I'd like to see the Macker Ant Task have the ability to set
Ant
properties both on error conditions and on rule violations.
This would
be very much like the failureProperty and errorProperty of
the JUnit Ant
Task. The errorProperty would be set if there is some error
condition
other than rule violations (e.g. a malformed rule) and the
ruleViolationProperty would be set if there are rule
violations. A Use
Case for such a feature is sending email only if there are
problems.

I spent a few minutes starting this, but that was over a
week ago. I've
attached the trivial patch of what I had so far. I'm not
even sure of
its state. The main thing I don't know how to do is to
handle the case
of a forked JVM. I wish I had the time to see this through,
but I'm
falling further and further behind on my "real" tasks at
work and I'm
not sure when I'd get to this. I'd really appreciate if
someone else
would take the idea and run with it.

Thanks,
Xandy

Discussion

  • Paul Cantrell

    Paul Cantrell - 2003-06-21
    • priority: 4 --> 3
     
  • Paul Cantrell

    Paul Cantrell - 2003-08-13

    Logged In: YES
    user_id=41726

    Just implemented "angerProperty". JUnit, our example here,
    sets both "failureProperty" and "errorProperty", but JUnit (1) may
    require cleanup, and (2) may have errors which are really
    failures, and neither of these is the case for Macker. Thus, just
    one property.

    Might add more options to set properties for summary line, split
    by severities, etc ... but this should meet Xandy's needs for now,
    I hope.

     
  • Paul Cantrell

    Paul Cantrell - 2003-08-13
    • milestone: 212787 --> 0.4
    • assigned_to: nobody --> melquiades
    • status: open --> closed
     
  • Paul Cantrell

    Paul Cantrell - 2003-08-25

    Logged In: YES
    user_id=41726

    Xandy's original patch:

    Index: src/net/innig/macker/ant/MackerAntTask.java

    ==========================
    RCS file: /cvsroot/macker/macker/src/net/innig/macker/ant/
    MackerAntTask.java,v
    retrieving revision 1.10
    diff -u -r1.10 MackerAntTask.java
    --- src/net/innig/macker/ant/MackerAntTask.java 10 May
    2003 20:21:12 -0000 1.10
    +++ src/net/innig/macker/ant/MackerAntTask.java 21 Jun
    2003 20:28:51 -0000
    @@ -69,6 +69,10 @@
    System.out.println(mime.getMessage());
    if(failOnError)
    throw new
    BuildException(MACKER_IS_MAD_MESSAGE);
    + if(ruleViolationProperty != null)
    + {
    + getProject().setProperty(ruleViolationProperty,
    "true");
    + }
    }
    catch(RulesException re)
    {
    @@ -101,6 +105,9 @@

    public void setFailOnError(boolean failOnError)
    { this.failOnError = failOnError; }
    +
    + public void setFailureProperty(String ruleViolationProperty)
    + { this.ruleViolationProperty = ruleViolationProperty; }

    public void setPrintThreshold(String threshold)
    {
    @@ -198,6 +205,7 @@

    private boolean fork = false;
    private boolean failOnError = true;
    + private String ruleViolationProperty = null;
    private boolean verbose = false;
    private List/*<File>*/ rulesFileList, classFileList;
    private List/*<String>*/ jvmArgs;

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks