Class GitExtension

java.lang.Object
com.xenoterracide.gradle.git.GitExtension
All Implemented Interfaces:
Provides<GitMetadata>

public class GitExtension extends Object implements Provides<GitMetadata>
Extension for the GitPlugin mainly providing Provider's for GitMetadata.
  • Method Details

    • getProvider

      public org.gradle.api.provider.Provider<GitMetadata> getProvider()
      Description copied from interface: Provides
      Returns a provider of the value.
      Specified by:
      getProvider in interface Provides<GitMetadata>
      Returns:
      a provider of the value
    • getBranch

      public org.gradle.api.provider.Provider<String> getBranch()
      Gets the current branch.
      Returns:
      the current branch
    • getUniqueShort

      public org.gradle.api.provider.Provider<String> getUniqueShort()
      Short version of a commit SHA.
      Returns:
      SHA. Length starts at 8 but may grow as repository does
    • getTag

      public org.gradle.api.provider.Provider<String> getTag()
      Gets latest tag.
      Returns:
      the latest tag
    • getDistance

      public org.gradle.api.provider.Provider<Long> getDistance()
      Gets commit distance.
      Returns:
      the commit distance
    • getDirty

      public org.gradle.api.provider.Provider<Boolean> getDirty()
      Gets dirty status.
      Returns:
      the status
    • getStatus

      public org.gradle.api.provider.Provider<GitStatus> getStatus()
      Gets the status.
      Returns:
      the status
    • getCommit

      public org.gradle.api.provider.Provider<String> getCommit()
      Gets the current commit.
      Returns:
      the current commit
    • getRemotes

      @Incubating public org.gradle.api.provider.Provider<List<GitRemoteForGradle>> getRemotes()
      Gets the list of remotes.
      Returns:
      the list of remotes
    • commonAncestorDistanceFor

      public Optional<Long> commonAncestorDistanceFor(GitRemoteForGradle remote)
      will find the common ancestor between this branch and the given remote reference that is in your local git databse. Essentially this is the distance from a tag from a git merge base.
      Parameters:
      remote - the remote
      Returns:
      the distance