Package net.kyori.indra.git
Interface IndraGitExtension
- All Known Implementing Classes:
IndraGitExtensionImpl
public interface IndraGitExtension
An extension exposing git information.
To find the appropriate repository, indra-git 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 .git folder is found.
- Since:
- 2.0.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault voidapplyVcsInformationToManifest(org.gradle.api.java.archives.Manifest manifest) Apply metadata about the current git state to the provided manifest.@NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.Ref>branch()Get an object pointing to the current branch.@NotNull org.gradle.api.provider.Provider<String>Get the name of the current branch.@NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.ObjectId>commit()Get the ID of the current commit.@NotNull org.gradle.api.provider.Provider<String>describe()Get agit describestring for the project's repository.@NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.Ref>headTag()Get the tag pointing to the commit checked out asHEAD.booleanGet if a git repository is present.default <V,P extends RepositoryValueSource.Parameters, S extends RepositoryValueSource<V, P>>
org.gradle.api.provider.Provider<V>repositoryValue(Class<S> valueSource) Create a parameterless which uses a value from a git repository.<V,P extends RepositoryValueSource.Parameters, S extends RepositoryValueSource<V, P>>
org.gradle.api.provider.Provider<V>repositoryValue(Class<S> valueSource, org.gradle.api.Action<? super org.gradle.api.provider.ValueSourceSpec<P>> configureAction) Create a provider which uses a value from a git repository.@NotNull org.gradle.api.provider.Provider<? extends List<? extends org.eclipse.jgit.lib.Ref>>tags()Get all tags created on this repository.
-
Field Details
-
MANIFEST_ATTRIBUTE_GIT_COMMIT
The manifest attribute used to indicate the git commit an archive is built from.- Since:
- 2.0.0
- See Also:
-
MANIFEST_ATTRIBUTE_GIT_BRANCH
The manifest attribute used to indicate the git branch an archive is built from.- Since:
- 2.0.0
- See Also:
-
-
Method Details
-
isPresent
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
-
repositoryValue
default <V,P extends RepositoryValueSource.Parameters, org.gradle.api.provider.Provider<V> repositoryValueS extends RepositoryValueSource<V, P>> (Class<S> valueSource) Create a parameterless which uses a value from a git repository.- Type Parameters:
V- the value typeP- the value source type- Parameters:
valueSource- the value source type- Returns:
- the value provider
- Since:
- 4.0.0
-
repositoryValue
<V,P extends RepositoryValueSource.Parameters, org.gradle.api.provider.Provider<V> repositoryValueS extends RepositoryValueSource<V, P>> (Class<S> valueSource, org.gradle.api.Action<? super org.gradle.api.provider.ValueSourceSpec<P>> configureAction) Create a provider which uses a value from a git repository.- Type Parameters:
V- the value typeP- the value source type- Parameters:
valueSource- the value source typeconfigureAction- an action to configure any additional parameters on the value source- Returns:
- the value provider
- Since:
- 4.0.0
-
tags
@NotNull @NotNull org.gradle.api.provider.Provider<? extends List<? extends 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
@NotNull @NotNull org.gradle.api.provider.Provider<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
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
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
@NotNull @NotNull org.gradle.api.provider.Provider<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
@NotNull @NotNull org.gradle.api.provider.Provider<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
-