Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public void buildEnded(MavenSession session) {
logger.info(project.getId() + " requires a version bump from " + currentVersion + " => "
+ newVersion);
engine.setProjects(metadataReader.getProjects());
engine.setUpdatePackageVersions(false);
engine.setUpdatePackageVersions(VersionBumpMojo.getUpdatePackages(session, project, projectHelper));
engine.addVersionChange(pomFile.getArtifactId(), newVersion);
engine.apply();
bumped++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* <li>one can now run the build again with the incremented version and verify the automatic applied
* changes</li>
* </ul>
*
*
*/
@Mojo(name = VersionBumpMojo.NAME, threadSafe = true, defaultPhase = LifecyclePhase.VERIFY, requiresProject = true)
public class VersionBumpMojo extends AbstractMojo {
Expand All @@ -47,17 +47,28 @@ public class VersionBumpMojo extends AbstractMojo {

static final int DEFAULT_INCREMENT = 1;

static final boolean DEFAULT_UPDATE_PACKAGES = false;

static final String NAME = "bump-versions";

static final String PROPERTY_INCREMENT = "tycho." + NAME + ".increment";

static final String PROPERTY_UPDATE_PACKAGES = "tycho." + NAME + ".updatePackages";

/**
* Configures the default increment of micro version to use if no version is recommended by the
* VersionBumpRequiredException produced by the version check plugin.
*/
@Parameter(property = PROPERTY_INCREMENT, defaultValue = DEFAULT_INCREMENT + "")
private int increment = DEFAULT_INCREMENT;

/**
* Configures whether to update exported packages to the version recommended by the
* VersionBumpRequiredException produced by the version check plugin.
*/
@Parameter(property = PROPERTY_UPDATE_PACKAGES, defaultValue = DEFAULT_UPDATE_PACKAGES + "")
private boolean updatePackages = DEFAULT_UPDATE_PACKAGES;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
//actual work is performed in VersionBumpBuildListener
Expand All @@ -79,4 +90,20 @@ public static int getIncrement(MavenSession mavenSession, MavenProject project,
return DEFAULT_INCREMENT;
}

public static boolean getUpdatePackages(MavenSession mavenSession, MavenProject project, ProjectHelper projectHelper) {
String prop = mavenSession.getUserProperties().getProperty(PROPERTY_UPDATE_PACKAGES);
if (prop != null) {
return Boolean.parseBoolean(prop);
}
Xpp3Dom configuration = projectHelper.getPluginConfiguration(GROUP_ID, ARTIFACT_ID, NAME, project,
mavenSession);
if (configuration != null) {
Xpp3Dom child = configuration.getChild("updatePackages");
if (child != null) {
return Boolean.parseBoolean(child.getValue());
}
}
return DEFAULT_UPDATE_PACKAGES;
}

}
Loading