Package net.kyori.indra.git.internal
Class IndraGitExtensionImpl
java.lang.Object
net.kyori.indra.git.internal.IndraGitExtensionImpl
- All Implemented Interfaces:
IndraGitExtension
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic class -
Field Summary
Fields inherited from interface net.kyori.indra.git.IndraGitExtension
MANIFEST_ATTRIBUTE_GIT_BRANCH, MANIFEST_ATTRIBUTE_GIT_COMMIT -
Constructor Summary
ConstructorsConstructorDescriptionIndraGitExtensionImpl(org.gradle.api.provider.ProviderFactory providers, File rootDir, File projectDir, String displayName) -
Method Summary
Modifier and TypeMethodDescription@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.@Nullable org.eclipse.jgit.api.Gitgit()@NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.Ref>headTag()Get the tag pointing to the commit checked out asHEAD.static @Nullable org.eclipse.jgit.lib.RefheadTag(org.eclipse.jgit.api.Git git) booleanGet if a git repository is present.<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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.kyori.indra.git.IndraGitExtension
applyVcsInformationToManifest, repositoryValue
-
Constructor Details
-
IndraGitExtensionImpl
-
-
Method Details
-
isPresent
public boolean isPresent()Description copied from interface:IndraGitExtensionGet if a git repository is present.- Specified by:
isPresentin interfaceIndraGitExtension- Returns:
- whether or not a git repository is present for the current project.
-
git
@VisibleForTesting @Nullable public @Nullable org.eclipse.jgit.api.Git git() -
repositoryValue
public <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) Description copied from interface:IndraGitExtensionCreate a provider which uses a value from a git repository.- Specified by:
repositoryValuein interfaceIndraGitExtension- 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
-
tags
@NotNull public @NotNull org.gradle.api.provider.Provider<? extends List<? extends org.eclipse.jgit.lib.Ref>> tags()Description copied from interface:IndraGitExtensionGet all tags created on this repository.- Specified by:
tagsin interfaceIndraGitExtension- Returns:
- the tags on this repository, or an empty list if this project is not in a git repository
-
headTag
@Nullable public static @Nullable org.eclipse.jgit.lib.Ref headTag(org.eclipse.jgit.api.Git git) -
headTag
@NotNull public @NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.Ref> headTag()Description copied from interface:IndraGitExtensionGet the tag pointing to the commit checked out asHEAD.- Specified by:
headTagin interfaceIndraGitExtension- Returns:
- the tag at
HEAD, ornullif the project is not in a git repository or is not checked out to a tag
-
describe
Description copied from interface:IndraGitExtensionGet agit describestring for the project's repository.The result will be equivalent to the result of executing
git describe --tags --long- Specified by:
describein interfaceIndraGitExtension- 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
-
branchName
Description copied from interface:IndraGitExtensionGet the name of the current branch.- Specified by:
branchNamein interfaceIndraGitExtension- Returns:
- the name of the active branch, or
nullif the project is not in a git repository or is checked out to a detachedHEAD.
-
branch
@NotNull public @NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.Ref> branch()Description copied from interface:IndraGitExtensionGet an object pointing to the current branch.- Specified by:
branchin interfaceIndraGitExtension- Returns:
- the active branch, or
nullif the project is not in a git repository or is checked out to a detachedHEAD.
-
commit
@NotNull public @NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.ObjectId> commit()Description copied from interface:IndraGitExtensionGet the ID of the current commit.- Specified by:
commitin interfaceIndraGitExtension- Returns:
- the commit id, or
nullif the project is not in a git repository or has not had its initial commit
-