[release] set fullChangelog field via cli & plugins. Resolves #331

This commit is contained in:
Andres Almiray
2021-08-02 21:16:13 +02:00
parent fc6be6592d
commit 7fb739378a
5 changed files with 36 additions and 1 deletions

View File

@@ -67,6 +67,10 @@ public class Release extends AbstractPlatformAwareModelCommand {
description = "The project snapshot label.")
String projectSnapshotLabel;
@CommandLine.Option(names = {"--project-snapshot-full-changelog"},
description = "Calculate full changelog since last non-snapshot release.")
boolean projectSnapshotFullChangelog;
@CommandLine.Option(names = {"--tag-name"},
description = "The release tag.")
String tagName;
@@ -166,6 +170,7 @@ public class Release extends AbstractPlatformAwareModelCommand {
.projectVersionPattern(projectVersionPattern)
.projectSnapshotPattern(projectSnapshotPattern)
.projectSnapshotLabel(projectSnapshotLabel)
.projectSnapshotFullChangelog(projectSnapshotFullChangelog)
.tagName(tagName)
.releaseName(releaseName)
.milestoneName(milestoneName)

View File

@@ -65,6 +65,7 @@ public class ModelAutoConfigurer {
private String projectVersionPattern;
private String projectSnapshotPattern;
private String projectSnapshotLabel;
private boolean projectSnapshotFullChangelog;
private String tagName;
private String releaseName;
private String milestoneName;
@@ -132,6 +133,11 @@ public class ModelAutoConfigurer {
return this;
}
public ModelAutoConfigurer projectSnapshotFullChangelog(boolean projectSnapshotFullChangelog) {
this.projectSnapshotFullChangelog = projectSnapshotFullChangelog;
return this;
}
public ModelAutoConfigurer tagName(String tagName) {
this.tagName = tagName;
return this;
@@ -310,6 +316,7 @@ public class ModelAutoConfigurer {
if (isNotBlank(projectVersionPattern)) logger.info("- project.version.pattern: {}", projectVersionPattern);
if (isNotBlank(projectSnapshotPattern)) logger.info("- project.snapshot.pattern: {}", projectSnapshotPattern);
if (isNotBlank(projectSnapshotLabel)) logger.info("- project.snapshot.label: {}", projectSnapshotLabel);
if (projectSnapshotFullChangelog) logger.info("- project.snapshot.full.changelog: true");
if (isNotBlank(username)) logger.info("- release.username: {}", username);
if (isNotBlank(tagName)) logger.info("- release.tagName: {}", tagName);
if (isNotBlank(branch)) logger.info("- release.branch: {}", branch);
@@ -351,6 +358,7 @@ public class ModelAutoConfigurer {
model.getProject().setVersionPattern(projectVersionPattern);
model.getProject().getSnapshot().setPattern(projectSnapshotPattern);
model.getProject().getSnapshot().setLabel(projectSnapshotLabel);
model.getProject().getSnapshot().setFullChangelog(projectSnapshotFullChangelog);
try {
Repository repository = GitSdk.of(basedir, gitRootSearch).getRemote();

View File

@@ -60,6 +60,7 @@ public class JReleaserAutoConfigReleaseTask extends Task {
private String projectVersionPattern;
private String projectSnapshotPattern;
private String projectSnapshotLabel;
private boolean projectSnapshotFullChangelog;
private String tagName;
private String releaseName;
private String branch;
@@ -118,6 +119,10 @@ public class JReleaserAutoConfigReleaseTask extends Task {
this.projectSnapshotLabel = projectSnapshotLabel;
}
public void setProjectSnapshotFullChangelog(boolean projectSnapshotFullChangelog) {
this.projectSnapshotFullChangelog = projectSnapshotFullChangelog;
}
public void setTagName(String tagName) {
this.tagName = tagName;
}
@@ -220,6 +225,7 @@ public class JReleaserAutoConfigReleaseTask extends Task {
.projectVersionPattern(projectVersionPattern)
.projectSnapshotPattern(projectSnapshotPattern)
.projectSnapshotLabel(projectSnapshotLabel)
.projectSnapshotFullChangelog(projectSnapshotFullChangelog)
.tagName(tagName)
.releaseName(releaseName)
.branch(branch)

View File

@@ -74,6 +74,9 @@ abstract class JReleaseAutoConfigReleaseTask extends DefaultTask {
final Property<String> projectSnapshotLabel
@Input
@Optional
final Property<Boolean> projectSnapshotFullChangelog
@Input
@Optional
final Property<String> tagName
@Input
@Optional
@@ -156,10 +159,15 @@ abstract class JReleaseAutoConfigReleaseTask extends DefaultTask {
}
@Option(option = 'project-snapshot-label', description = 'The project snapshot label (OPTIONAL).')
void projectSnapshotLabel(String projectSnapshotLabel) {
void setProjectSnapshotLabel(String projectSnapshotLabel) {
this.projectSnapshotLabel.set(projectSnapshotLabel)
}
@Option(option = 'project-snapshot-full-changelog', description = 'Calculate full changelog since last non-snapshot release (OPTIONAL).')
void setProjectSnapshotFullChangelog(boolean projectSnapshotFullChangelog) {
this.projectSnapshotFullChangelog.set(projectSnapshotFullChangelog)
}
@Option(option = 'tag-name', description = 'The release tga (OPTIONAL).')
void setTagName(String tagName) {
this.tagName.set(tagName)
@@ -292,6 +300,7 @@ abstract class JReleaseAutoConfigReleaseTask extends DefaultTask {
projectVersionPattern = objects.property(String).convention(String.valueOf(Providers.notDefined()))
projectSnapshotPattern = objects.property(String).convention(String.valueOf(Providers.notDefined()))
projectSnapshotLabel = objects.property(String).convention(String.valueOf(Providers.notDefined()))
projectSnapshotFullChangelog = objects.property(Boolean).convention(false)
tagName = objects.property(String).convention(Providers.notDefined())
releaseName = objects.property(String).convention(Providers.notDefined())
branch = objects.property(String).convention(Providers.notDefined())
@@ -333,6 +342,7 @@ abstract class JReleaseAutoConfigReleaseTask extends DefaultTask {
.projectVersionPattern(projectVersionPattern.orNull)
.projectSnapshotPattern(projectSnapshotPattern.orNull)
.projectSnapshotLabel(projectSnapshotLabel.orNull)
.projectSnapshotFullChangelog(projectSnapshotFullChangelog.get())
.tagName(tagName.orNull)
.releaseName(releaseName.orNull)
.branch(branch.orNull)

View File

@@ -98,6 +98,11 @@ public class JReleaserAutoConfigReleaseMojo extends AbstractMojo {
*/
@Parameter(property = "jreleaser.project.snapshot.label")
private String projectSnapshotLabel;
/**
* Calculate full changelog since last non-snapshot release.
*/
@Parameter(property = "jreleaser.project.snapshot.full.changelog")
boolean projectSnapshotFullChangelog;
/**
* The release tag.
*/
@@ -219,6 +224,7 @@ public class JReleaserAutoConfigReleaseMojo extends AbstractMojo {
.projectVersionPattern(projectVersionPattern)
.projectSnapshotPattern(projectSnapshotPattern)
.projectSnapshotLabel(projectSnapshotLabel)
.projectSnapshotFullChangelog(projectSnapshotFullChangelog)
.tagName(tagName)
.releaseName(releaseName)
.branch(branch)