Class SourceBuilder
java.lang.Object
io.github.intisy.gradle.github.impl.source.SourceBuilder
Clones an arbitrary git URL and builds it, caching the resulting jar by commit, so a repeated
request for the same commit never re-runs the build. Host-agnostic: the caller supplies the
clone URL explicitly, so this class never assumes github.com or any other specific host.
- Implementation Note:
GitHubcarries a singleResourceSettings, hence a single repository identity, so a freshGitHubis built perbuildFromSourcecall (whichbuildFromGit(java.lang.String, java.lang.String)also goes through), scoped to the exactcloneUrlrequested, rather than accepting one pre-builtGitHubthat could only ever be correctly configured for one repository.
-
Constructor Summary
ConstructorsConstructorDescriptionSourceBuilder(GitHubConfig config, GitHubLogger logger, File cacheDir, BuildInvoker invoker) -
Method Summary
-
Constructor Details
-
SourceBuilder
- Parameters:
config- the access token and auth/cli/resilience settings used to clone/pull each checkout.logger- receives diagnostic output.cacheDir- the directory built jars are cached under, keyed by owner, repo, and resolved commit.invoker- runs the actual build against a checkout; injected so it can be stubbed in tests.
-
-
Method Details
-
buildFromGit
- Parameters:
cloneUrl- the exact URL to clone from; any git host, not just github.com.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.
-
buildFromSource
public File buildFromSource(String cloneUrl, String owner, String repo, String branch, String commitSha) throws IOException - Parameters:
cloneUrl- the exact URL to clone from; any git host, not just github.com.owner- an identity for the repository, used only for the checkout/cache directory and jar naming, never for URL construction.repo- an identity for the repository, used only for the checkout/cache directory and jar naming, never for URL construction.branch- the branch to clone or pull, or null for the current/default branch.commitSha- the commit to check out, 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.
-