maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From schu...@apache.org
Subject [1/7] maven git commit: [MNG-3507] use new maven-shared-utils styled messages API [Forced Update!]
Date Wed, 29 Jun 2016 03:25:21 GMT
Repository: maven
Updated Branches:
  refs/heads/MNG-6006 b14478659 -> 499c975db (forced update)


[MNG-3507] use new maven-shared-utils styled messages API

Project: http://git-wip-us.apache.org/repos/asf/maven/repo
Commit: http://git-wip-us.apache.org/repos/asf/maven/commit/d0d5303d
Tree: http://git-wip-us.apache.org/repos/asf/maven/tree/d0d5303d
Diff: http://git-wip-us.apache.org/repos/asf/maven/diff/d0d5303d

Branch: refs/heads/MNG-6006
Commit: d0d5303dfaaee58859d8cf088f7ff6e7bcfd9527
Parents: 934e030
Author: Hervé Boutemy <hboutemy@apache.org>
Authored: Tue Jun 28 23:53:45 2016 +0200
Committer: Hervé Boutemy <hboutemy@apache.org>
Committed: Tue Jun 28 23:53:45 2016 +0200

----------------------------------------------------------------------
 apache-maven/pom.xml                            |  4 +
 maven-core/pom.xml                              |  8 +-
 .../lifecycle/LifecycleExecutionException.java  |  6 +-
 maven-embedder/pom.xml                          |  4 -
 .../org/apache/maven/cli/CLIReportingUtils.java |  4 +-
 .../java/org/apache/maven/cli/MavenCli.java     | 21 +++--
 .../maven/cli/event/ExecutionEventLogger.java   | 88 ++++++++++----------
 .../cli/logging/impl/gossip/ColorRenderer.java  | 24 +++---
 pom.xml                                         |  9 +-
 9 files changed, 83 insertions(+), 85 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/apache-maven/pom.xml
----------------------------------------------------------------------
diff --git a/apache-maven/pom.xml b/apache-maven/pom.xml
index 37751cc..ec11cc2 100644
--- a/apache-maven/pom.xml
+++ b/apache-maven/pom.xml
@@ -95,6 +95,10 @@ under the License.
       <groupId>com.planet57.gossip</groupId>
       <artifactId>gossip-slf4j</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.fusesource.jansi</groupId>
+      <artifactId>jansi</artifactId>
+    </dependency>
   </dependencies>
 
   <build>

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/maven-core/pom.xml
----------------------------------------------------------------------
diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 0728886..adf63a6 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -94,13 +94,7 @@ under the License.
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
-      <artifactId>maven-project-utils</artifactId>
-      <exclusions>
-        <exclusion>
-          <groupId>org.apache.maven</groupId>
-          <artifactId>maven-core</artifactId>
-        </exclusion>
-      </exclusions>
+      <artifactId>maven-shared-utils</artifactId>
     </dependency>
     <!-- Plexus -->
     <dependency>

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
----------------------------------------------------------------------
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
b/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
index 5645abd..0578cd1 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionException.java
@@ -19,11 +19,11 @@ package org.apache.maven.lifecycle;
  * under the License.
  */
 
