use of org.shipkit.version.VersionInfo in project shipkit by mockito.
the class ShipkitConfigurationPlugin method apply.
public void apply(final Project project) {
if (project.getParent() == null) {
// root project, add the extension
project.getPlugins().apply(InitPlugin.class);
project.getPlugins().apply(VersioningPlugin.class);
VersionInfo info = project.getExtensions().getByType(VersionInfo.class);
conf = project.getRootProject().getExtensions().create("shipkit", ShipkitConfiguration.class);
loadConfigFromFile(project.getRootProject(), getShipkitFile(project), conf);
if (project.hasProperty(DRY_RUN_PROPERTY)) {
conf.setDryRun(true);
// TODO (maybe) we can actually implement it so that we automatically preconfigure everything by command line parameters
// e.g. shipkit.gitHub.repository is also a property
}
conf.setPreviousReleaseVersion(info.getPreviousVersion());
} else {
// not root project, get extension from root project
conf = project.getRootProject().getPlugins().apply(ShipkitConfigurationPlugin.class).getConfiguration();
}
}
use of org.shipkit.version.VersionInfo in project shipkit by mockito.
the class BumpVersionFile method bumpVersionFile.
public void bumpVersionFile(BumpVersionFileTask task) {
VersionInfo versionInfo = Version.versionInfo(task.getVersionFile());
VersionInfo newVersion = versionInfo.bumpVersion();
String versionFile = task.getVersionFile().getName();
LOG.lifecycle(versionMessage(newVersion, versionFile, task.getPath()));
}
use of org.shipkit.version.VersionInfo in project shipkit by mockito.
the class VersioningPlugin method apply.
public void apply(final Project project) {
final File versionFile = project.file(VERSION_FILE_NAME);
final VersionInfo versionInfo;
if (versionFile.isFile()) {
versionInfo = Version.versionInfo(versionFile);
LOG.lifecycle(" Building version '{}' (value loaded from '{}' file).", versionInfo.getVersion(), versionFile.getName());
} else {
versionInfo = Version.defaultVersionInfo(versionFile, project.getVersion().toString());
LOG.lifecycle(" Building version '{}'.", versionInfo.getVersion());
}
project.getExtensions().add(VersionInfo.class.getName(), versionInfo);
final String version = versionInfo.getVersion();
project.allprojects(new Action<Project>() {
@Override
public void execute(Project project) {
project.setVersion(version);
}
});
TaskMaker.task(project, BUMP_VERSION_FILE_TASK, BumpVersionFileTask.class, new Action<BumpVersionFileTask>() {
public void execute(final BumpVersionFileTask t) {
t.setDescription("Increments version number in " + versionFile.getName());
t.setVersionFile(versionFile);
String versionChangeMessage = formatVersionInformationInCommitMessage(version, versionInfo.getPreviousVersion());
GitPlugin.registerChangesForCommitIfApplied(singletonList(versionFile), versionChangeMessage, t);
}
});
}
Aggregations