Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#632 Fixed lower and upper bounds to keep milestones and rcs in the right majors. #672

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/it/it-dependency-updates-report-001/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ try
System.out.println( "Result = \"" + result +"\"" );
return false;
}
if ( result.indexOf( "1.1.0-2 Next Version" ) < 0)
if ( result.indexOf( "1.1.0-2 Latest Subincremental" ) < 0)
{
System.out.println( "Did not identify next version" );
System.out.println( "Result = \"" + result +"\"" );
Expand Down
2 changes: 1 addition & 1 deletion src/it/it-plugin-updates-report-001/verify.bsh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ try
return false;
}
if ( result.indexOf( "Group Id localhost Artifact Id dummy-api Current Version 1.1 Classifier Type jar Newer "
+ "versions 1.1.0-2 Next Version 1.1.1 Next Incremental 1.1.1-2 1.1.2 1.1.3 Latest Incremental 1.2 Next "
+ "versions 1.1.0-2 Latest Subincremental 1.1.1 Next Incremental 1.1.1-2 1.1.2 1.1.3 Latest Incremental 1.2 Next "
+ "Minor 1.2.1 1.2.2 1.3 Latest Minor 2.0 Next Major 2.1 3.0 Latest Major" ) < 0)
{
System.out.println( "Did not identify dependency next versions" );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.apache.maven.doxia.sink.impl.SinkEventAttributeSet;
import org.apache.maven.model.Dependency;
import org.apache.maven.reporting.AbstractMavenReportRenderer;
import org.codehaus.mojo.versions.api.AbstractVersionDetails;
import org.codehaus.mojo.versions.api.ArtifactAssociation;
import org.codehaus.mojo.versions.api.ArtifactVersions;
import org.codehaus.mojo.versions.api.PropertyVersions;
Expand Down Expand Up @@ -432,57 +433,18 @@ else if ( details.getOldestUpdate( of( MAJOR ) ) != null )
{
sink.lineBreak();
}
boolean bold = equals( versions[i], details.getOldestUpdate( of( SUBINCREMENTAL ) ) )
|| equals( versions[i], details.getNewestUpdate( of( SUBINCREMENTAL ) ) )
|| equals( versions[i], details.getOldestUpdate( of( INCREMENTAL ) ) )
|| equals( versions[i], details.getNewestUpdate( of( INCREMENTAL ) ) )
|| equals( versions[i], details.getOldestUpdate( of( MINOR ) ) )
|| equals( versions[i], details.getNewestUpdate( of( MINOR ) ) )
|| equals( versions[i], details.getOldestUpdate( of( MAJOR ) ) )
|| equals( versions[i], details.getNewestUpdate( of( MAJOR ) ) );
if ( bold )
String label = getLabel( versions[i], details );
if ( label != null )
{
safeBold();
}
sink.text( versions[i].toString() );
if ( bold )
if ( label != null )
{
safeBold_();
sink.nonBreakingSpace();
safeItalic();
if ( equals( versions[i], details.getOldestUpdate( of( SUBINCREMENTAL ) ) ) )
{
sink.text( getText( "report.nextVersion" ) );
}
else if ( equals( versions[i], details.getNewestUpdate( of( SUBINCREMENTAL ) ) ) )
{
sink.text( getText( "report.latestSubIncremental" ) );
}
else if ( equals( versions[i], details.getOldestUpdate( of( INCREMENTAL ) ) ) )
{
sink.text( getText( "report.nextIncremental" ) );
}
else if ( equals( versions[i], details.getNewestUpdate( of( INCREMENTAL ) ) ) )
{
sink.text( getText( "report.latestIncremental" ) );
}
else if ( equals( versions[i], details.getOldestUpdate( of( MINOR ) ) ) )
{
sink.text( getText( "report.nextMinor" ) );
}
else if ( equals( versions[i], details.getNewestUpdate( of( MINOR ) ) ) )
{
sink.text( getText( "report.latestMinor" ) );
}
else if ( equals( versions[i], details.getOldestUpdate( of( MAJOR ) ) ) )
{
sink.text( getText( "report.nextMajor" ) );
}
else if ( equals( versions[i], details.getNewestUpdate( of( MAJOR ) ) ) )
{
sink.text( getText( "report.latestMajor" ) );
}

sink.text( label );
safeItalic_();
}
}
Expand Down Expand Up @@ -707,65 +669,26 @@ else if ( versions.getOldestUpdate( of( MAJOR ) ) != null )
sink.lineBreak();
}
boolean allowed = ( rangeVersions.contains( artifactVersions[i].toString() ) );
boolean bold = equals( artifactVersions[i], versions.getOldestUpdate( of( SUBINCREMENTAL ) ) )
|| equals( artifactVersions[i], versions.getNewestUpdate( of( SUBINCREMENTAL ) ) )
|| equals( artifactVersions[i], versions.getOldestUpdate( of( INCREMENTAL ) ) )
|| equals( artifactVersions[i], versions.getNewestUpdate( of( INCREMENTAL ) ) )
|| equals( artifactVersions[i], versions.getOldestUpdate( of( MINOR ) ) )
|| equals( artifactVersions[i], versions.getNewestUpdate( of( MINOR ) ) )
|| equals( artifactVersions[i], versions.getOldestUpdate( of( MAJOR ) ) )
|| equals( artifactVersions[i], versions.getNewestUpdate( of( MAJOR ) ) );
String label = getLabel( artifactVersions[i], versions );
if ( !allowed )
{
sink.text( "* " );
someNotAllowed = true;
}
if ( allowed && bold )
if ( allowed && label != null )
{
safeBold();
}
sink.text( artifactVersions[i].toString() );
if ( bold )
if ( label != null )
{
if ( allowed )
{
safeBold_();
}
sink.nonBreakingSpace();
safeItalic();
if ( equals( artifactVersions[i], versions.getOldestUpdate( of( SUBINCREMENTAL ) ) ) )
{
sink.text( getText( "report.nextVersion" ) );
}
else if ( equals( artifactVersions[i], versions.getNewestUpdate( of( SUBINCREMENTAL ) ) ) )
{
sink.text( getText( "report.latestSubIncremental" ) );
}
else if ( equals( artifactVersions[i], versions.getOldestUpdate( of( INCREMENTAL ) ) ) )
{
sink.text( getText( "report.nextIncremental" ) );
}
else if ( equals( artifactVersions[i], versions.getNewestUpdate( of( INCREMENTAL ) ) ) )
{
sink.text( getText( "report.latestIncremental" ) );
}
else if ( equals( artifactVersions[i], versions.getOldestUpdate( of( MINOR ) ) ) )
{
sink.text( getText( "report.nextMinor" ) );
}
else if ( equals( artifactVersions[i], versions.getNewestUpdate( of( MINOR ) ) ) )
{
sink.text( getText( "report.latestMinor" ) );
}
else if ( equals( artifactVersions[i], versions.getOldestUpdate( of( MAJOR ) ) ) )
{
sink.text( getText( "report.nextMajor" ) );
}
else if ( equals( artifactVersions[i], versions.getNewestUpdate( of( MAJOR ) ) ) )
{
sink.text( getText( "report.latestMajor" ) );
}

sink.text( label );
safeItalic_();
}
}
Expand Down Expand Up @@ -855,4 +778,42 @@ private Set<String> getVersionsInRange( Property property, PropertyVersions vers
return rangeVersions;
}

