geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r439727 - in /geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis: AntLoggerAdapter.java AntMojoSupport.java
Date Sun, 03 Sep 2006 05:57:52 GMT
Author: jdillon
Date: Sat Sep  2 22:57:52 2006
New Revision: 439727

URL: http://svn.apache.org/viewvc?rev=439727&view=rev
Log:
Externalize ant to maven logging bridge
Default to use emacs style

Added:
    geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java
  (with props)
Modified:
    geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntMojoSupport.java

Added: geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java?rev=439727&view=auto
==============================================================================
--- geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java
(added)
+++ geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java
Sat Sep  2 22:57:52 2006
@@ -0,0 +1,71 @@
+/*
+ * 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.geronimo.genesis;
+
+import java.io.PrintStream;
+
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.BuildLogger;
+import org.apache.tools.ant.DefaultLogger;
+
+import org.apache.maven.plugin.logging.Log;
+
+/**
+ * Support for Ant-based Mojos.
+ *
+ * @version $Rev$ $Date$
+ */
+public class AntLoggerAdapter
+    extends DefaultLogger
+{
+    protected Log log;
+    
+    public AntLoggerAdapter(final Log log) {
+        super();
+        
+        assert log != null;
+        
+        this.log = log;
+    }
+    
+    protected void printMessage(final String message, final PrintStream stream, final int
priority) {
+        assert message != null;
+        assert stream != null;
+
+        switch (priority) {
+            case Project.MSG_ERR:
+                log.error(message);
+                break;
+
+            case Project.MSG_WARN:
+                log.warn(message);
+                break;
+
+            case Project.MSG_INFO:
+                log.info(message);
+                break;
+
+            case Project.MSG_VERBOSE:
+            case Project.MSG_DEBUG:
+                log.debug(message);
+                break;
+        }
+    }
+}

Propchange: geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntLoggerAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntMojoSupport.java
URL: http://svn.apache.org/viewvc/geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntMojoSupport.java?rev=439727&r1=439726&r2=439727&view=diff
==============================================================================
--- geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntMojoSupport.java
(original)
+++ geronimo/genesis/trunk/plugins/plugin-support/src/main/java/org/apache/geronimo/genesis/AntMojoSupport.java
Sat Sep  2 22:57:52 2006
@@ -51,45 +51,24 @@
 
         ant = new Project();
         ant.setBaseDir(getProject().getBasedir());
+        
+        initAntLogger(ant);
 
-        BuildLogger antLogger = new DefaultLogger() {
-            protected void printMessage(final String message, final PrintStream stream, final
int priority) {
-                assert message != null;
-                assert stream != null;
-
-                switch (priority) {
-                case Project.MSG_ERR:
-                    log.error(message);
-                    break;
-
-                case Project.MSG_WARN:
-                    log.warn(message);
-                    break;
-
-                case Project.MSG_INFO:
-                    log.info(message);
-                    break;
-
-                case Project.MSG_VERBOSE:
-                case Project.MSG_DEBUG:
-                    log.debug(message);
-                    break;
-                }
-            }
-        };
+        ant.init();
 
+        // Inherit properties from Maven
+        inheritProperties();
+    }
+    
+    protected void initAntLogger(final Project ant) {
+        AntLoggerAdapter antLogger = new AntLoggerAdapter(log);
+        antLogger.setEmacsMode(true);
         antLogger.setOutputPrintStream(System.out);
         antLogger.setErrorPrintStream(System.err);
         antLogger.setMessageOutputLevel(Project.MSG_INFO);
-
         ant.addBuildListener(antLogger);
-
-        ant.init();
-
-        // Inherit properties from Maven
-        inheritProperties();
     }
-
+    
     protected void setProperty(final String name, Object value) {
         assert name != null;
         assert value != null;



Mime
View raw message