-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extension remains quiet when -q flag is passed
Signed-off-by: Marc Nuri <[email protected]>
- Loading branch information
Showing
10 changed files
with
88 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def buildLog = new File(basedir, 'build.log').text | ||
assert buildLog.contains('Extracting Gradle 7.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def buildLog = new File(basedir, 'build.log').text | ||
assert buildLog.contains('Extracting Gradle 8.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
invoker.goals.1=verify | ||
invoker.quiet=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" | ||
xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.marcnuri.plugins.it</groupId> | ||
<artifactId>no-action</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<name>Maven Integration Test :: Gradle API :: No Action</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.codehaus.groovy</groupId> | ||
<artifactId>groovy-all</artifactId> | ||
<version>${version.groovy}</version> | ||
<type>pom</type> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.gradle</groupId> | ||
<artifactId>gradle-all</artifactId> | ||
<version>${version.gradle.8}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.marcnuri.plugins</groupId> | ||
<artifactId>gradle-api-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
def buildLog = new File(basedir, 'build.log').text | ||
assert !buildLog.contains('Extracting Gradle') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/com/marcnuri/plugins/gradle/api/GradleApiLog.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package com.marcnuri.plugins.gradle.api; | ||
|
||
import org.apache.maven.execution.MavenExecutionRequest; | ||
import org.apache.maven.plugin.logging.Log; | ||
import org.apache.maven.plugin.logging.SystemStreamLog; | ||
|
||
import java.util.function.Consumer; | ||
|
||
public final class GradleApiLog { | ||
|
||
private final int loggingLevel; | ||
private final Log delegate; | ||
|
||
GradleApiLog(int loggingLevel) { | ||
this.loggingLevel = loggingLevel; | ||
delegate = new SystemStreamLog(); | ||
} | ||
|
||
public void debug(CharSequence content) { | ||
log(MavenExecutionRequest.LOGGING_LEVEL_DEBUG, delegate::debug, content); | ||
} | ||
|
||
public void info(CharSequence content) { | ||
log(MavenExecutionRequest.LOGGING_LEVEL_INFO, delegate::info, content); | ||
} | ||
|
||
public void warn(CharSequence content) { | ||
log(MavenExecutionRequest.LOGGING_LEVEL_WARN, delegate::warn, content); | ||
} | ||
|
||
public void error(CharSequence content) { | ||
log(MavenExecutionRequest.LOGGING_LEVEL_ERROR, delegate::error, content); | ||
} | ||
|
||
private void log(int level, Consumer<CharSequence> logFunc, CharSequence content) { | ||
if (loggingLevel <= level) { | ||
logFunc.accept(content); | ||
} | ||
} | ||
} |