Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MSHARED-978 add 'quiet' flag #6

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -105,6 +105,8 @@ public class DefaultInvocationRequest

private int timeoutInSeconds = NO_TIMEOUT;

private boolean quiet;

public File getBaseDirectory()
{
return basedir;
Expand Down Expand Up @@ -597,4 +599,21 @@ public void setTimeoutInSeconds( int timeoutInSeconds )
{
this.timeoutInSeconds = timeoutInSeconds;
}

/**
* {@inheritDoc}
*/
public boolean isQuiet()
{
return quiet;
}

/**
* {@inheritDoc}
*/
public InvocationRequest setQuiet( boolean quiet )
{
this.quiet = quiet;
return this;
}
}
Expand Up @@ -310,6 +310,14 @@ public interface InvocationRequest
*/
String getThreads();

/**
* Gets the quiet mode of the Maven invocation. By default, Maven is executed in normal mode.
*
* @return <code>true</code> if Maven should be executed in quiet mode, <code>false</code> if normal mode should
* be used.
*/
boolean isQuiet();

// ----------------------------------------------------------------------
// Reactor Failure Mode
// ----------------------------------------------------------------------
Expand Down Expand Up @@ -717,6 +725,15 @@ enum CheckSumPolicy
*/
InvocationRequest setBuilder( String id );

/**
* Sets the quiet mode of the Maven invocation. Equivalent of {@code -q} and {@code --quiet}
*
* @param quiet <code>true</code> if Maven should be executed in quiet mode, <code>false</code> if the normal mode
* should be used.
* @return This invocation request.
*/
InvocationRequest setQuiet( boolean quiet );

/**
* Get the current set builder strategy id equivalent of {@code --builder id}. <b>Note. This is available since
* Maven 3.2.1</b>
Expand Down
Expand Up @@ -505,6 +505,11 @@ else if ( CheckSumPolicy.Warn.equals( checksumPolicy ) )
{
cli.createArg().setValue( request.getBuilder() );
}

if ( request.isQuiet() )
{
cli.createArg().setValue( "-q" );
}
}

protected void setThreads( InvocationRequest request, Commandline cli )
Expand Down
Expand Up @@ -316,6 +316,15 @@ public void testShouldSetErrorFlagFromRequest()
assertArgumentsPresent( cli, Collections.singleton( "-e" ) );
}

@Test
public void testShouldSetQuietFlagFromRequest()
{

tcb.setFlags( newRequest().setQuiet( true ), cli );

assertArgumentsPresent( cli, Collections.singleton( "-q" ));
}

@Test
public void testDebugOptionShouldMaskShowErrorsOption()
{
Expand Down