You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2020/04/15 14:50:02 UTC

[GitHub] [maven] MartinKanters opened a new pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from

MartinKanters opened a new pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from
URL: https://github.com/apache/maven/pull/338
 
 
   Following this checklist to help us incorporate your 
   contribution quickly and easily:
   
    - [x] Make sure there is a [JIRA issue](https://issues.apache.org/jira/browse/MNG-6863) filed 
          for the change (usually before you start working on it).  Trivial changes like typos do not 
          require a JIRA issue.  Your pull request should address just this issue, without 
          pulling in other changes.
    - [x] Each commit in the pull request should have a meaningful subject line and body.
    - [x] Format the pull request title like `[MNG-XXX] - Fixes bug in ApproximateQuantiles`,
          where you replace `MNG-XXX` with the appropriate JIRA issue. Best practice
          is to use the JIRA issue title in the pull request title and in the first line of the 
          commit message.
    - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
    - [x] Run `mvn clean verify` to make sure basic checks pass. A more thorough check will 
          be performed on your pull request automatically.
    - [ ] You have run the [Core IT][core-its] successfully.
   
   If your pull request is about ~20 lines of code you don't need to sign an
   [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
   please ask on the developers list.
   
   To make clear that you license your contribution under 
   the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   you have to acknowledge this by using the following check-box.
   
    - [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
   
    - [x] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   [core-its]: https://maven.apache.org/core-its/core-it-suite/
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] MartinKanters commented on issue #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from

Posted by GitBox <gi...@apache.org>.
MartinKanters commented on issue #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from
URL: https://github.com/apache/maven/pull/338#issuecomment-615369779
 
 
   > I really like these tests: easy to read and to verify all kinds of combinations. Well done!
   
   Thanks! I was doubting this setup since it seems a bit unusual in the maven codebase (afaik), but I'm happy that it helps with the readability! 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rfscholte commented on issue #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from

Posted by GitBox <gi...@apache.org>.
rfscholte commented on issue #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from
URL: https://github.com/apache/maven/pull/338#issuecomment-615166623
 
 
   I really like these tests: easy to read and to verify all kinds of combinations. Well done!

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rfscholte commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from

Posted by GitBox <gi...@apache.org>.
rfscholte commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from
URL: https://github.com/apache/maven/pull/338#discussion_r410129845
 
 

 ##########
 File path: maven-core/src/test/java/org/apache/maven/graph/DefaultGraphBuilderTest.java
 ##########
 @@ -0,0 +1,290 @@
+package org.apache.maven.graph;
+
+/*
+ * 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.
+ */
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.building.Result;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.codehaus.plexus.util.StringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+import static junit.framework.TestCase.assertEquals;
+import static org.apache.maven.execution.MavenExecutionRequest.*;
+import static org.apache.maven.execution.MavenExecutionRequest.REACTOR_MAKE_UPSTREAM;
+import static org.apache.maven.graph.DefaultGraphBuilderTest.ScenarioBuilder.scenario;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith( Parameterized.class )
+public class DefaultGraphBuilderTest
+{
+    private static final String INDEPENDENT_MODULE = "module-independent";
+    private static final String MODULE_A = "module-a";
+    private static final String MODULE_B = "module-b"; // depends on module-a
+    private static final String MODULE_C = "module-c"; // depends on module-b
+
+    @InjectMocks
+    private DefaultGraphBuilder graphBuilder;
+
+    @Mock
+    private ProjectBuilder projectBuilder;
+
+    @Mock
+    private MavenSession session;
+
+    @Mock
+    private MavenExecutionRequest mavenExecutionRequest;
+
+    private Map<String, MavenProject> artifactIdProjectMap;
+
+    // Parameters for the test
+    private final String parameterDescription;
+    private final List<String> parameterSelectedProjects;
+    private final List<String> parameterExcludedProjects;
+    private final String parameterResumeFrom;
+    private final String parameterMakeBehavior;
+    private final List<String> parameterExpectedResult;
+
+    @Parameters(name = "{index}. {0}")
+    public static Collection<Object[]> parameters()
+    {
+        return asList(
+                scenario( "Full reactor" )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .expectResult( singletonList( MODULE_B ) ),
+                scenario( "Excluded project" )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_C ) ),
+                scenario( "Resuming from project" )
+                        .resumeFrom( MODULE_B )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependencies" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependents" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_DOWNSTREAM )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Resuming from project with also make dependencies" )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .resumeFrom( MODULE_C )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with resume from an also make dependency (MNG-4960 IT#1)" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .resumeFrom( MODULE_B )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with resume from an also make dependent (MNG-4960 IT#2)" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .resumeFrom( MODULE_C )
+                        .makeBehavior( REACTOR_MAKE_DOWNSTREAM )
+                        .expectResult( singletonList( MODULE_C ) ),
+                scenario( "Excluding an also make dependency from selectedProject does take its transitive dependency" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_C ) ),
+                scenario( "Excluding an also make dependency from resumeFrom does take its transitive dependency" )
+                        .resumeFrom( MODULE_C )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_C ) ),
+                scenario( "Resume from exclude project downstream" )
+                        .resumeFrom( MODULE_A )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( asList( MODULE_A, MODULE_C ) ),
+                scenario( "Exclude the project we are resuming from (as proposed in MNG-6676)" )
+                        .resumeFrom( MODULE_B )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( singletonList( MODULE_C ) )
 
 Review comment:
   Ah, this is MNG-6676. Nice 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] rfscholte commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from

