ProjectResolver should throw an exception when called to retrieve dependency.

As suggested by @ezh, ref #770.
This commit is contained in:
Mark Harrah 2013-06-03 22:49:48 -04:00
parent 0051af6a48
commit d7e85f5877
1 changed files with 12 additions and 4 deletions

View File

@ -26,11 +26,12 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
override def toString = "ProjectResolver(" + name + ", mapped: " + map.keys.mkString(", ") + ")"
def getDependency(dd: DependencyDescriptor, data: ResolveData): ResolvedModuleRevision =
getDependency(dd.getDependencyRevisionId).orNull
private[this] def getDependency(revisionId: ModuleRevisionId): Option[ResolvedModuleRevision] =
{
val revisionId = dd.getDependencyRevisionId
def constructResult(descriptor: ModuleDescriptor) = new ResolvedModuleRevision(this, this, descriptor, report(revisionId), true)
val dep = (map get revisionId map constructResult).orNull
dep
map get revisionId map constructResult
}
def report(revisionId: ModuleRevisionId): MetadataArtifactDownloadReport =
@ -46,7 +47,14 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
def exists(artifact: IArtifact) = false
def locate(artifact: IArtifact) = null
def download(artifacts: Array[IArtifact], options: DownloadOptions): DownloadReport =
new DownloadReport
{
val r = new DownloadReport
for(artifact <- artifacts)
if(getDependency(artifact.getModuleRevisionId).isEmpty)
r.addArtifactReport(notDownloaded(artifact))
r
}
def download(artifact: ArtifactOrigin, options: DownloadOptions): ArtifactDownloadReport =
notDownloaded(artifact.getArtifact)
def findIvyFileRef(dd: DependencyDescriptor, data: ResolveData) = null