Class IndraGitExtensionImpl

java.lang.Object
net.kyori.indra.git.internal.IndraGitExtensionImpl
All Implemented Interfaces:
IndraGitExtension

public class IndraGitExtensionImpl extends Object implements IndraGitExtension
  • Constructor Details

    • IndraGitExtensionImpl

      @Inject public IndraGitExtensionImpl(org.gradle.api.provider.ProviderFactory providers, File rootDir, File projectDir, String displayName)
  • Method Details

    • isPresent

      public boolean isPresent()
      Description copied from interface: IndraGitExtension
      Get if a git repository is present.
      Specified by:
      isPresent in interface IndraGitExtension
      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, 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)
      Description copied from interface: IndraGitExtension
      Create a provider which uses a value from a git repository.
      Specified by:
      repositoryValue in interface IndraGitExtension
      Type Parameters:
      V - the value type
      P - the value source type
      Parameters:
      valueSource - the value source type
      configureAction - 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

      @NotNull public @NotNull org.gradle.api.provider.Provider<String> describe()
      Description copied from interface: IndraGitExtension
      Get a git describe string for the project's repository.

      The result will be equivalent to the result of executing git describe --tags --long

      Specified by:
      describe in interface IndraGitExtension
      Returns:
      the describe string, or null if this project is not in a git repository or if there are no tags in the project's history
    • tagNames

      @NotNull public @NotNull org.gradle.api.provider.Provider<List<String>> tagNames()
      Description copied from interface: IndraGitExtension
      Get the names of all tags in the repository.
      Specified by:
      tagNames in interface IndraGitExtension
      Returns:
      tag names, or an empty list if the project is not in a git repository or has no tags
    • branchName

      @NotNull public @NotNull org.gradle.api.provider.Provider<String> branchName()
      Description copied from interface: IndraGitExtension
      Get the name of the current branch.
      Specified by:
      branchName in interface IndraGitExtension
      Returns:
      the name of the active branch, or null if the project is not in a git repository or is checked out to a detached HEAD.
    • commit

      @NotNull public @NotNull org.gradle.api.provider.Provider<org.eclipse.jgit.lib.ObjectId> commit()
      Description copied from interface: IndraGitExtension
      Get the ID of the current commit.
      Specified by:
      commit in interface IndraGitExtension
      Returns:
      the commit id, or null if the project is not in a git repository or has not had its initial commit