Java Code Examples for org.apache.tools.ant.BuildEvent#getMessage()

The following examples show how to use org.apache.tools.ant.BuildEvent#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AntLoggingAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example 2
Source File: AntLoggingAdapter.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example 3
Source File: AntLoggingAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example 4
Source File: AntLoggingAdapter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void messageLogged(BuildEvent event) {
    final StringBuffer message = new StringBuffer();
    if (event.getTask() != null) {
        String taskName = event.getTask().getTaskName();
        message.append("[ant:").append(taskName).append("] ");
    }
    final String messageText = event.getMessage();
    message.append(messageText);

    LogLevel level = Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER.get(event.getPriority());

    if (event.getException() != null) {
        logger.log(level, message.toString(), event.getException());
    } else {
        logger.log(level, message.toString());
    }
}
 
Example 5
Source File: LangtoolsIdeaAntLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void messageLogged(BuildEvent event) {
    String msg = event.getMessage();

    boolean processed = false;

    if (!tasks.isEmpty()) {
        Task task = tasks.peek();
        for (MessageKind messageKind : task.msgs) {
            if (messageKind.matches(msg)) {
                event.setMessage(msg, messageKind.priority);
                processed = true;
                if (messageKind == MessageKind.JAVAC_CRASH) {
                    crashFound = true;
                }
                break;
            }
        }
    }

    if (event.getPriority() == MSG_ERR || crashFound) {
        //we log errors regardless of owning task
        logger.messageLogged(event);
        suppressTaskFailures = true;
    } else if (processed) {
        logger.messageLogged(event);
    }
}
 
Example 6
Source File: JdkIdeaAntLogger.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void messageLogged(BuildEvent event) {
    String msg = event.getMessage();

    boolean processed = false;

    if (!tasks.isEmpty()) {
        Task task = tasks.peek();
        for (MessageKind messageKind : task.msgs) {
            if (messageKind.matches(msg)) {
                event.setMessage(msg, messageKind.priority);
                processed = true;
                if (messageKind == MessageKind.JAVAC_CRASH) {
                    crashFound = true;
                }
                break;
            }
        }
    }

    if (event.getPriority() == MSG_ERR || crashFound) {
        //we log errors regardless of owning task
        logger.messageLogged(event);
        suppressTaskFailures = true;
    } else if (processed) {
        logger.messageLogged(event);
    }
}
 
Example 7
Source File: NbBuildLogger.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public @Override void messageLogged(BuildEvent ev) {
    if (!running) { // #145722
        return;
    }
    AntBridge.suspendDelegation();
    try {
        checkForStop();
        AntEvent e = LoggerTrampoline.ANT_EVENT_CREATOR.makeAntEvent(new Event(ev, true));
        LOG.log(Level.FINER, "messageLogged: {0}", e);
        for (AntLogger l : getInterestedLoggersByEvent(e)) {
            try {
                l.messageLogged(e);
            } catch (RuntimeException x) {
                LOG.log(Level.WARNING, null, x);
            }
        }
        // Let the hacks begin!
        String msg = ev.getMessage();
        if (msg.contains("ant.PropertyHelper") || /* #71816 */ msg.contains("ant.projectHelper")) { // NOI18N
            // Only after this has been defined can we get any properties.
            // Even trying earlier will give a recursion error since this pseudoprop
            // is set lazily, which produces a new message logged event.
            projectsWithProperties.add(ev.getProject());
        }
        if (targetGetLocation == null) {
            // Try to figure out which imported targets belong to which actual scripts.
            // XXX consider keeping a singleton Matcher for each pattern and reusing it
            // or just doing string comparisons
            Matcher matcher;
            if ((matcher = PARSING_BUILDFILE_MESSAGE.matcher(msg)).matches()) {
                if (currentlyParsedMainScript != null) {
                    currentlyParsedImportedScript = matcher.group(1);
                }
                LOG.log(Level.FINE, "Got PARSING_BUILDFILE_MESSAGE: {0}", currentlyParsedImportedScript);
                setLastTask(null);
            } else if ((matcher = IMPORTING_FILE_MESSAGE.matcher(msg)).matches()) {
                currentlyParsedMainScript = matcher.group(1);
                currentlyParsedImportedScript = null;
                LOG.log(Level.FINE, "Got IMPORTING_FILE_MESSAGE: {0}", currentlyParsedMainScript);
                setLastTask(null);
            } else if ((matcher = PARSED_TARGET_MESSAGE.matcher(msg)).matches()) {
                if (currentlyParsedMainScript != null && currentlyParsedImportedScript != null) {
                    Map<String,String> targetLocations = knownImportedTargets.get(currentlyParsedMainScript);
                    if (targetLocations == null) {
                        targetLocations = new HashMap<String,String>();
                        knownImportedTargets.put(currentlyParsedMainScript, targetLocations);
                    }
                    targetLocations.put(matcher.group(1), currentlyParsedImportedScript);
                }
                LOG.log(Level.FINE, "Got PARSED_TARGET_MESSAGE: {0}", matcher.group(1));
                setLastTask(null);
            }
        }
    } finally {
        AntBridge.resumeDelegation();
    }
}