Search in sources :

Example 1 with VersionInfo

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();
    }
}
Also used : VersionInfo(org.shipkit.version.VersionInfo) ShipkitConfiguration(org.shipkit.gradle.configuration.ShipkitConfiguration)

Example 2 with VersionInfo

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()));
}
Also used : VersionInfo(org.shipkit.version.VersionInfo)

Example 3 with VersionInfo

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);
        }
    });
}
Also used : VersionInfo(org.shipkit.version.VersionInfo) Project(org.gradle.api.Project) BumpVersionFileTask(org.shipkit.gradle.version.BumpVersionFileTask) File(java.io.File)

Aggregations

VersionInfo (org.shipkit.version.VersionInfo)3 File (java.io.File)1 Project (org.gradle.api.Project)1 ShipkitConfiguration (org.shipkit.gradle.configuration.ShipkitConfiguration)1 BumpVersionFileTask (org.shipkit.gradle.version.BumpVersionFileTask)1