maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sisb...@apache.org
Subject svn commit: r749870 - in /maven/components/trunk: maven-mercury/src/main/java/org/apache/maven/mercury/ maven-project-builder/src/main/java/org/apache/maven/project/builder/ maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/ ma...
Date Wed, 04 Mar 2009 01:05:59 GMT
Author: sisbell
Date: Wed Mar  4 01:05:58 2009
New Revision: 749870

URL: http://svn.apache.org/viewvc?rev=749870&view=rev
Log:
Updated to use latest model-builder. Now detect most specialized model through method, not
order of domain model list.

Modified:
    maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProjectUri.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRemovalRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultDependencyScopeTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultExecutionIdTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DuplicateFiltersTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingGroupIdTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingVersionTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/ModulesNotInheritedTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NameNotInheritedTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginExecutionTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/PackagingNotInheritedTransformerRule.java
    maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/RelativePathNotInheritedTransformerRule.java
    maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModel.java
    maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModelFactory.java
    maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/EnforcerPomTest.java
    maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/PluginSpecTest.java
    maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
    maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
    maven/components/trunk/maven-project/src/test/resources-project-builder/profile-properties-interpolation/pom.xml

Modified: maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
(original)
+++ maven/components/trunk/maven-mercury/src/main/java/org/apache/maven/mercury/MavenDependencyProcessor.java
Wed Mar  4 01:05:58 2009
@@ -96,6 +96,7 @@
             }
 
             MavenDomainModel domainModel = new MavenDomainModel( superBytes );
+            domainModel.setMostSpecialized(true);
             domainModels.add( domainModel );
 
             Collection<ModelContainer> activeProfiles = domainModel.getActiveProfileContainers(
interpolatorProperties );

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomClassicDomainModel.java
Wed Mar  4 01:05:58 2009
@@ -62,6 +62,8 @@
     private List<ModelProperty> modelProperties;
     
     private int lineageCount;
+    
+    private boolean isMostSpecialized = false;
 
     private String parentGroupId = null, parentArtifactId = null, parentVersion = null, parentId
= null, parentRelativePath;
 
@@ -79,6 +81,13 @@
         }
         initializeProperties( modelProperties );
     }
