Package net.kyori.indra.git
Interface IndraGitExtension
-
- All Known Implementing Classes:
IndraGitExtensionImpl
public interface IndraGitExtensionAn extension exposing git information.- Since:
- 2.0.0
-
-
Field Summary
Fields Modifier and Type Field Description static StringMANIFEST_ATTRIBUTE_GIT_BRANCHThe manifest attribute used to indicate the git branch an archive is built from.static StringMANIFEST_ATTRIBUTE_GIT_COMMITThe manifest attribute used to indicate the git commit an archive is built from.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidapplyVcsInformationToManifest(org.gradle.api.java.archives.Manifest manifest)Apply metadata about the current git state to the provided manifest.@Nullable org.eclipse.jgit.lib.Refbranch()Get an object pointing to the current branch.@Nullable StringbranchName()Get the name of the current branch.@Nullable org.eclipse.jgit.lib.ObjectIdcommit()Get the ID of the current commit.@Nullable Stringdescribe()Get agit describestring for the project's repository.@Nullable org.eclipse.jgit.api.Gitgit()Access the underlying Git repository.@Nullable org.eclipse.jgit.lib.RefheadTag()Get the tag pointing to the commit checked out asHEAD.default booleanisPresent()Get if a git repository is present.@NonNull List<org.eclipse.jgit.lib.Ref>tags()Get all tags created on this repository.
-
-
-
Field Detail
-
MANIFEST_ATTRIBUTE_GIT_COMMIT
static final String MANIFEST_ATTRIBUTE_GIT_COMMIT
The manifest attribute used to indicate the git commit an archive is built from.- Since:
- 2.0.0
- See Also:
- Constant Field Values
-
MANIFEST_ATTRIBUTE_GIT_BRANCH
static final String MANIFEST_ATTRIBUTE_GIT_BRANCH
The manifest attribute used to indicate the git branch an archive is built from.- Since:
- 2.0.0
- See Also:
- Constant Field Values
-
-
Method Detail
-
isPresent
default boolean isPresent()
Get if a git repository is present.- Returns:
- whether or not a git repository is present for the current project.
- Since:
- 2.0.0
-
git
@Nullable org.eclipse.jgit.api.Git git()
Access the underlying Git repository.This will look for a git repository in the root project directory.
This will search in the current project's directory, and if the project is not a git checkout, will traverse parent directories until a
.gitfolder is found.- Returns:
- the git repository
- Since:
- 2.0.0
-
tags
@NonNull List<org.eclipse.jgit.lib.Ref> tags()
Get all tags created on this repository.- Returns:
- the tags on this repository, or an empty list if this project is not in a git repository
- Since:
- 2.0.0
-
headTag
@Nullable org.eclipse.jgit.lib.Ref headTag()
Get the tag pointing to the commit checked out asHEAD.- Returns:
- the tag at
HEAD, ornullif the project is not in a git repository or is not checked out to a tag - Since:
- 2.0.0
-
describe
@Nullable String describe()
Get agit describestring for the project's repository.The result will be equivalent to the result of executing
git describe --tags --long- Returns:
- the describe string, or
nullif this project is not in a git repository or if there are no tags in the project's history - Since:
- 2.0.0
-
branchName
@Nullable String branchName()
Get the name of the current branch.- Returns:
- the name of the active branch, or
nullif the project is not in a git repository or is checked out to a detachedHEAD. - Since:
- 2.0.0
-
branch
@Nullable org.eclipse.jgit.lib.Ref branch()
Get an object pointing to the current branch.- Returns:
- the active branch, or
nullif the project is not in a git repository or is checked out to a detachedHEAD. - Since:
- 2.0.0
-
commit
@Nullable org.eclipse.jgit.lib.ObjectId commit()
Get the ID of the current commit.- Returns:
- the commit id, or
nullif the project is not in a git repository or has not had its initial commit - Since:
- 2.0.0
-
applyVcsInformationToManifest
default void applyVcsInformationToManifest(org.gradle.api.java.archives.Manifest manifest)
Apply metadata about the current git state to the provided manifest.Any unavailable state will not
Current supported parameters are:
Git-Branch- The current branch being built
Git-Commit- The current commit being built
- Parameters:
manifest- the manifest to decorate- Since:
- 2.0.0
-
-