From 3078886d89c8e27e4e4ec7bcc8263cd070bfcf05 Mon Sep 17 00:00:00 2001 From: "Jesse N. Glick" Date: Fri, 26 Mar 2010 18:27:54 +0000 Subject: [PATCH] Proven to be useful to pick up just one feature of BigProjectLogger without all the chrome. git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@928005 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 ++ .../tools/ant/listener/BigProjectLogger.java | 19 +------- .../ant/listener/SimpleBigProjectLogger.java | 46 +++++++++++++++++++ 3 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 src/main/org/apache/tools/ant/listener/SimpleBigProjectLogger.java diff --git a/WHATSNEW b/WHATSNEW index 4e48b0368..36454f296 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -116,6 +116,9 @@ Other changes: 1.7.1. Bugzilla Report 48734. + * Added SimpleBigProjectLogger, intermediate between NoBannerLogger and + BigProjectLogger. + Changes from Ant 1.8.0RC1 TO Ant 1.8.0 ====================================== diff --git a/src/main/org/apache/tools/ant/listener/BigProjectLogger.java b/src/main/org/apache/tools/ant/listener/BigProjectLogger.java index 7f7c3d4cb..8ee1195b2 100644 --- a/src/main/org/apache/tools/ant/listener/BigProjectLogger.java +++ b/src/main/org/apache/tools/ant/listener/BigProjectLogger.java @@ -18,7 +18,6 @@ package org.apache.tools.ant.listener; import org.apache.tools.ant.BuildEvent; -import org.apache.tools.ant.NoBannerLogger; import org.apache.tools.ant.SubBuildListener; import org.apache.tools.ant.Project; import org.apache.tools.ant.util.StringUtils; @@ -33,7 +32,7 @@ import java.io.File; * @since Ant1.7.1 */ -public class BigProjectLogger extends NoBannerLogger +public class BigProjectLogger extends SimpleBigProjectLogger implements SubBuildListener { private volatile boolean subBuildStartedRaised = false; @@ -114,22 +113,6 @@ public class BigProjectLogger extends NoBannerLogger super.messageLogged(event); } - /** - * Override point, extract the target name - * - * @param event the event to work on - * @return the target name -including the owning project name (if non-null) - */ - protected String extractTargetName(BuildEvent event) { - String targetName = event.getTarget().getName(); - String projectName = extractProjectName(event); - if (projectName != null && targetName != null) { - return projectName + '.' + targetName; - } else { - return targetName; - } - } - /** * {@inheritDoc} diff --git a/src/main/org/apache/tools/ant/listener/SimpleBigProjectLogger.java b/src/main/org/apache/tools/ant/listener/SimpleBigProjectLogger.java new file mode 100644 index 000000000..18f8dc684 --- /dev/null +++ b/src/main/org/apache/tools/ant/listener/SimpleBigProjectLogger.java @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +package org.apache.tools.ant.listener; + +import org.apache.tools.ant.BuildEvent; +import org.apache.tools.ant.NoBannerLogger; + +/** + * Displays subproject names like {@link BigProjectLogger} + * but is otherwise as quiet as {@link NoBannerLogger}. + * @since Ant1.8.1 + */ +public class SimpleBigProjectLogger extends NoBannerLogger { + + /** + * Override point, extract the target name + * + * @param event the event to work on + * @return the target name -including the owning project name (if non-null) + */ + protected String extractTargetName(BuildEvent event) { + String targetName = super.extractTargetName(event); + String projectName = extractProjectName(event); + if (projectName != null && targetName != null) { + return projectName + '.' + targetName; + } else { + return targetName; + } + } + +}