+    
+    public PomClassicDomainModel( List<ModelProperty> modelProperties, boolean isMostSpecialized
)
+    {
+    	this( modelProperties );
+    	this.isMostSpecialized = isMostSpecialized;
+    }
+    
 
     /**
      * Constructor
@@ -97,6 +106,13 @@
         modelProperties = getModelProperties();
         initializeProperties( modelProperties );
     }
+    
+    public PomClassicDomainModel( InputStream inputStream, boolean isMostSpecialized )
+    	throws IOException
+	{
+    	this( inputStream );
+    	this.isMostSpecialized = isMostSpecialized;
+	}    
 
     private void initializeProperties(List<ModelProperty> modelProperties)
     {
@@ -299,7 +315,7 @@
             s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.xUri);
             s.add(ProjectUri.Profiles.Profile.Reporting.Plugins.Plugin.ReportSets.ReportSet.configuration);
             s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.Executions.Execution.configuration);
-
+            s.add(ProjectUri.Profiles.Profile.properties);
             s.add(ProjectUri.Profiles.Profile.modules);
             s.add(ProjectUri.Profiles.Profile.Dependencies.xUri);
             s.add(ProjectUri.Profiles.Profile.Build.Plugins.Plugin.configuration);
@@ -366,4 +382,14 @@
         }
     }
 
+	public boolean isMostSpecialized() 
+	{
+		return isMostSpecialized;
+	}
+
+	public void setMostSpecialized(boolean isMostSpecialized) 
+	{
+		this.isMostSpecialized = isMostSpecialized;	
+	}
+
 }

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/PomTransformer.java
Wed Mar  4 01:05:58 2009
@@ -95,6 +95,7 @@
                                                                           ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.xUri,
                                                                           ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.Exclusions.xUri,
                                                                           ProjectUri.Build.Plugins.xUri,
+                                                                          ProjectUri.properties,
                                                                           ProjectUri.Build.Plugins.Plugin.configuration,
                                                                           ProjectUri.Reporting.Plugins.xUri,
                                                                           ProjectUri.Reporting.Plugins.Plugin.configuration,
@@ -472,24 +473,21 @@
         boolean containsDistSnapRepo = false;
         boolean containsDistSite = false;
 
-        int domainModelIndex = -1;
 
         for ( DomainModel domainModel : domainModels )
         {
-            domainModelIndex++;
-
             List<ModelProperty> tmp = domainModel.getModelProperties();
 
-            List clearedProperties = new ArrayList<ModelProperty>();
+            List<ModelProperty> clearedProperties = new ArrayList<ModelProperty>();
 
             for(TransformerRule rule : transformerRules)
             {
-                rule.execute(tmp, domainModelIndex);
+                rule.execute(tmp, domainModel.isMostSpecialized());
             }
 
             for(TransformerRemovalRule rule : transformerRemovalRules)
             {
-                tmp.removeAll(rule.executeWithReturnPropertiesToRemove(tmp, domainModelIndex));
+                tmp.removeAll(rule.executeWithReturnPropertiesToRemove(tmp, domainModel.isMostSpecialized()));
             }
 
             // Project URL TransformerRule
@@ -506,7 +504,7 @@
             // Profiles TransformerRule: not inherited
             // Prerequisites TransformerRule: not inherited
             // DistributionManagent.Relocation TransformerRule: not inherited
-            if ( domainModelIndex > 0 )
+            if ( !domainModel.isMostSpecialized() )
             {
                 for ( ModelProperty mp : tmp )
                 {
@@ -581,7 +579,7 @@
         //Rules processed on collapsed pom
 
         //TransformerRule: Remove duplicate filters
-        modelProperties.removeAll(new DuplicateFiltersTransformerRule().executeWithReturnPropertiesToRemove(
modelProperties , 0));
+        modelProperties.removeAll(new DuplicateFiltersTransformerRule().executeWithReturnPropertiesToRemove(
modelProperties , false));
 
         //TransformerRule: Build plugin config overrides reporting plugin config
         return new OverideConfigTransformerRule().execute( modelProperties );

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProjectUri.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProjectUri.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProjectUri.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/ProjectUri.java
Wed Mar  4 01:05:58 2009
@@ -1375,7 +1375,7 @@
                     "http://apache.org/maven/project/profiles#collection/profile/distributionManagement/status";
             }
 
-            public static String properties = "http://apache.org/maven/project/profiles#collection/profile/properties#collection";
+            public static String properties = "http://apache.org/maven/project/profiles#collection/profile/properties";
         }
     }
 

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRemovalRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRemovalRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRemovalRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRemovalRule.java
Wed Mar  4 01:05:58 2009
@@ -7,6 +7,6 @@
 
 public interface TransformerRemovalRule {
 
-        List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+        List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException;
 }

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/TransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -7,6 +7,6 @@
 
 public interface TransformerRule
 {
-    void execute(List<ModelProperty> modelProperties, int domainIndex) throws DataSourceException;
+    void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized) throws
DataSourceException;
 
 }

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultDependencyScopeTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultDependencyScopeTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultDependencyScopeTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultDependencyScopeTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -18,10 +18,10 @@
  */
 public class DefaultDependencyScopeTransformerRule implements TransformerRule
 {
-    public void execute(List<ModelProperty> modelProperties, int domainIndex)
+    public void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized)
         throws DataSourceException
     {
-        if(domainIndex == 0)
+        if(isMostSpecialized)
         {
             ModelDataSource s = new DefaultModelDataSource( modelProperties, Arrays.asList(
new ArtifactModelContainerFactory()) );
             for(ModelContainer mc : s.queryFor(ProjectUri.Dependencies.Dependency.xUri))

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultExecutionIdTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultExecutionIdTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultExecutionIdTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DefaultExecutionIdTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -13,7 +13,7 @@
  */
 public class DefaultExecutionIdTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
         List<ModelProperty> replace = new ArrayList<ModelProperty>();

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DuplicateFiltersTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DuplicateFiltersTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DuplicateFiltersTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/DuplicateFiltersTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -10,7 +10,7 @@
 
 public class DuplicateFiltersTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
         List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingGroupIdTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingGroupIdTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingGroupIdTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingGroupIdTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -13,7 +13,7 @@
  */
 public class MissingGroupIdTransformerRule implements TransformerRule
 {
-    public void execute(List<ModelProperty> modelProperties, int domainIndex) throws
DataSourceException
+    public void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized)
throws DataSourceException
     {
         if ( getPropertyFor( ProjectUri.groupId, modelProperties ) == null )
         {

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingVersionTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingVersionTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingVersionTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/MissingVersionTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -13,7 +13,7 @@
  */
 public class MissingVersionTransformerRule implements TransformerRule
 {
-    public void execute(List<ModelProperty> modelProperties, int domainIndex) throws
DataSourceException
+    public void execute(List<ModelProperty> modelProperties, boolean isMostSpecialized)
throws DataSourceException
     {        
         if ( PomTransformer.getPropertyFor( ProjectUri.version, modelProperties ) == null
)
         {

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/ModulesNotInheritedTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/ModulesNotInheritedTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/ModulesNotInheritedTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/ModulesNotInheritedTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -14,10 +14,10 @@
  */
 public class ModulesNotInheritedTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
-        if (domainIndex > 0)
+        if (!isMostSpecialized)
         {
             ModelProperty modulesProperty = PomTransformer.getPropertyFor(ProjectUri.Modules.xUri,
modelProperties);
             if (modulesProperty != null)

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NameNotInheritedTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NameNotInheritedTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NameNotInheritedTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NameNotInheritedTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -13,11 +13,11 @@
  */
 public class NameNotInheritedTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
         List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
-        if ( domainIndex > 0 )
+        if ( !isMostSpecialized )
         {
             for ( ModelProperty mp : modelProperties )
             {

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginExecutionTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginExecutionTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginExecutionTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginExecutionTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -19,12 +19,12 @@
  */
 public class NotInheritedPluginExecutionTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
         List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
 
-        if ( domainIndex > 0 )
+        if ( !isMostSpecialized)
         {
             ModelDataSource source = new DefaultModelDataSource( modelProperties, Arrays.asList(
                     new ArtifactModelContainerFactory(), new PluginExecutionIdModelContainerFactory()
));

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/NotInheritedPluginTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -17,11 +17,11 @@
  */
 public class NotInheritedPluginTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
         List<ModelProperty> removeProperties = new ArrayList<ModelProperty>();
-        if ( domainIndex > 0 )
+        if ( !isMostSpecialized)
         {
             ModelDataSource source = new DefaultModelDataSource( modelProperties, PomTransformer.MODEL_CONTAINER_FACTORIES
);
             List<ModelContainer> containers = source.queryFor( ProjectUri.Build.Plugins.Plugin.xUri
);

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/PackagingNotInheritedTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/PackagingNotInheritedTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/PackagingNotInheritedTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/PackagingNotInheritedTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -10,11 +10,11 @@
 
 public class PackagingNotInheritedTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
         List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
-        if ( domainIndex > 0 )
+        if ( !isMostSpecialized )
         {
             for ( ModelProperty mp : modelProperties )
             {

Modified: maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/RelativePathNotInheritedTransformerRule.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/RelativePathNotInheritedTransformerRule.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/RelativePathNotInheritedTransformerRule.java
(original)
+++ maven/components/trunk/maven-project-builder/src/main/java/org/apache/maven/project/builder/rules/RelativePathNotInheritedTransformerRule.java
Wed Mar  4 01:05:58 2009
@@ -13,11 +13,11 @@
  */
 public class RelativePathNotInheritedTransformerRule implements TransformerRemovalRule
 {
-    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, int domainIndex)
+    public List<ModelProperty> executeWithReturnPropertiesToRemove(List<ModelProperty>
modelProperties, boolean isMostSpecialized)
             throws DataSourceException
     {
         List<ModelProperty> removedProperties = new ArrayList<ModelProperty>();
-        if ( domainIndex > 0 )
+        if ( !isMostSpecialized )
         {
             for ( ModelProperty mp : modelProperties )
             {

Modified: maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModel.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModel.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModel.java
(original)
+++ maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModel.java
Wed Mar  4 01:05:58 2009
@@ -13,8 +13,8 @@
 
     private List<ModelProperty> modelProperties;
 
-    public DefaultDomainModel(List<ModelProperty> modelProperties) {
-        super( modelProperties);
+    public DefaultDomainModel(List<ModelProperty> modelProperties, boolean isMostSpecialized)
{
+        super( modelProperties, isMostSpecialized);
         this.modelProperties = modelProperties;
     }
 

Modified: maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModelFactory.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModelFactory.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModelFactory.java
(original)
+++ maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/DefaultDomainModelFactory.java
Wed Mar  4 01:05:58 2009
@@ -9,6 +9,6 @@
 
 public class DefaultDomainModelFactory implements DomainModelFactory {
     public DomainModel createDomainModel(List<ModelProperty> modelProperties) throws
IOException {
-        return new DefaultDomainModel(modelProperties);
+        return new DefaultDomainModel(modelProperties, false);
     }
 }

Modified: maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/EnforcerPomTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/EnforcerPomTest.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/EnforcerPomTest.java
(original)
+++ maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/EnforcerPomTest.java
Wed Mar  4 01:05:58 2009
@@ -41,8 +41,8 @@
         mp2.add(new ModelProperty(ProjectUri.Dependencies.Dependency.artifactId, "aid"));
         mp2.add(new ModelProperty(ProjectUri.Dependencies.Dependency.classifier, "tests"));
 
-        DomainModel childModel = new DefaultDomainModel(mp2);
-        DomainModel parentModel = new DefaultDomainModel(mp);
+        DomainModel childModel = new DefaultDomainModel(mp2, true);
+        DomainModel parentModel = new DefaultDomainModel(mp, false);
 
         ModelTransformerContext ctx = new ModelTransformerContext(PomTransformer.MODEL_CONTAINER_INFOS
);
 

Modified: maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/PluginSpecTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/PluginSpecTest.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/PluginSpecTest.java
(original)
+++ maven/components/trunk/maven-project-builder/src/test/java/org/apache/maven/project/builder/PluginSpecTest.java
Wed Mar  4 01:05:58 2009
@@ -49,12 +49,12 @@
         mp.add(new ModelProperty(ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.goal,
"xpp3-reader"));
         mp.add(new ModelProperty(ProjectUri.Build.PluginManagement.Plugins.Plugin.Executions.Execution.Goals.goal,
"xpp3-writer"));
 
-        DomainModel parentModel = new DefaultDomainModel(mp);
+        DomainModel parentModel = new DefaultDomainModel(mp, false);
 
         ModelTransformerContext ctx = new ModelTransformerContext(PomTransformer.MODEL_CONTAINER_INFOS
);
 
         ModelTransformer transformer = new PomTransformer(new DefaultDomainModelFactory());
-        DomainModel domainModel = ctx.transform( Arrays.asList(parentModel, new DefaultDomainModel(mp0)),
transformer, transformer );
+        DomainModel domainModel = ctx.transform( Arrays.asList(parentModel, new DefaultDomainModel(mp0,
true)), transformer, transformer );
 
 
         List<ModelContainerFactory> factories = new ArrayList<ModelContainerFactory>(PomTransformer.MODEL_CONTAINER_FACTORIES);

Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
(original)
+++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
Wed Mar  4 01:05:58 2009
@@ -478,7 +478,7 @@
 
         PomClassicDomainModel transformedDomainModel;
         try {
-            transformedDomainModel = ( (PomClassicDomainModel) ctx.transform( Arrays.asList(
 new PomClassicDomainModel(transformed), convertToDomainModel(model)),
+            transformedDomainModel = ( (PomClassicDomainModel) ctx.transform( Arrays.asList(
 new PomClassicDomainModel(transformed, false), convertToDomainModel(model, true)),
                                                                                         
           transformer,
                                                                                         
           transformer,
                                                                                         
           Collections.EMPTY_LIST,
@@ -619,8 +619,10 @@
 
         PomClassicDomainModel domainModel = new PomClassicDomainModel( pom );
         domainModel.setProjectDirectory( pom.getParentFile() );
+        domainModel.setMostSpecialized(true);
+        
         List<DomainModel> domainModels = new ArrayList<DomainModel>();
-        domainModels.add( domainModel );
+
 
         //Process Profile on most specialized child model
         ProfileContext profileContext = new ProfileContext(new DefaultModelDataSource(domainModel.getModelProperties(),
@@ -640,9 +642,10 @@
                             mp.getResolvedValue()));
                 }
             }
-            domainModels.add(new PomClassicDomainModel(transformed));
+            domainModels.add(new PomClassicDomainModel(transformed, false));
         }
-
+        domainModels.add( domainModel );
+        
         File parentFile = null;
         int lineageCount = 0;
         if ( domainModel.getParentId() != null )
@@ -672,7 +675,7 @@
             domainModels.addAll( mavenParents );
         }
 
-        domainModels.add( convertToDomainModel( getSuperModel() ) );
+        domainModels.add( convertToDomainModel( getSuperModel() , false ));
 
         PomTransformer transformer = new PomTransformer( new PomClassicDomainModelFactory()
);
 
@@ -691,7 +694,7 @@
         return transformedDomainModel;
     }
 
-    private PomClassicDomainModel convertToDomainModel(Model model) throws IOException
+    private PomClassicDomainModel convertToDomainModel(Model model, boolean isMostSpecialized)
throws IOException
     {
         if ( model == null )
         {
@@ -712,7 +715,7 @@
                 out.close();
             }
         }
-        return new PomClassicDomainModel(new ByteArrayInputStream(baos.toByteArray()));
+        return new PomClassicDomainModel(new ByteArrayInputStream(baos.toByteArray()), isMostSpecialized);
     }
 
     protected MavenProject buildFromLocalPath(File pom,

Modified: maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
(original)
+++ maven/components/trunk/maven-project/src/test/java/org/apache/maven/project/PomConstructionTest.java
Wed Mar  4 01:05:58 2009
@@ -119,14 +119,14 @@
     }
     
     /*MNG-3900*/
-    /*
     public void testProfilePropertiesInterpolation()
     	throws Exception 
     {
-    	PomTestWrapper pom = buildPomFromMavenProject( "profile-properties-interpolation", "a"
);
+    	PomTestWrapper pom = buildPomFromMavenProject( "profile-properties-interpolation", "interpolation-profile"
);
     	assertEquals("PASSED", pom.getValue("properties[1]/test"));
+    	assertEquals("PASSED", pom.getValue("properties[1]/property"));
     }
-	*/
+
 
     // Some better conventions for the test poms needs to be created and each of these tests
     // that represent a verification of a specification item needs to be a couple lines at
most.

Modified: maven/components/trunk/maven-project/src/test/resources-project-builder/profile-properties-interpolation/pom.xml
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/test/resources-project-builder/profile-properties-interpolation/pom.xml?rev=749870&r1=749869&r2=749870&view=diff
==============================================================================
--- maven/components/trunk/maven-project/src/test/resources-project-builder/profile-properties-interpolation/pom.xml
(original)
+++ maven/components/trunk/maven-project/src/test/resources-project-builder/profile-properties-interpolation/pom.xml
Wed Mar  4 01:05:58 2009
@@ -48,6 +48,7 @@
 			<!-- This profile defines the properties to use for interpolation. -->
 			<properties>
 				<test>PASSED</test>
+				<test1>PASSED</test1>
 			</properties>
 		</profile>
 	</profiles>



Mime
View raw message