protected String getLabel( ArtifactVersion version, AbstractVersionDetails versions )
{
String label = null;
if ( equals( version, versions.getNewestUpdate( of( MAJOR ) ) ) )
{
label = getText( "report.latestMajor" );
}
else if ( equals( version, versions.getOldestUpdate( of( MAJOR ) ) ) )
{
label = getText( "report.nextMajor" );
}
else if ( equals( version, versions.getNewestUpdate( of( MINOR ) ) ) )
{
label = getText( "report.latestMinor" );
}
else if ( equals( version, versions.getOldestUpdate( of( MINOR ) ) ) )
{
label = getText( "report.nextMinor" );
}
else if ( equals( version, versions.getNewestUpdate( of( INCREMENTAL ) ) ) )
{
label = getText( "report.latestIncremental" );
}
else if ( equals( version, versions.getOldestUpdate( of( INCREMENTAL ) ) ) )
{
label = getText( "report.nextIncremental" );
}
else if ( equals( version, versions.getNewestUpdate( of( SUBINCREMENTAL ) ) ) )
{
label = getText( "report.latestSubIncremental" );
}
else if ( equals( version, versions.getOldestUpdate( of( SUBINCREMENTAL ) ) ) )
{
label = getText( "report.nextVersion" );
}
return label;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -436,67 +436,18 @@ else if ( details.getArtifactVersions().getOldestUpdate( of( MAJOR ) ) != null )
{
sink.lineBreak();
}
boolean bold = equals(
versions[i], details.getArtifactVersions().getOldestUpdate( of( SUBINCREMENTAL ) ) )
|| equals( versions[i],
details.getArtifactVersions().getNewestUpdate( of( SUBINCREMENTAL ) ) )
|| equals( versions[i], details.getArtifactVersions().getOldestUpdate( of( INCREMENTAL ) ) )
|| equals( versions[i], details.getArtifactVersions().getNewestUpdate( of( INCREMENTAL ) ) )
|| equals( versions[i], details.getArtifactVersions().getOldestUpdate( of( MINOR ) ) )
|| equals( versions[i], details.getArtifactVersions().getNewestUpdate( of( MINOR ) ) )
|| equals( versions[i], details.getArtifactVersions().getOldestUpdate( of( MAJOR ) ) )
|| equals( versions[i], details.getArtifactVersions().getNewestUpdate( of( MAJOR ) ) );
if ( bold )
String label = getLabel( versions[i], details.getArtifactVersions() );
if ( label != null )
{
safeBold();
}
sink.text( versions[i].toString() );
if ( bold )
if ( label != null )
{
safeBold_();
sink.nonBreakingSpace();
safeItalic();
if ( equals( versions[i],
details.getArtifactVersions().getOldestUpdate( of( SUBINCREMENTAL ) ) ) )
{
sink.text( getText( "report.nextVersion" ) );
}
else if ( equals( versions[i],
details.getArtifactVersions().getNewestUpdate( of( SUBINCREMENTAL ) ) ) )
{
sink.text( getText( "report.latestSubIncremental" ) );
}
else if ( equals( versions[i],
details.getArtifactVersions().getOldestUpdate( of( INCREMENTAL ) ) ) )
{
sink.text( getText( "report.nextIncremental" ) );
}
else if ( equals( versions[i],
details.getArtifactVersions().getNewestUpdate( of( INCREMENTAL ) ) ) )
{
sink.text( getText( "report.latestIncremental" ) );
}
else if ( equals( versions[i],
details.getArtifactVersions().getOldestUpdate( of( MINOR ) ) ) )
{
sink.text( getText( "report.nextMinor" ) );
}
else if ( equals( versions[i],
details.getArtifactVersions().getNewestUpdate( of( MINOR ) ) ) )
{
sink.text( getText( "report.latestMinor" ) );
}
else if ( equals( versions[i],
details.getArtifactVersions().getOldestUpdate( of( MAJOR ) ) ) )
{
sink.text( getText( "report.nextMajor" ) );
}
else if ( equals( versions[i],
details.getArtifactVersions().getNewestUpdate( of( MAJOR ) ) ) )
{
sink.text( getText( "report.latestMajor" ) );
}

sink.text( label );
safeItalic_();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ protected Optional<String> getLowerBound( ArtifactVersion version, Optional<Segm
* Checks if the candidate version is in the range of the restriction.
* a custom comparator is/can be used to have milestones and rcs before final releases,
* which is not yet possible with {@link Restriction#containsVersion(ArtifactVersion)}.
* @PARAM RESTRICTION THE RANGE TO CHECK AGAINST.
* @param restriction the range to check against.
* @param candidate the version to check.
* @return true if the candidate version is within the range of the restriction parameter.
*/
Expand Down
Loading