[MNG-6505] inherit child.x.y.inherit.append.path values

This commit is contained in:
Hervé Boutemy 2018-11-04 13:29:56 +01:00
parent db462ae0b3
commit f97316ceec
2 changed files with 87 additions and 3 deletions

View File

@ -20,7 +20,8 @@ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
child.project.url.inherit.append.path="false">
<modelVersion>4.0.0</modelVersion>
<parent>
@ -37,13 +38,15 @@ under the License.
<!-- 5 inherited urls without anything added to parent -->
<url>http://www.apache.org/path/to/parent/</url>
<scm>
<scm child.scm.connection.inherit.append.path="false"
child.scm.developerConnection.inherit.append.path="false"
child.scm.url.inherit.append.path="false">
<connection>scm:my-scm:http://domain.org/base</connection>
<developerConnection>scm:my-scm:https://domain.org/base/</developerConnection>
<url>https://domain.org/base</url>
</scm>
<distributionManagement>
<site>
<site child.site.url.inherit.append.path="false">
<url>scp://scp.domain.org/base/</url>
</site>
</distributionManagement>

View File

@ -125,6 +125,7 @@ public class ModelMerger
{
mergeModelBase( target, source, sourceDominant, context );
mergeModel_ChildProjectUrlInheritAppendPath( target, source, sourceDominant, context );
mergeModel_ModelVersion( target, source, sourceDominant, context );
mergeModel_Parent( target, source, sourceDominant, context );
mergeModel_GroupId( target, source, sourceDominant, context );
@ -206,6 +207,21 @@ public class ModelMerger
}
}
protected void mergeModel_ChildProjectUrlInheritAppendPath( Model target, Model source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getChildProjectUrlInheritAppendPath();
if ( src != null )
{
if ( sourceDominant || target.getChildProjectUrlInheritAppendPath() == null )
{
target.setChildProjectUrlInheritAppendPath( src );
target.setLocation( "child.project.url.inherit.append.path",
source.getLocation( "child.project.url.inherit.append.path" ) );
}
}
}
protected void mergeModel_Version( Model target, Model source, boolean sourceDominant,
Map<Object, Object> context )
{
@ -876,11 +892,27 @@ public class ModelMerger
protected void mergeSite( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
{
mergeSite_ChildSiteUrlInheritAppendPath( target, source, sourceDominant, context );
mergeSite_Id( target, source, sourceDominant, context );
mergeSite_Name( target, source, sourceDominant, context );
mergeSite_Url( target, source, sourceDominant, context );
}
protected void mergeSite_ChildSiteUrlInheritAppendPath( Site target, Site source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getChildSiteUrlInheritAppendPath();
if ( src != null )
{
if ( sourceDominant || target.getChildSiteUrlInheritAppendPath() == null )
{
target.setChildSiteUrlInheritAppendPath( src );
target.setLocation( "child.site.url.inherit.append.path",
source.getLocation( "child.site.url.inherit.append.path" ) );
}
}
}
protected void mergeSite_Id( Site target, Site source, boolean sourceDominant, Map<Object, Object> context )
{
String src = source.getId();
@ -1925,12 +1957,61 @@ public class ModelMerger
protected void mergeScm( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
{
mergeScm_ChildScmConnectionInheritAppendPath( target, source, sourceDominant, context );
mergeScm_ChildScmDeveloperConnectionInheritAppendPath( target, source, sourceDominant, context );
mergeScm_ChildScmUrlInheritAppendPath( target, source, sourceDominant, context );
mergeScm_Url( target, source, sourceDominant, context );
mergeScm_Connection( target, source, sourceDominant, context );
mergeScm_DeveloperConnection( target, source, sourceDominant, context );
mergeScm_Tag( target, source, sourceDominant, context );
}
protected void mergeScm_ChildScmConnectionInheritAppendPath( Scm target, Scm source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getChildScmConnectionInheritAppendPath();
if ( src != null )
{
if ( sourceDominant || target.getChildScmConnectionInheritAppendPath() == null )
{
target.setChildScmConnectionInheritAppendPath( src );
target.setLocation( "child.scm.connection.inherit.append.path",
source.getLocation( "child.scm.connection.inherit.append.path" ) );
}
}
}
protected void mergeScm_ChildScmDeveloperConnectionInheritAppendPath( Scm target, Scm source,
boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getChildScmDeveloperConnectionInheritAppendPath();
if ( src != null )
{
if ( sourceDominant || target.getChildScmDeveloperConnectionInheritAppendPath() == null )
{
target.setChildScmDeveloperConnectionInheritAppendPath( src );
target.setLocation( "child.scm.developerConnection.inherit.append.path",
source.getLocation( "child.scm.developerConnection.inherit.append.path" ) );
}
}
}
protected void mergeScm_ChildScmUrlInheritAppendPath( Scm target, Scm source, boolean sourceDominant,
Map<Object, Object> context )
{
String src = source.getChildScmUrlInheritAppendPath();
if ( src != null )
{
if ( sourceDominant || target.getChildScmUrlInheritAppendPath() == null )
{
target.setChildScmUrlInheritAppendPath( src );
target.setLocation( "child.scm.url.inherit.append.path",
source.getLocation( "child.scm.url.inherit.append.path" ) );
}
}
}
protected void mergeScm_Url( Scm target, Scm source, boolean sourceDominant, Map<Object, Object> context )
{
String src = source.getUrl();