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 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<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()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.tagNames()Get the names of all tags in the 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
-
headTag
@Nullable public static @Nullable org.eclipse.jgit.lib.Ref headTag(org.eclipse.jgit.api.Git git) -
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
-
tagNames
Description copied from interface:IndraGitExtensionGet the names of all tags in the repository.- Specified by:
tagNamesin interfaceIndraGitExtension- Returns:
- tag names, or an empty list if the project is not in a git repository or has no tags
-
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.
-
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
-