public class DefaultDependencyService extends java.lang.Object implements DependencyService
DependencyService.TraversalRules
Constructor and Description |
---|
DefaultDependencyService(org.savantbuild.output.Output output) |
Modifier and Type | Method and Description |
---|---|
DependencyGraph |
buildGraph(ReifiedArtifact project,
Dependencies dependencies,
Workflow workflow)
Builds a dependency graph for the given dependencies of the given project.
|
static java.nio.file.Path |
createTempPath(java.lang.String prefix,
java.lang.String suffix,
boolean deleteOnExit)
Creates a temporary file.
|
void |
publish(Publication publication,
PublishWorkflow workflow)
Publishes the given Publication (artifact, meta-data, source file, etc) with the given workflow.
|
ArtifactGraph |
reduce(DependencyGraph graph)
Reduces the DependencyGraph by ensuring that each dependency only has one version.
|
ResolvedArtifactGraph |
resolve(ArtifactGraph graph,
Workflow workflow,
DependencyService.TraversalRules configuration,
DependencyListener... listeners)
Resolves the graph by downloading the artifacts.
|
public DefaultDependencyService(org.savantbuild.output.Output output)
public static java.nio.file.Path createTempPath(java.lang.String prefix, java.lang.String suffix, boolean deleteOnExit) throws java.io.IOException
prefix
- The prefix for the temporary file.suffix
- The suffix for the temporary file.deleteOnExit
- If the file should be deleted when the JVM exits.java.io.IOException
- If the create fails.public DependencyGraph buildGraph(ReifiedArtifact project, Dependencies dependencies, Workflow workflow) throws ArtifactMetaDataMissingException, ProcessFailureException, org.savantbuild.security.MD5Exception
buildGraph
in interface DependencyService
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.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.public void publish(Publication publication, PublishWorkflow workflow) throws PublishException
publish
in interface DependencyService
publication
- The publication to publish.workflow
- The workflow to publish with.PublishException
- If the publication failed.public ArtifactGraph reduce(DependencyGraph graph) throws CompatibilityException, org.savantbuild.util.CyclicException
reduce
in interface DependencyService
graph
- The dependency graph.CompatibilityException
- If an dependency has incompatible versions.org.savantbuild.util.CyclicException
- If the graph has a cycle in it.public ResolvedArtifactGraph resolve(ArtifactGraph graph, Workflow workflow, DependencyService.TraversalRules configuration, DependencyListener... listeners) throws org.savantbuild.util.CyclicException, ArtifactMissingException, ProcessFailureException, org.savantbuild.security.MD5Exception, LicenseException
DependencyService.reduce(DependencyGraph)
method.resolve
in interface DependencyService
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.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.