Package org.savantbuild.dep
Class DefaultDependencyService
java.lang.Object
org.savantbuild.dep.DefaultDependencyService
- All Implemented Interfaces:
DependencyService
Default implementation of the dependency service.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.savantbuild.dep.DependencyService
DependencyService.TraversalRules -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildGraph(ReifiedArtifact project, Dependencies dependencies, Workflow workflow) Builds a dependency graph for the given dependencies of the given project.voidpublish(Publication publication, PublishWorkflow workflow) Publishes the given Publication (artifact, meta-data, source file, etc) with the given workflow.reduce(DependencyGraph graph) Reduces the DependencyGraph by ensuring that each dependency only has one version.resolve(ArtifactGraph graph, Workflow workflow, DependencyService.TraversalRules configuration, DependencyListener... listeners) Resolves the graph by downloading the artifacts.
-
Constructor Details
-
DefaultDependencyService
public DefaultDependencyService(org.savantbuild.output.Output output)
-
-
Method Details
-
buildGraph
public DependencyGraph buildGraph(ReifiedArtifact project, Dependencies dependencies, Workflow workflow) throws ArtifactMetaDataMissingException, ProcessFailureException, org.savantbuild.security.MD5Exception Builds a dependency graph for the given dependencies of the given project.- Specified by:
buildGraphin interfaceDependencyService- Parameters:
project- The artifact that represents the project.dependencies- The declared dependencies of the project.workflow- The workflow to use for downloading and caching the AMD files.- Returns:
- The dependency graph.
- Throws:
ArtifactMetaDataMissingException- If any artifacts AMD files could not be downloaded or found locally.ProcessFailureException- If a workflow process failed while fetching the meta-data.org.savantbuild.security.MD5Exception- If any MD5 files didn't match the AMD file when downloading.
-
publish
Publishes the given Publication (artifact, meta-data, source file, etc) with the given workflow.- Specified by:
publishin interfaceDependencyService- Parameters:
publication- The publication to publish.workflow- The workflow to publish with.- Throws:
PublishException- If the publication failed.
-
reduce
public ArtifactGraph reduce(DependencyGraph graph) throws CompatibilityException, org.savantbuild.util.CyclicException Reduces the DependencyGraph by ensuring that each dependency only has one version. This also prunes unused dependencies and ensures there are no compatibility issues in the graph.- Specified by:
reducein interfaceDependencyService- Parameters:
graph- The dependency graph.- Returns:
- The reduced graph.
- Throws:
CompatibilityException- If an dependency has incompatible versions.org.savantbuild.util.CyclicException- If the graph has a cycle in it.
-
resolve
public ResolvedArtifactGraph resolve(ArtifactGraph graph, Workflow workflow, DependencyService.TraversalRules configuration, DependencyListener... listeners) throws org.savantbuild.util.CyclicException, ArtifactMissingException, ProcessFailureException, org.savantbuild.security.MD5Exception, LicenseException Resolves the graph by downloading the artifacts. This will use the Workflow to download the artifacts in the graph. This does not check version compatibility. That is done in theDependencyService.reduce(DependencyGraph)method.- Specified by:
resolvein interfaceDependencyService- Parameters:
graph- The ArtifactGraph to resolve.workflow- The workflow used to resolve the artifacts.configuration- The traversal rules that are applied while traversing the graph during the reduction.listeners- Any listeners that want to receive callbacks when artifacts are resolved.- Returns:
- The resolved graph.
- Throws:
org.savantbuild.util.CyclicException- If any of the artifact graph has any cycles in it.ArtifactMissingException- If any of the required artifacts are missing.ProcessFailureException- If a workflow process failed while fetching an artifact or its source.org.savantbuild.security.MD5Exception- If the item's MD5 file did not match the item.LicenseException- If an invalid license is encountered during the resolution process.
-