Posted by GitBox <gi...@apache.org>.
rfscholte commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from
URL: https://github.com/apache/maven/pull/338#discussion_r410128335
 
 

 ##########
 File path: maven-core/src/test/java/org/apache/maven/graph/DefaultGraphBuilderTest.java
 ##########
 @@ -0,0 +1,290 @@
+package org.apache.maven.graph;
+
+/*
+ * 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.
+ */
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.building.Result;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.codehaus.plexus.util.StringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+import static junit.framework.TestCase.assertEquals;
+import static org.apache.maven.execution.MavenExecutionRequest.*;
+import static org.apache.maven.execution.MavenExecutionRequest.REACTOR_MAKE_UPSTREAM;
+import static org.apache.maven.graph.DefaultGraphBuilderTest.ScenarioBuilder.scenario;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith( Parameterized.class )
+public class DefaultGraphBuilderTest
+{
+    private static final String INDEPENDENT_MODULE = "module-independent";
+    private static final String MODULE_A = "module-a";
+    private static final String MODULE_B = "module-b"; // depends on module-a
+    private static final String MODULE_C = "module-c"; // depends on module-b
+
+    @InjectMocks
+    private DefaultGraphBuilder graphBuilder;
+
+    @Mock
+    private ProjectBuilder projectBuilder;
+
+    @Mock
+    private MavenSession session;
+
+    @Mock
+    private MavenExecutionRequest mavenExecutionRequest;
+
+    private Map<String, MavenProject> artifactIdProjectMap;
+
+    // Parameters for the test
+    private final String parameterDescription;
+    private final List<String> parameterSelectedProjects;
+    private final List<String> parameterExcludedProjects;
+    private final String parameterResumeFrom;
+    private final String parameterMakeBehavior;
+    private final List<String> parameterExpectedResult;
+
+    @Parameters(name = "{index}. {0}")
+    public static Collection<Object[]> parameters()
+    {
+        return asList(
+                scenario( "Full reactor" )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .expectResult( singletonList( MODULE_B ) ),
+                scenario( "Excluded project" )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_C ) ),
+                scenario( "Resuming from project" )
+                        .resumeFrom( MODULE_B )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependencies" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependents" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_DOWNSTREAM )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Resuming from project with also make dependencies" )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .resumeFrom( MODULE_C )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with resume from an also make dependency (MNG-4960 IT#1)" )
+                        .selectedProjects( singletonList( MODULE_C ) )
 
 Review comment:
   This selectedProjects is awkward: it says `resume from B`, which already implies running C.
   In general I think that `resume-from` should ignore the project-list (until https://issues.apache.org/jira/browse/MNG-6676 is added, which means you can exclude modules from the result-from)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] MartinKanters commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from

Posted by GitBox <gi...@apache.org>.
MartinKanters commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from
URL: https://github.com/apache/maven/pull/338#discussion_r410368320
 
 

 ##########
 File path: maven-core/src/test/java/org/apache/maven/graph/DefaultGraphBuilderTest.java
 ##########
 @@ -0,0 +1,290 @@
+package org.apache.maven.graph;
+
+/*
+ * 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.
+ */
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.building.Result;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.codehaus.plexus.util.StringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+import static junit.framework.TestCase.assertEquals;
+import static org.apache.maven.execution.MavenExecutionRequest.*;
+import static org.apache.maven.execution.MavenExecutionRequest.REACTOR_MAKE_UPSTREAM;
+import static org.apache.maven.graph.DefaultGraphBuilderTest.ScenarioBuilder.scenario;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith( Parameterized.class )
+public class DefaultGraphBuilderTest
+{
+    private static final String INDEPENDENT_MODULE = "module-independent";
+    private static final String MODULE_A = "module-a";
+    private static final String MODULE_B = "module-b"; // depends on module-a
+    private static final String MODULE_C = "module-c"; // depends on module-b
+
+    @InjectMocks
+    private DefaultGraphBuilder graphBuilder;
+
+    @Mock
+    private ProjectBuilder projectBuilder;
+
+    @Mock
+    private MavenSession session;
+
+    @Mock
+    private MavenExecutionRequest mavenExecutionRequest;
+
+    private Map<String, MavenProject> artifactIdProjectMap;
+
+    // Parameters for the test
+    private final String parameterDescription;
+    private final List<String> parameterSelectedProjects;
+    private final List<String> parameterExcludedProjects;
+    private final String parameterResumeFrom;
+    private final String parameterMakeBehavior;
+    private final List<String> parameterExpectedResult;
+
+    @Parameters(name = "{index}. {0}")
+    public static Collection<Object[]> parameters()
+    {
+        return asList(
+                scenario( "Full reactor" )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .expectResult( singletonList( MODULE_B ) ),
+                scenario( "Excluded project" )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_C ) ),
+                scenario( "Resuming from project" )
+                        .resumeFrom( MODULE_B )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependencies" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependents" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_DOWNSTREAM )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Resuming from project with also make dependencies" )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .resumeFrom( MODULE_C )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with resume from an also make dependency (MNG-4960 IT#1)" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .resumeFrom( MODULE_B )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with resume from an also make dependent (MNG-4960 IT#2)" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .resumeFrom( MODULE_C )
+                        .makeBehavior( REACTOR_MAKE_DOWNSTREAM )
+                        .expectResult( singletonList( MODULE_C ) ),
+                scenario( "Excluding an also make dependency from selectedProject does take its transitive dependency" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_C ) ),
+                scenario( "Excluding an also make dependency from resumeFrom does take its transitive dependency" )
+                        .resumeFrom( MODULE_C )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_C ) ),
+                scenario( "Resume from exclude project downstream" )
+                        .resumeFrom( MODULE_A )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( asList( MODULE_A, MODULE_C ) ),
+                scenario( "Exclude the project we are resuming from (as proposed in MNG-6676)" )
+                        .resumeFrom( MODULE_B )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( singletonList( MODULE_C ) )
 
 Review comment:
   I was wondering whether you would like MNG-6676, but I've got my answer now, I guess :) 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [maven] MartinKanters commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from

