[GitHub] [maven] michael-o commented on a change in pull request #391: Mng 6957: Support Build Consumer while defining modules in reverse order

2020-12-20 Thread GitBox


michael-o commented on a change in pull request #391:
URL: https://github.com/apache/maven/pull/391#discussion_r546434173



##
File path: 
maven-core/src/main/java/org/apache/maven/project/ReactorModelCache.java
##
@@ -113,7 +107,48 @@ public int hashCode()
 {
 return hashCode;
 }
+}
+
+private static final class GACacheKey
+{
+private final String groupId;
+
+private final String artifactId;
+
+private final int hashCode;
 
+GACacheKey( String groupId, String artifactId )
+{
+super();

Review comment:
   This super is is redundant, isn't it?





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:
us...@infra.apache.org




[GitHub] [maven] michael-o commented on a change in pull request #391: Mng 6957: Support Build Consumer while defining modules in reverse order

2020-12-13 Thread GitBox


michael-o commented on a change in pull request #391:
URL: https://github.com/apache/maven/pull/391#discussion_r542017373



##
File path: 
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
##
@@ -1901,8 +1901,9 @@ public Source getSource( String groupId, String 
artifactId )
 }
 return sources.stream().reduce( ( a, b ) ->
 {
-throw new IllegalStateException( "No unique Source for " + 
groupId + ':' + artifactId
-+ ": " + a.getLocation() + " and " + b.getLocation() );
+throw new IllegalStateException( String.format( "No unique 
Source for %s:%s: %s and %s ", 

Review comment:
   There is a trailing WS in the string





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:
us...@infra.apache.org




[GitHub] [maven] michael-o commented on a change in pull request #391: Mng 6957: Support Build Consumer while defining modules in reverse order

2020-12-13 Thread GitBox


michael-o commented on a change in pull request #391:
URL: https://github.com/apache/maven/pull/391#discussion_r541933983



##
File path: 
maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
##
@@ -263,21 +264,14 @@ private DependencyResolutionResult resolveDependencies( 
MavenProject project, Re
 
 private List getProfileIds( List profiles )
 {
-List ids = new ArrayList<>( profiles.size() );
-
-for ( Profile profile : profiles )
-{
-ids.add( profile.getId() );
-}
-
-return ids;
+return profiles.stream().map( Profile::getId ).collect( 
Collectors.toList() );
 }
 
 private ModelBuildingRequest getModelBuildingRequest( InternalConfig 
config )
 {
 ProjectBuildingRequest configuration = config.request;
 
-ModelBuildingRequest request = new DefaultModelBuildingRequest();
+DefaultModelBuildingRequest request = new 
DefaultModelBuildingRequest();

Review comment:
   This change is necessary to pass the builder?

##
File path: 
maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
##
@@ -386,44 +381,22 @@ private ModelSource createStubModelSource( Artifact 
artifact )
 ReactorModelPool.Builder poolBuilder = new ReactorModelPool.Builder();
 final ReactorModelPool modelPool = poolBuilder.build();
 
-if ( Features.buildConsumer().isActive() )
-{
-final TransformerContext context = new TransformerContext()
-{
-@Override
-public String getUserProperty( String key )
-{
-return request.getUserProperties().getProperty( key );
-}
-
-@Override
-public Model getRawModel( Path p )
-{
-return modelPool.get( p );
-}
-
-@Override
-public Model getRawModel( String groupId, String artifactId )
-{
-return modelPool.get( groupId, artifactId, null );
-}
-};
-request.getRepositorySession().getData().set( 
TransformerContext.KEY, context );
-}
-
-InternalConfig config = new InternalConfig( request, modelPool,
-useGlobalModelCache() ? getModelCache() : new 
ReactorModelCache() );
+InternalConfig config =
+new InternalConfig( request, modelPool, useGlobalModelCache() ? 
getModelCache() : new ReactorModelCache(),
+modelBuilder.newTransformerContextBuilder() );
 
-Map projectIndex = new HashMap<>( 256 );
+Map projectIndex = new HashMap<>( 256 );
 
+// phase 1: get file Models from the reactor.
 boolean noErrors =
 build( results, interimResults, projectIndex, pomFiles, new 
LinkedHashSet<>(), true, recursive,
config, poolBuilder );
-
+
 ClassLoader oldContextClassLoader = 
Thread.currentThread().getContextClassLoader();
 
 try
 {
+// Phase 2: get effective from the reactor

Review comment:
   get effective what?

##
File path: 
maven-core/src/main/java/org/apache/maven/project/DefaultProjectBuilder.java
##
@@ -640,12 +605,12 @@ private boolean build( List 
results, List
 }
 
 private boolean build( List results, 
List projects,
-   Map projectIndex, 
List interimResults,
+   Map projectIndex, 
List interimResults,
ProjectBuildingRequest request, Map 
profilesXmls,
RepositorySystemSession session )
 {
 boolean noErrors = true;
-
+

Review comment:
   Trailing WS

##
File path: 
maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilder.java
##
@@ -1707,4 +1786,131 @@ protected void mergePluginContainer_Plugins( 
PluginContainer target, PluginConta
 // don't merge
 }
 }
+
+/**
+ * Builds up the transformer context.
+ * After the buildplan is ready, the build()-method returns the immutable 
context useful during distribution.
+ * This is an inner class, as it must be able to call readRawModel() 
+ * 
+ * @author Robert Scholte
+ * @since 3.7.0
+ */
+private class DefaultTransformerContextBuilder implements 
TransformerContextBuilder
+{
+private final DefaultTransformerContext context = new 
DefaultTransformerContext();
+
+private final Map> 
mappedSources
+= new ConcurrentHashMap<>( 64 );
+
+/**
+ * If an interface could be extracted, DefaultModelProblemCollector 
should be ModelProblemCollectorExt
+ * 
+ * @param request
+ * @param collector
+ * @return
+ */
+@Override
+