All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.tomlee.gradle.plugins.release.tasks.ReleaseEndTransactionTask Maven / Gradle / Ivy

There is a newer version: 0.0.7
Show newest version
package co.tomlee.gradle.plugins.release.tasks;

import org.eclipse.jgit.api.Git;
import org.gradle.api.DefaultTask;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
import org.gradle.api.tasks.TaskAction;

import java.io.File;

import static co.tomlee.gradle.plugins.release.tasks.TaskHelpers.*;

public class ReleaseEndTransactionTask extends DefaultTask {
    private final Logger log = Logging.getLogger(ReleaseEndTransactionTask.class);

    @TaskAction
    public void removeTag() throws Exception {
        final Git git = git(getProject());
        final File transactionFile =
            new File(git.getRepository().getDirectory().getParentFile(), ".releaseTransaction");
        if (transactionFile.exists() && !transactionFile.delete()) {
            log.error("Failed to delete transaction file: " + transactionFile);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy