-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
779 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
gradle-plugin/src/main/java/org/dmfs/gradle/gver/tasks/TagPreReleaseTask.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.dmfs.gradle.gver.tasks; | ||
|
||
import org.dmfs.gradle.gver.utils.ProjectRepositoryFunction; | ||
import org.dmfs.gver.dsl.GitVersionConfig; | ||
import org.dmfs.gver.dsl.procedure.CreateTag; | ||
import org.dmfs.semver.StrictParser; | ||
import org.eclipse.jgit.lib.Repository; | ||
import org.gradle.api.DefaultTask; | ||
import org.gradle.api.Task; | ||
import org.gradle.api.tasks.TaskAction; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.dmfs.gver.dsl.ReleaseType.PRERELEASE; | ||
|
||
|
||
/** | ||
* A Gradle {@link Task} that tags the current HEAD with a new pre-release version. | ||
* <p> | ||
* This task will throw an {@link IllegalStateException} when the current HEAD is not on a pre-release branch. | ||
*/ | ||
public class TagPreReleaseTask extends DefaultTask | ||
{ | ||
public TagPreReleaseTask() | ||
{ | ||
setGroup("gver"); | ||
setDescription("Tags the HEAD commit with a new pre-release version."); | ||
} | ||
|
||
@TaskAction | ||
public void perform() throws IOException | ||
{ | ||
try (Repository repository = ProjectRepositoryFunction.INSTANCE.value(getProject())) | ||
{ | ||
new CreateTag( | ||
getLogger()::lifecycle, | ||
PRERELEASE::equals, | ||
(GitVersionConfig) getProject().getExtensions().getByName("gver"), | ||
new StrictParser().parse(getProject().getVersion().toString())) | ||
.process(repository); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.