Posted by GitBox <gi...@apache.org>.
MartinKanters commented on a change in pull request #338: [MNG-6863] - Fixing that --also-make is being ignored when calling --resume-from
URL: https://github.com/apache/maven/pull/338#discussion_r410367520
 
 

 ##########
 File path: maven-core/src/test/java/org/apache/maven/graph/DefaultGraphBuilderTest.java
 ##########
 @@ -0,0 +1,290 @@
+package org.apache.maven.graph;
+
+/*
+ * 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.
+ */
+
+import com.google.common.collect.ImmutableMap;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ProjectDependencyGraph;
+import org.apache.maven.model.Dependency;
+import org.apache.maven.model.building.Result;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuilder;
+import org.apache.maven.project.ProjectBuildingRequest;
+import org.apache.maven.project.ProjectBuildingResult;
+import org.codehaus.plexus.util.StringUtils;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+import static junit.framework.TestCase.assertEquals;
+import static org.apache.maven.execution.MavenExecutionRequest.*;
+import static org.apache.maven.execution.MavenExecutionRequest.REACTOR_MAKE_UPSTREAM;
+import static org.apache.maven.graph.DefaultGraphBuilderTest.ScenarioBuilder.scenario;
+import static org.mockito.ArgumentMatchers.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith( Parameterized.class )
+public class DefaultGraphBuilderTest
+{
+    private static final String INDEPENDENT_MODULE = "module-independent";
+    private static final String MODULE_A = "module-a";
+    private static final String MODULE_B = "module-b"; // depends on module-a
+    private static final String MODULE_C = "module-c"; // depends on module-b
+
+    @InjectMocks
+    private DefaultGraphBuilder graphBuilder;
+
+    @Mock
+    private ProjectBuilder projectBuilder;
+
+    @Mock
+    private MavenSession session;
+
+    @Mock
+    private MavenExecutionRequest mavenExecutionRequest;
+
+    private Map<String, MavenProject> artifactIdProjectMap;
+
+    // Parameters for the test
+    private final String parameterDescription;
+    private final List<String> parameterSelectedProjects;
+    private final List<String> parameterExcludedProjects;
+    private final String parameterResumeFrom;
+    private final String parameterMakeBehavior;
+    private final List<String> parameterExpectedResult;
+
+    @Parameters(name = "{index}. {0}")
+    public static Collection<Object[]> parameters()
+    {
+        return asList(
+                scenario( "Full reactor" )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .expectResult( singletonList( MODULE_B ) ),
+                scenario( "Excluded project" )
+                        .excludedProjects( singletonList( MODULE_B ) )
+                        .expectResult( asList( INDEPENDENT_MODULE, MODULE_A, MODULE_C ) ),
+                scenario( "Resuming from project" )
+                        .resumeFrom( MODULE_B )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependencies" )
+                        .selectedProjects( singletonList( MODULE_C ) )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with also make dependents" )
+                        .selectedProjects( singletonList( MODULE_B ) )
+                        .makeBehavior( REACTOR_MAKE_DOWNSTREAM )
+                        .expectResult( asList( MODULE_B, MODULE_C ) ),
+                scenario( "Resuming from project with also make dependencies" )
+                        .makeBehavior( REACTOR_MAKE_UPSTREAM )
+                        .resumeFrom( MODULE_C )
+                        .expectResult( asList( MODULE_A, MODULE_B, MODULE_C ) ),
+                scenario( "Selected project with resume from an also make dependency (MNG-4960 IT#1)" )
+                        .selectedProjects( singletonList( MODULE_C ) )
 
 Review comment:
   Yes, I agree it's a weird scenario, but we have an integration test which verifies exactly this. (MNG-4960)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services