mirror of https://github.com/sbt/sbt.git
ProjectResolver should throw an exception when called to retrieve dependency.
As suggested by @ezh, ref #770.
This commit is contained in:
parent
0051af6a48
commit
d7e85f5877
|
|
@ -26,11 +26,12 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
|
||||||
override def toString = "ProjectResolver(" + name + ", mapped: " + map.keys.mkString(", ") + ")"
|
override def toString = "ProjectResolver(" + name + ", mapped: " + map.keys.mkString(", ") + ")"
|
||||||
|
|
||||||
def getDependency(dd: DependencyDescriptor, data: ResolveData): ResolvedModuleRevision =
|
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)
|
def constructResult(descriptor: ModuleDescriptor) = new ResolvedModuleRevision(this, this, descriptor, report(revisionId), true)
|
||||||
val dep = (map get revisionId map constructResult).orNull
|
map get revisionId map constructResult
|
||||||
dep
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def report(revisionId: ModuleRevisionId): MetadataArtifactDownloadReport =
|
def report(revisionId: ModuleRevisionId): MetadataArtifactDownloadReport =
|
||||||
|
|
@ -46,7 +47,14 @@ class ProjectResolver(name: String, map: Map[ModuleRevisionId, ModuleDescriptor]
|
||||||
def exists(artifact: IArtifact) = false
|
def exists(artifact: IArtifact) = false
|
||||||
def locate(artifact: IArtifact) = null
|
def locate(artifact: IArtifact) = null
|
||||||
def download(artifacts: Array[IArtifact], options: DownloadOptions): DownloadReport =
|
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 =
|
def download(artifact: ArtifactOrigin, options: DownloadOptions): ArtifactDownloadReport =
|
||||||
notDownloaded(artifact.getArtifact)
|
notDownloaded(artifact.getArtifact)
|
||||||
def findIvyFileRef(dd: DependencyDescriptor, data: ResolveData) = null
|
def findIvyFileRef(dd: DependencyDescriptor, data: ResolveData) = null
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue