mirror of https://github.com/sbt/sbt.git
Hack to avoid Ivy checking for sources/javadocs for every module
This commit is contained in:
parent
3e29126cbf
commit
4328d7d1f1
|
|
@ -21,7 +21,7 @@ import plugins.conflict.{ConflictManager, LatestConflictManager}
|
|||
import plugins.latest.LatestRevisionStrategy
|
||||
import plugins.matcher.PatternMatcher
|
||||
import plugins.parser.m2.PomModuleDescriptorParser
|
||||
import plugins.resolver.ChainResolver
|
||||
import plugins.resolver.{ChainResolver, DependencyResolver}
|
||||
import util.{Message, MessageLogger}
|
||||
|
||||
import scala.xml.NodeSeq
|
||||
|
|
@ -203,9 +203,15 @@ private object IvySbt
|
|||
val mainChain = makeChain("Default", "sbt-chain", resolvers)
|
||||
settings.setDefaultResolver(mainChain.getName)
|
||||
}
|
||||
private def resolverChain(name: String, resolvers: Seq[Resolver], localOnly: Boolean, settings: IvySettings, log: Logger): ChainResolver =
|
||||
private def resolverChain(name: String, resolvers: Seq[Resolver], localOnly: Boolean, settings: IvySettings, log: Logger): DependencyResolver =
|
||||
{
|
||||
val newDefault = new ChainResolver
|
||||
val newDefault = new ChainResolver {
|
||||
// Technically, this should be applied to module configurations.
|
||||
// That would require custom subclasses of all resolver types in ConvertResolver (a delegation approach does not work).
|
||||
// It would be better to get proper support into Ivy.
|
||||
override def locate(artifact: IArtifact) =
|
||||
if(hasImplicitClassifier(artifact)) null else super.locate(artifact)
|
||||
}
|
||||
newDefault.setName(name)
|
||||
newDefault.setReturnFirst(true)
|
||||
newDefault.setCheckmodified(false)
|
||||
|
|
@ -215,6 +221,14 @@ private object IvySbt
|
|||
}
|
||||
newDefault
|
||||
}
|
||||
/** A hack to detect if the given artifact is an automatically generated request for a classifier,
|
||||
* as opposed to a user-initiated declaration. It relies on Ivy prefixing classifier with m:, while sbt uses e:.
|
||||
* Clearly, it would be better to have an explicit option in Ivy to control this.*/
|
||||
def hasImplicitClassifier(artifact: IArtifact): Boolean =
|
||||
{
|
||||
import collection.JavaConversions._
|
||||
artifact.getQualifiedExtraAttributes.keys.exists(_.asInstanceOf[String] startsWith "m:")
|
||||
}
|
||||
private def setModuleConfigurations(settings: IvySettings, moduleConfigurations: Seq[ModuleConfiguration])
|
||||
{
|
||||
val existing = settings.getResolverNames
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import core.cache.DefaultRepositoryCacheManager
|
|||
import core.event.EventManager
|
||||
import core.module.id.{ArtifactId, ModuleId, ModuleRevisionId}
|
||||
import core.module.descriptor.{Configuration => IvyConfiguration, DefaultDependencyArtifactDescriptor, DefaultDependencyDescriptor, DefaultModuleDescriptor, ModuleDescriptor}
|
||||
import core.module.descriptor.{DefaultExcludeRule, ExcludeRule}
|
||||
import core.module.descriptor.{Artifact => IArtifact, DefaultExcludeRule, ExcludeRule}
|
||||
import core.report.ResolveReport
|
||||
import core.resolve.{ResolveEngine, ResolveOptions}
|
||||
import core.retrieve.{RetrieveEngine, RetrieveOptions}
|
||||
|
|
@ -195,7 +195,10 @@ final class Update(config: UpdateConfiguration)
|
|||
/** Add the scala tools repositories and a URL resolver to download sbt from the Google code project.*/
|
||||
private def addResolvers(settings: IvySettings)
|
||||
{
|
||||
val newDefault = new ChainResolver
|
||||
val newDefault = new ChainResolver {
|
||||
override def locate(artifact: IArtifact) =
|
||||
if(hasImplicitClassifier(artifact)) null else super.locate(artifact)
|
||||
}
|
||||
newDefault.setName("redefined-public")
|
||||
if(repositories.isEmpty) error("No repositories defined.")
|
||||
for(repo <- repositories if includeRepo(repo))
|
||||
|
|
@ -204,6 +207,12 @@ final class Update(config: UpdateConfiguration)
|
|||
settings.addResolver(newDefault)
|
||||
settings.setDefaultResolver(newDefault.getName)
|
||||
}
|
||||
// infrastructure is needed to avoid duplication between this class and the ivy/ subproject
|
||||
private def hasImplicitClassifier(artifact: IArtifact): Boolean =
|
||||
{
|
||||
import collection.JavaConversions._
|
||||
artifact.getQualifiedExtraAttributes.keys.exists(_.asInstanceOf[String] startsWith "m:")
|
||||
}
|
||||
// exclude the local Maven repository for Scala -SNAPSHOTs
|
||||
private def includeRepo(repo: Repository) = !(Repository.isMavenLocal(repo) && isSnapshot(scalaVersion) )
|
||||
private def isSnapshot(scalaVersion: String) = scalaVersion.endsWith(Snapshot)
|
||||
|
|
|
|||
Loading…
Reference in New Issue