mirror of https://github.com/sbt/sbt.git
Separate repositories for publishing from repositories for resolving/retrieving
This commit is contained in:
parent
0f3aa56295
commit
56d64c88cc
|
|
@ -58,7 +58,7 @@ final class IvySbt(configuration: IvyConfiguration)
|
||||||
case e: ExternalIvyConfiguration => is.load(e.file)
|
case e: ExternalIvyConfiguration => is.load(e.file)
|
||||||
case i: InlineIvyConfiguration =>
|
case i: InlineIvyConfiguration =>
|
||||||
IvySbt.configureCache(is, i.paths.cacheDirectory)
|
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)
|
IvySbt.setModuleConfigurations(is, i.moduleConfigurations)
|
||||||
}
|
}
|
||||||
is
|
is
|
||||||
|
|
@ -167,17 +167,26 @@ private object IvySbt
|
||||||
def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
|
def defaultIvyConfiguration(project: File) = new File(project, DefaultIvyConfigFilename)
|
||||||
def defaultPOM(project: File) = new File(project, DefaultMavenFilename)
|
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. */
|
/** 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)
|
* '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
|
val otherChain = resolverChain("sbt-other", other)
|
||||||
newDefault.setName("sbt-chain")
|
settings.addResolver(otherChain)
|
||||||
newDefault.setReturnFirst(true)
|
val newDefault = resolverChain("sbt-chain", resolvers)
|
||||||
newDefault.setCheckmodified(true)
|
|
||||||
resolvers.foreach(r => newDefault.add(ConvertResolver(r)))
|
|
||||||
settings.addResolver(newDefault)
|
settings.addResolver(newDefault)
|
||||||
settings.setDefaultResolver(newDefault.getName)
|
settings.setDefaultResolver(newDefault.getName)
|
||||||
log.debug("Using repositories:\n" + resolvers.mkString("\n\t"))
|
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])
|
private def setModuleConfigurations(settings: IvySettings, moduleConfigurations: Seq[ModuleConfiguration])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ object IvyCache
|
||||||
{
|
{
|
||||||
val local = Resolver.defaultLocal(None)
|
val local = Resolver.defaultLocal(None)
|
||||||
val paths = new IvyPaths(new File("."), 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)
|
(new IvySbt(conf), local)
|
||||||
}
|
}
|
||||||
/** Creates a default jar artifact based on the given ID.*/
|
/** Creates a default jar artifact based on the given ID.*/
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,12 @@ sealed trait IvyConfiguration extends NotNull
|
||||||
def log: IvyLogger
|
def log: IvyLogger
|
||||||
def withBase(newBaseDirectory: File): This
|
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
|
val moduleConfigurations: Seq[ModuleConfiguration], val lock: Option[xsbti.GlobalLock], val log: IvyLogger) extends IvyConfiguration
|
||||||
{
|
{
|
||||||
type This = InlineIvyConfiguration
|
type This = InlineIvyConfiguration
|
||||||
def baseDirectory = paths.baseDirectory
|
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
|
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)
|
if(defaultIvyConfigFile.canRead)
|
||||||
new ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log)
|
new ExternalIvyConfiguration(paths.baseDirectory, defaultIvyConfigFile, lock, log)
|
||||||
else
|
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