You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/04/18 02:54:21 UTC

[maven-surefire] branch pull/285 updated (599f3f7 -> 4754ae3)

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a change to branch pull/285
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.


 discard 599f3f7  finished the impl
     new 4754ae3  finished the impl

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (599f3f7)
            \
             N -- N -- N   refs/heads/pull/285 (4754ae3)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java  | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)


[maven-surefire] 01/01: finished the impl

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch pull/285
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 4754ae315202f8a92ef91f5eb399b266225be500
Author: tibordigana <ti...@apache.org>
AuthorDate: Sat Apr 18 04:20:33 2020 +0200

    finished the impl
---
 .../plugin/surefire/AbstractSurefireMojo.java      | 41 +++++++++++++---------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index ec79ed1..ea7b114 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -85,7 +85,6 @@ import org.apache.maven.surefire.testset.TestListResolver;
 import org.apache.maven.surefire.testset.TestRequest;
 import org.apache.maven.surefire.testset.TestSetFailedException;
 import org.apache.maven.surefire.util.DefaultScanResult;
-import org.apache.maven.surefire.util.ReflectionUtils;
 import org.apache.maven.surefire.util.RunOrder;
 import org.apache.maven.toolchain.DefaultToolchain;
 import org.apache.maven.toolchain.Toolchain;
@@ -143,6 +142,8 @@ import static org.apache.maven.surefire.booter.SystemUtils.toJdkHomeFromJvmExec;
 import static org.apache.maven.surefire.booter.SystemUtils.toJdkVersionFromReleaseFile;
 import static org.apache.maven.surefire.suite.RunResult.failure;
 import static org.apache.maven.surefire.suite.RunResult.noTestsRun;
+import static org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray;
+import static org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod;
 
 /**
  * Abstract base class for running tests using Surefire.
@@ -947,38 +948,34 @@ public abstract class AbstractSurefireMojo
         return consoleLogger;
     }
 
-
     //TODO remove the part with ToolchainManager lookup once we depend on
     //3.0.9 (have it as prerequisite). Define as regular component field then.
-    //This code duplicates AbstractCompilerMojo in maven-compiler-plugin
-    protected final Toolchain getToolchain() throws MojoFailureException
+    private Toolchain getToolchain() throws MojoFailureException
     {
         Toolchain tc = null;
 
-        if ( jdkToolchain != null )
+        if ( getJdkToolchain() != null )
         {
-            Method getToolchainsMethod = ReflectionUtils.tryGetMethod(
-                getToolchainManager().getClass(), "getToolchains" );
+            Method getToolchainsMethod = tryGetMethod( ToolchainManager.class, "getToolchains",
+                MavenSession.class, String.class, Map.class );
             if ( getToolchainsMethod != null )
             {
-                List<Toolchain> tcs =
-                    (List<Toolchain>) ReflectionUtils.invokeMethodWithArray( getToolchainManager(),
-                        getToolchainsMethod, getSession(), "jdk" );
-                if ( tcs != null && !tcs.isEmpty() )
-                {
-                    tc = tcs.get( 0 );
-                }
-                else
+                //noinspection unchecked
+                List<Toolchain> tcs = (List<Toolchain>) invokeMethodWithArray( getToolchainManager(),
+                    getToolchainsMethod, getSession(), "jdk", getJdkToolchain() );
+                if ( tcs.isEmpty() )
                 {
                     throw new MojoFailureException(
-                        "Requested toolchain specification did not match any configured toolchain: " + jdkToolchain );
+                        "Requested toolchain specification did not match any configured toolchain: "
+                            + getJdkToolchain() );
                 }
+                tc = tcs.get( 0 );
             }
         }
 
         if ( tc == null )
         {
-            tc = toolchainManager.getToolchainFromBuildContext( "jdk", getSession() );
+            tc = getToolchainManager().getToolchainFromBuildContext( "jdk", getSession() );
         }
 
         return tc;
@@ -3940,6 +3937,16 @@ public abstract class AbstractSurefireMojo
         SurefireHelper.logDebugOrCliShowErrors( s, getConsoleLogger(), cli );
     }
 
+    public Map<String, String> getJdkToolchain()
+    {
+        return jdkToolchain;
+    }
+
+    public void setJdkToolchain( Map<String, String> jdkToolchain )
+    {
+        this.jdkToolchain = jdkToolchain;
+    }
+
     public String getTempDir()
     {
         return tempDir;