mirror of https://github.com/sbt/sbt.git
More cleanup of Scala version handling, including managedScalaInstance to control automatic 'scala-tool' configuration and dependencies.
This commit is contained in:
parent
3f8a09a6c7
commit
469202aeec
|
|
@ -168,12 +168,13 @@ final class IvySbt(val configuration: IvyConfiguration)
|
|||
val md = PomModuleDescriptorParser.getInstance.parseDescriptor(settings, toURL(pc.file), pc.validate)
|
||||
val dmd = IvySbt.toDefaultModuleDescriptor(md)
|
||||
IvySbt.addConfigurations(dmd, Configurations.defaultInternal)
|
||||
for( is <- pc.ivyScala) {
|
||||
val confParser = new CustomXmlParser.CustomParser(settings, Some(Configurations.DefaultMavenConfiguration.name))
|
||||
val defaultConf = Configurations.DefaultMavenConfiguration.name
|
||||
for( is <- pc.ivyScala) if(pc.autoScalaTools) {
|
||||
val confParser = new CustomXmlParser.CustomParser(settings, Some(defaultConf))
|
||||
confParser.setMd(dmd)
|
||||
addScalaToolDependencies(dmd, confParser, is)
|
||||
}
|
||||
(dmd, "compile")
|
||||
(dmd, defaultConf)
|
||||
}
|
||||
/** Parses the Ivy file 'ivyFile' from the given `IvyFileConfiguration`.*/
|
||||
private def configureIvyFile(ifc: IvyFileConfiguration) =
|
||||
|
|
@ -183,7 +184,7 @@ final class IvySbt(val configuration: IvyConfiguration)
|
|||
parser.setSource(toURL(ifc.file))
|
||||
parser.parse()
|
||||
val dmd = IvySbt.toDefaultModuleDescriptor(parser.getModuleDescriptor())
|
||||
for( is <- ifc.ivyScala )
|
||||
for( is <- ifc.ivyScala ) if(ifc.autoScalaTools)
|
||||
addScalaToolDependencies(dmd, parser, is)
|
||||
(dmd, parser.getDefaultConf)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,11 +66,11 @@ sealed trait ModuleSettings
|
|||
def ivyScala: Option[IvyScala]
|
||||
def noScala: ModuleSettings
|
||||
}
|
||||
final case class IvyFileConfiguration(file: File, ivyScala: Option[IvyScala], validate: Boolean) extends ModuleSettings
|
||||
final case class IvyFileConfiguration(file: File, ivyScala: Option[IvyScala], validate: Boolean, autoScalaTools: Boolean = true) extends ModuleSettings
|
||||
{
|
||||
def noScala = copy(ivyScala = None)
|
||||
}
|
||||
final case class PomConfiguration(file: File, ivyScala: Option[IvyScala], validate: Boolean) extends ModuleSettings
|
||||
final case class PomConfiguration(file: File, ivyScala: Option[IvyScala], validate: Boolean, autoScalaTools: Boolean = true) extends ModuleSettings
|
||||
{
|
||||
def noScala = copy(ivyScala = None)
|
||||
}
|
||||
|
|
@ -107,12 +107,12 @@ object ModuleSettings
|
|||
log.debug("Autodetecting dependencies.")
|
||||
val defaultPOMFile = IvySbt.defaultPOM(baseDirectory)
|
||||
if(defaultPOMFile.canRead)
|
||||
new PomConfiguration(defaultPOMFile, ivyScala, validate)
|
||||
new PomConfiguration(defaultPOMFile, ivyScala, validate, true)
|
||||
else
|
||||
{
|
||||
val defaultIvy = IvySbt.defaultIvyFile(baseDirectory)
|
||||
if(defaultIvy.canRead)
|
||||
new IvyFileConfiguration(defaultIvy, ivyScala, validate)
|
||||
new IvyFileConfiguration(defaultIvy, ivyScala, validate, true)
|
||||
else
|
||||
{
|
||||
log.warn("No dependency configuration found, using defaults.")
|
||||
|
|
|
|||
|
|
@ -347,7 +347,7 @@ object Configurations
|
|||
def default: Seq[Configuration] = defaultMavenConfigurations
|
||||
def defaultMavenConfigurations: Seq[Configuration] = Seq(Compile, Runtime, Test, Provided, Optional)
|
||||
def defaultInternal: Seq[Configuration] = Seq(CompileInternal, RuntimeInternal, TestInternal)
|
||||
def auxiliary: Seq[Configuration] = Seq(Sources, Docs, Pom, ScalaTool)
|
||||
def auxiliary: Seq[Configuration] = Seq(Sources, Docs, Pom)
|
||||
def names(cs: Seq[Configuration]) = cs.map(_.name)
|
||||
|
||||
lazy val RuntimeInternal = optionalInternal(Runtime)
|
||||
|
|
|
|||
Loading…
Reference in New Issue