-import static org.apache.maven.shared.project.utils.AnsiUtils.ansi;
+import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.project.utils.AnsiUtils;
+import org.apache.maven.shared.utils.logging.MessageBuffer;
 
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
@@ -78,7 +78,7 @@ public class LifecycleExecutionException
 
     private static String createMessage( MojoExecution execution, MavenProject project, Throwable
cause )
     {
-        AnsiUtils buffer = ansi( 256 );
+        MessageBuffer buffer = buffer( 256 );
 
         buffer.a( "Failed to execute goal" );
 

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/maven-embedder/pom.xml
----------------------------------------------------------------------
diff --git a/maven-embedder/pom.xml b/maven-embedder/pom.xml
index 95504c7..f9973c5 100644
--- a/maven-embedder/pom.xml
+++ b/maven-embedder/pom.xml
@@ -113,10 +113,6 @@ under the License.
       <artifactId>plexus-cipher</artifactId>
     </dependency>
     <dependency>
-      <groupId>org.apache.maven.shared</groupId>
-      <artifactId>maven-project-utils</artifactId>
-    </dependency>
-    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
index aa28b27..75da4f3 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
@@ -19,7 +19,7 @@ package org.apache.maven.cli;
  * under the License.
  */
 
-import static org.apache.maven.shared.project.utils.AnsiUtils.ansi;
+import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
 import java.io.IOException;
 import java.io.InputStream;
@@ -57,7 +57,7 @@ public final class CLIReportingUtils
         final String ls = System.getProperty( "line.separator" );
         Properties properties = getBuildProperties();
         StringBuilder version = new StringBuilder( 256 );
-        version.append( ansi().strong( createMavenVersionString( properties ) ) ).append(
ls );
+        version.append( buffer().strong( createMavenVersionString( properties ) ) ).append(
ls );
         version.append( reduce(
             properties.getProperty( "distributionShortName" ) + " home: " + System.getProperty(
"maven.home",
                                                                                         
       "<unknown Maven "

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index a0e09f2..3e1194b 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -19,7 +19,7 @@ package org.apache.maven.cli;
  * under the License.
  */
 
-import static org.apache.maven.shared.project.utils.AnsiUtils.ansi;
+import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
 import java.io.BufferedInputStream;
 import java.io.Console;
@@ -91,7 +91,7 @@ import org.apache.maven.model.profile.ProfileSelector;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.properties.internal.EnvironmentUtils;
 import org.apache.maven.properties.internal.SystemProperties;
-import org.apache.maven.shared.project.utils.AnsiUtils;
+import org.apache.maven.shared.utils.logging.MessageUtils;
 import org.apache.maven.toolchain.building.DefaultToolchainsBuildingRequest;
 import org.apache.maven.toolchain.building.ToolchainsBuilder;
 import org.apache.maven.toolchain.building.ToolchainsBuildingResult;
@@ -211,10 +211,9 @@ public class MavenCli
     {
         MavenCli cli = new MavenCli();
 
-        AnsiUtils.systemInstall();
-        AnsiUtils.setEnabled( true ); // activate colors by default: will be deactivated
later if necessary
+        MessageUtils.systemInstall();
         int result = cli.doMain( new CliRequest( args, classWorld ) );
-        AnsiUtils.systemUninstall();
+        MessageUtils.systemUninstall();
 
         return result;
     }
@@ -476,7 +475,7 @@ public class MavenCli
 
         if ( cliRequest.commandLine.hasOption( CLIManager.BATCH_MODE ) )
         {
-            AnsiUtils.setEnabled( false );
+            MessageUtils.setColor( false );
         }
 
         if ( cliRequest.commandLine.hasOption( CLIManager.LOG_FILE ) )
@@ -484,7 +483,7 @@ public class MavenCli
             File logFile = new File( cliRequest.commandLine.getOptionValue( CLIManager.LOG_FILE
) );
             logFile = resolveFile( logFile, cliRequest.workingDirectory );
 
-            AnsiUtils.setEnabled( false );
+            MessageUtils.setColor( false );
 
             // redirect stdout and stderr to file
             try
@@ -1021,11 +1020,11 @@ public class MavenCli
             if ( !cliRequest.showErrors )
             {
                 slf4jLogger.error( "To see the full stack trace of the errors, re-run Maven
with the "
-                    + ansi().strong( "-e" ) + " switch." );
+                    + buffer().strong( "-e" ) + " switch." );
             }
             if ( !slf4jLogger.isDebugEnabled() )
             {
-                slf4jLogger.error( "Re-run Maven using the " + ansi().strong( "-X" )
+                slf4jLogger.error( "Re-run Maven using the " + buffer().strong( "-X" )
                     + " switch to enable full debug logging." );
             }
 
@@ -1037,7 +1036,7 @@ public class MavenCli
 
                 for ( Map.Entry<String, String> entry : references.entrySet() )
                 {
-                    slf4jLogger.error( ansi().strong( entry.getValue() ) + " " + entry.getKey()
);
+                    slf4jLogger.error( buffer().strong( entry.getValue() ) + " " + entry.getKey()
);
                 }
             }
 
@@ -1045,7 +1044,7 @@ public class MavenCli
             {
                 slf4jLogger.error( "" );
                 slf4jLogger.error( "After correcting the problems, you can resume the build
with the command" );
-                slf4jLogger.error( ansi().strong().a( "  mvn <goals> -rf :" )
+                slf4jLogger.error( buffer().strong().a( "  mvn <goals> -rf :" )
                                    .a( project.getArtifactId() ).reset().toString() );
             }
 

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
index 911f605..2c2e4c2 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/event/ExecutionEventLogger.java
@@ -21,7 +21,7 @@ package org.apache.maven.cli.event;
 
 import static org.apache.maven.cli.CLIReportingUtils.formatDuration;
 import static org.apache.maven.cli.CLIReportingUtils.formatTimestamp;
-import static org.apache.maven.shared.project.utils.AnsiUtils.ansi;
+import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
 import org.apache.commons.lang3.Validate;
 import org.apache.maven.execution.AbstractExecutionListener;
@@ -34,7 +34,7 @@ import org.apache.maven.execution.MavenSession;
 import org.apache.maven.plugin.MojoExecution;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.project.utils.AnsiUtils;
+import org.apache.maven.shared.utils.logging.MessageBuffer;
 import org.codehaus.plexus.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -83,7 +83,7 @@ public class ExecutionEventLogger
 
     private void infoMain( String msg )
     {
-        logger.info( ansi().strong( msg ).toString() );
+        logger.info( buffer().strong( msg ).toString() );
     }
 
     @Override
@@ -161,11 +161,11 @@ public class ExecutionEventLogger
 
             if ( buildSummary == null )
             {
-                buffer.append( ansi().warning( "SKIPPED" ) );
+                buffer.append( buffer().warning( "SKIPPED" ) );
             }
             else if ( buildSummary instanceof BuildSuccess )
             {
-                buffer.append( ansi().success( "SUCCESS" ) );
+                buffer.append( buffer().success( "SUCCESS" ) );
                 buffer.append( " [" );
                 String buildTimeDuration = formatDuration( buildSummary.getTime() );
                 int padSize = MAX_PADDED_BUILD_TIME_DURATION_LENGTH - buildTimeDuration.length();
@@ -178,7 +178,7 @@ public class ExecutionEventLogger
             }
             else if ( buildSummary instanceof BuildFailure )
             {
-                buffer.append( ansi().failure( "FAILURE" ) );
+                buffer.append( buffer().failure( "FAILURE" ) );
                 buffer.append( " [" );
                 String buildTimeDuration = formatDuration( buildSummary.getTime() );
                 int padSize = MAX_PADDED_BUILD_TIME_DURATION_LENGTH - buildTimeDuration.length();
@@ -197,17 +197,17 @@ public class ExecutionEventLogger
     private void logResult( MavenSession session )
     {
         infoLine( '-' );
-        AnsiUtils ansi = ansi();
+        MessageBuffer buffer = buffer();
 
         if ( session.getResult().hasExceptions() )
         {
-            ansi.failure( "BUILD FAILURE" );
+            buffer.failure( "BUILD FAILURE" );
         }
         else
         {
-            ansi.success( "BUILD SUCCESS" );
+            buffer.success( "BUILD SUCCESS" );
         }
-        logger.info( ansi.toString() );
+        logger.info( buffer.toString() );
     }
 
     private void logStats( MavenSession session )
@@ -282,12 +282,12 @@ public class ExecutionEventLogger
         {
             logger.info( "" );
 
-            AnsiUtils ansi = ansi().strong( "--- " );
-            append( ansi, event.getMojoExecution() );
-            append( ansi, event.getProject() );
-            ansi.strong( " ---" );
+            MessageBuffer buffer = buffer().strong( "--- " );
+            append( buffer, event.getMojoExecution() );
+            append( buffer, event.getProject() );
+            buffer.strong( " ---" );
 
-            logger.info( ansi.toString() );
+            logger.info( buffer.toString() );
         }
     }
 
@@ -302,14 +302,14 @@ public class ExecutionEventLogger
         {
             logger.info( "" );
 
-            AnsiUtils ansi = ansi().strong( ">>> " );
-            append( ansi, event.getMojoExecution() );
-            ansi.strong( " > " );
-            appendForkInfo( ansi, event.getMojoExecution().getMojoDescriptor() );
-            append( ansi, event.getProject() );
-            ansi.strong( " >>>" );
+            MessageBuffer buffer = buffer().strong( ">>> " );
+            append( buffer, event.getMojoExecution() );
+            buffer.strong( " > " );
+            appendForkInfo( buffer, event.getMojoExecution().getMojoDescriptor() );
+            append( buffer, event.getProject() );
+            buffer.strong( " >>>" );
 
-            logger.info( ansi.toString() );
+            logger.info( buffer.toString() );
         }
     }
 
@@ -326,53 +326,53 @@ public class ExecutionEventLogger
         {
             logger.info( "" );
 
-            AnsiUtils ansi = ansi().strong( "<<< " );
-            append( ansi, event.getMojoExecution() );
-            ansi.strong( " < " );
-            appendForkInfo( ansi, event.getMojoExecution().getMojoDescriptor() );
-            append( ansi, event.getProject() );
-            ansi.strong( " <<<" );
+            MessageBuffer buffer = buffer().strong( "<<< " );
+            append( buffer, event.getMojoExecution() );
+            buffer.strong( " < " );
+            appendForkInfo( buffer, event.getMojoExecution().getMojoDescriptor() );
+            append( buffer, event.getProject() );
+            buffer.strong( " <<<" );
 
-            logger.info( ansi.toString() );
+            logger.info( buffer.toString() );
         }
     }
 
-    private void append( AnsiUtils ansi, MojoExecution me )
+    private void append( MessageBuffer buffer, MojoExecution me )
     {
-        ansi.mojo().a( me.getArtifactId() ).a( ':' ).a( me.getVersion() );
-        ansi.a( ':' ).a( me.getGoal() ).reset();
+        buffer.mojo().a( me.getArtifactId() ).a( ':' ).a( me.getVersion() );
+        buffer.a( ':' ).a( me.getGoal() ).reset();
         if ( me.getExecutionId() != null )
         {
-            ansi.strong().a( " (" ).a( me.getExecutionId() ).a( ')' ).reset();
+            buffer.strong().a( " (" ).a( me.getExecutionId() ).a( ')' ).reset();
         }
     }
 
-    private void appendForkInfo( AnsiUtils ansi, MojoDescriptor md )
+    private void appendForkInfo( MessageBuffer buffer, MojoDescriptor md )
     {
-        ansi.strong();
+        buffer.strong();
         if ( StringUtils.isNotEmpty( md.getExecutePhase() ) )
         {
             // forked phase
             if ( StringUtils.isNotEmpty( md.getExecuteLifecycle() ) )
             {
-                ansi.a( '[' );
-                ansi.a( md.getExecuteLifecycle() );
-                ansi.a( ']' );
+                buffer.a( '[' );
+                buffer.a( md.getExecuteLifecycle() );
+                buffer.a( ']' );
             }
-            ansi.a( md.getExecutePhase() );
+            buffer.a( md.getExecutePhase() );
         }
         else
         {
             // forked goal
-            ansi.a( ':' );
-            ansi.a( md.getExecuteGoal() );
+            buffer.a( ':' );
+            buffer.a( md.getExecuteGoal() );
         }
-        ansi.reset();
+        buffer.reset();
     }
 
-    private void append( AnsiUtils ansi, MavenProject project )
+    private void append( MessageBuffer buffer, MavenProject project )
     {
-        ansi.a( " @ " ).project( project.getArtifactId() );
+        buffer.a( " @ " ).project( project.getArtifactId() );
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
----------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
index ba0c20a..a21d89d 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/logging/impl/gossip/ColorRenderer.java
@@ -19,7 +19,7 @@ package org.apache.maven.cli.logging.impl.gossip;
  * under the License.
  */
 
-import static org.apache.maven.shared.project.utils.AnsiUtils.ansi;
+import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;
 
 import com.planet57.gossip.Event;
 import com.planet57.gossip.Level;
@@ -46,20 +46,20 @@ extends com.planet57.gossip.render.PatternRenderer
         {
             case TRACE:
             case DEBUG:
-                buff.append( ansi().debug().a( level.name() ).reset() );
+                buff.append( buffer().debug().a( level.name() ).reset() );
                 break;
 
             case INFO:
-                buff.append( ansi().info().a( level.name() ).reset() );
+                buff.append( buffer().info().a( level.name() ).reset() );
                 break;
 
             case WARN:
                 // Maven uses WARNING instead of WARN
-                buff.append( ansi().warning().a( WARNING ).reset() );
+                buff.append( buffer().warning().a( WARNING ).reset() );
                 break;
 
             case ERROR:
-                buff.append( ansi().error().a( level.name() ).reset() );
+                buff.append( buffer().error().a( level.name() ).reset() );
                 break;
 
             default:
@@ -72,7 +72,7 @@ extends com.planet57.gossip.render.PatternRenderer
     {
         StringBuilder tmp = new StringBuilder();
         super.renderName( event, tmp, shortName );
-        buff.append( ansi().success( tmp ) );
+        buff.append( buffer().success( tmp ) );
     }
 
 
@@ -88,11 +88,11 @@ extends com.planet57.gossip.render.PatternRenderer
             return;
         }
 
-        buff.append( ansi().failure( cause.getClass().getName() ) );
+        buff.append( buffer().failure( cause.getClass().getName() ) );
         if ( cause.getMessage() != null )
         {
             buff.append( ": " );
-            buff.append( ansi().failure( cause.getMessage() ) );
+            buff.append( buffer().failure( cause.getMessage() ) );
         }
         renderNewLine( buff );
 
@@ -101,19 +101,19 @@ extends com.planet57.gossip.render.PatternRenderer
             for ( StackTraceElement e : cause.getStackTrace() )
             {
                 buff.append( "    " );
-                buff.append( ansi().strong( "at" ).a( " " ).a( e.getClassName() ).a( "."
).a( e.getMethodName() ) );
-                buff.append( ansi().a( " (" ).strong( getLocation( e ) ).a( ")" ) );
+                buff.append( buffer().strong( "at" ).a( " " ).a( e.getClassName() ).a( "."
).a( e.getMethodName() ) );
+                buff.append( buffer().a( " (" ).strong( getLocation( e ) ).a( ")" ) );
                 renderNewLine( buff );
             }
 
             cause = cause.getCause();
             if ( cause != null )
             {
-                buff.append( ansi().strong( "Caused by" ).a( ": " ).a( cause.getClass().getName()
) );
+                buff.append( buffer().strong( "Caused by" ).a( ": " ).a( cause.getClass().getName()
) );
                 if ( cause.getMessage() != null )
                 {
                     buff.append( ": " );
-                    buff.append( ansi().failure( cause.getMessage() ) );
+                    buff.append( buffer().failure( cause.getMessage() ) );
                 }
                 renderNewLine( buff );
             }

http://git-wip-us.apache.org/repos/asf/maven/blob/d0d5303d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a3ea2c2..c447507 100644
--- a/pom.xml
+++ b/pom.xml
@@ -288,8 +288,13 @@ under the License.
       </dependency>
       <dependency>
         <groupId>org.apache.maven.shared</groupId>
-        <artifactId>maven-project-utils</artifactId>
-        <version>1.0.0-SNAPSHOT</version>
+        <artifactId>maven-shared-utils</artifactId>
+        <version>3.1.0-SNAPSHOT</version>
+      </dependency>
+      <dependency>
+        <groupId>org.fusesource.jansi</groupId>
+        <artifactId>jansi</artifactId>
+        <version>1.13</version>
       </dependency>
       <dependency>
         <groupId>org.slf4j</groupId>


Mime
View raw message