Class GitHubSourceBuilds

java.lang.Object
io.github.intisy.gradle.github.impl.github.GitHubSourceBuilds
All Implemented Interfaces:
SourceBuilds

public final class GitHubSourceBuilds extends Object implements SourceBuilds
Adapts the host-agnostic SourceBuilder to the GitHub-specific SourceBuilds capability by resolving owner/repo to a github.com clone URL before delegating, so the source-build strategy behaves exactly as it did before SourceBuilder took an explicit clone URL.
  • Constructor Details

    • GitHubSourceBuilds

      public GitHubSourceBuilds(GitHub gitHub, SourceBuilder sourceBuilder)
      Parameters:
      gitHub - resolves the github.com clone URL (SSH or HTTPS) for a given owner/repo.
      sourceBuilder - builds and caches the jar once the clone URL is known.
  • Method Details

    • buildFromSource

      public File buildFromSource(String owner, String repo, String branch, String commitSha) throws IOException
      Description copied from interface: SourceBuilds
      Builds a GitHub repository from source, identified by owner and repo.
      Specified by:
      buildFromSource in interface SourceBuilds
      Parameters:
      owner - the repository owner.
      repo - the repository name.
      branch - the branch to clone or pull, or null for the current/default branch.
      commitSha - the commit to build, or null to use the branch's latest commit.
      Returns:
      the cached jar for the resolved commit, built only when not already cached.
      Throws:
      IOException - if the clone/pull, checkout, or build itself fails.
    • buildFromGit

      public File buildFromGit(String cloneUrl, String ref) throws IOException
      Description copied from interface: SourceBuilds
      Builds any git repository from source, identified by an explicit clone URL rather than a GitHub owner/repo, so hosts other than github.com are equally supported.
      Specified by:
      buildFromGit in interface SourceBuilds
      Parameters:
      cloneUrl - the exact URL to clone from.
      ref - the branch, tag, or commit to build, or null for the remote's default branch.
      Returns:
      the cached jar for the resolved ref, built only when not already cached.
      Throws:
      IOException - if the clone, checkout, or build itself fails.