mirror of https://github.com/sbt/sbt.git
Separate repositories for publishing from repositories for resolving/retrieving
This commit is contained in:
parent
d9ad37894e
commit
a8bc831189
|
|
@ -58,7 +58,7 @@ final class IvySbt(configuration: IvyConfiguration)
|
|||
case e: ExternalIvyConfiguration => is.load(e.file)
|
||||
case i: InlineIvyConfiguration =>
|
||||
IvySbt.configureCache(is, i.paths.cacheDirectory)
|
||||
IvySbt.setResolvers(is, i.resolvers, log)
|
||||
IvySbt.setResolvers(is, i.resolvers, i.otherResolvers, log)
|
||||
IvySbt.setModuleConfigurations(is, i.moduleConfigurations)
|
||||
}
|
||||
is
|
||||
|
|
@ -167,17 +167,26 @@ private object IvySbt
|
|||
def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
|
||||
def defaultPOM(project: File) = new File(project, DefaultMavenFilename)
|
||||
|
||||
/** Sets the resolvers for 'settings' to 'resolvers'. This is done by creating a new chain and making it the default. */
|
||||
private def setResolvers(settings: IvySettings, resolvers: Seq[Resolver], log: IvyLogger)
|
||||
/** Sets the resolvers for 'settings' to 'resolvers'. This is done by creating a new chain and making it the default.
|
||||
* 'other' is for resolvers that should be in a different chain. These are typically used for publishing or other actions. */
|
||||
private def setResolvers(settings: IvySettings, resolvers: Seq[Resolver], other: Seq[Resolver], log: IvyLogger)
|
||||
{
|
||||
val newDefault = new ChainResolver
|
||||
newDefault.setName("sbt-chain")
|
||||
newDefault.setReturnFirst(true)
|
||||
newDefault.setCheckmodified(true)
|
||||
resolvers.foreach(r => newDefault.add(ConvertResolver(r)))
|
||||
val otherChain = resolverChain("sbt-other", other)
|
||||
settings.addResolver(otherChain)
|
||||
val newDefault = resolverChain("sbt-chain", resolvers)
|
||||
settings.addResolver(newDefault)
|
||||
settings.setDefaultResolver(newDefault.getName)
|
||||
log.debug("Using repositories:\n" + resolvers.mkString("\n\t"))
|
||||
log.debug("Using other repositories:\n" + other.mkString("\n\t"))
|
||||
}
|
||||
private def resolverChain(name: String, resolvers: Seq[Resolver]): ChainResolver =
|
||||
{
|
||||
val newDefault = new ChainResolver
|
||||
newDefault.setName(name)
|
||||
newDefault.setReturnFirst(true)
|
||||
newDefault.setCheckmodified(true)
|
||||
resolvers.foreach(r => newDefault.add(ConvertResolver(r)))
|
||||
newDefault
|
||||
}
|
||||
private def setModuleConfigurations(settings: IvySettings, moduleConfigurations: Seq[ModuleConfiguration])
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ object IvyCache
|
|||
{
|
||||
val local = Resolver.defaultLocal(None)
|
||||
val paths = new IvyPaths(new File("."), None)
|
||||
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, lock, log)
|
||||
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, lock, log)
|
||||
(new IvySbt(conf), local)
|
||||
}
|
||||
/** Creates a default jar artifact based on the given ID.*/
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ sealed trait IvyConfiguration extends NotNull
|
|||
def log: IvyLogger
|
||||
def withBase(newBaseDirectory: File): This
|
||||
}
|
||||
final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver],
|
||||
final class InlineIvyConfiguration(val paths: IvyPaths, val resolvers: Seq[Resolver], val otherResolvers: Seq[Resolver],
|
||||
val moduleConfigurations: Seq[ModuleConfiguration], val lock: Option[xsbti.GlobalLock], val log: IvyLogger) extends IvyConfiguration
|
||||
{
|
||||
type This = InlineIvyConfiguration
|
||||
def baseDirectory = paths.baseDirectory
|
||||
def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, moduleConfigurations, lock, log)
|
||||
def withBase(newBase: File) = new InlineIvyConfiguration(paths.withBase(newBase), resolvers, otherResolvers, moduleConfigurations, lock, log)
|
||||
}
|
||||
final class ExternalIvyConfiguration(val baseDirectory: File, val file: File, val lock: Option[xsbti.GlobalLock], val log: IvyLogger) extends IvyConfiguration
|
||||
{
|
||||
|
|
@ -42,7 +42,7 @@ object IvyConfiguration
|
|||
if(defaultIvyConfigFile.canRead)
|
||||
new ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log)
|
||||
else
|
||||
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, lock, log)
|
||||
new InlineIvyConfiguration(paths, Resolver.withDefaultResolvers(Nil), Nil, Nil, lock, log)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue