mirror of https://github.com/sbt/sbt.git
Fix 'dependency-management/configurations' test and properly implement defaultconfmapping
git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@1056 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
parent
32d293c794
commit
1cee3e8542
|
|
@ -77,7 +77,7 @@ object ManageDependencies
|
|||
Control.trap("Could not read Ivy file: ", log)
|
||||
{
|
||||
val url = toURL(ivyFile)
|
||||
val parser = new CustomXmlParser.CustomParser(settings)
|
||||
val parser = new CustomXmlParser.CustomParser(settings, None)
|
||||
parser.setValidate(flags.validate)
|
||||
parser.setSource(url)
|
||||
parser.parse()
|
||||
|
|
@ -90,9 +90,8 @@ object ManageDependencies
|
|||
def parseDependencies(xml: String, moduleID: DefaultModuleDescriptor, defaultConfiguration: String): Either[String, CustomXmlParser.CustomParser] =
|
||||
Control.trap("Could not read dependencies: ", log)
|
||||
{
|
||||
val parser = new CustomXmlParser.CustomParser(settings)
|
||||
val parser = new CustomXmlParser.CustomParser(settings, Some(defaultConfiguration))
|
||||
parser.setMd(moduleID)
|
||||
parser.setDefaultConf(defaultConfiguration)
|
||||
parser.setValidate(flags.validate)
|
||||
val resource = new ByteResource(xml.getBytes)
|
||||
parser.setInput(resource.openStream)
|
||||
|
|
@ -381,9 +380,8 @@ object ManageDependencies
|
|||
private def addLateDependencies(ivy: Ivy, md: ModuleDescriptor, defaultConfiguration: String, extraDependencies: Iterable[ModuleID]) =
|
||||
{
|
||||
val module = toDefaultModuleDescriptor(md)
|
||||
val parser = new CustomXmlParser.CustomParser(ivy.getSettings)
|
||||
val parser = new CustomXmlParser.CustomParser(ivy.getSettings, Some(defaultConfiguration))
|
||||
parser.setMd(module)
|
||||
parser.setDefaultConf(defaultConfiguration)
|
||||
addDependencies(module, extraDependencies, parser)
|
||||
module
|
||||
}
|
||||
|
|
@ -623,9 +621,9 @@ object ManageDependencies
|
|||
private object CustomXmlParser extends XmlModuleDescriptorParser with NotNull
|
||||
{
|
||||
import XmlModuleDescriptorParser.Parser
|
||||
class CustomParser(settings: IvySettings) extends Parser(CustomXmlParser, settings) with NotNull
|
||||
class CustomParser(settings: IvySettings, defaultConfig: Option[String]) extends Parser(CustomXmlParser, settings) with NotNull
|
||||
{
|
||||
setDefaultConfMapping("*->default(compile)")
|
||||
defaultConfig.foreach(x => setDefaultConfMapping("*->default(compile)"))
|
||||
|
||||
def setSource(url: URL) =
|
||||
{
|
||||
|
|
@ -635,9 +633,8 @@ object ManageDependencies
|
|||
/** Overridden because the super implementation overwrites the module descriptor.*/
|
||||
override def setResource(res: Resource) {}
|
||||
override def setMd(md: DefaultModuleDescriptor) = super.setMd(md)
|
||||
override def parseDepsConfs(confs: String, dd: DefaultDependencyDescriptor) = super.parseDepsConfs(confs, dd)
|
||||
override def getDefaultConf = super.getDefaultConf
|
||||
override def setDefaultConf(conf: String) = super.setDefaultConf(conf)
|
||||
override def parseDepsConfs(confs: String, dd: DefaultDependencyDescriptor): Unit = super.parseDepsConfs(confs, dd)
|
||||
override def getDefaultConf = defaultConfig.getOrElse(super.getDefaultConf)
|
||||
}
|
||||
}
|
||||
/** This code converts the given ModuleDescriptor to a DefaultModuleDescriptor by casting or generating an error.
|
||||
|
|
|
|||
|
|
@ -334,6 +334,8 @@ object Configurations
|
|||
|
||||
lazy val CompilerPlugin = config("plugin") hide
|
||||
|
||||
def allPredefined = Default :: IntegrationTest :: CompilerPlugin :: defaultMavenConfigurations
|
||||
|
||||
private[sbt] val DefaultMavenConfiguration = defaultConfiguration(true)
|
||||
private[sbt] val DefaultIvyConfiguration = defaultConfiguration(false)
|
||||
private[sbt] def DefaultConfiguration(mavenStyle: Boolean) = if(mavenStyle) DefaultMavenConfiguration else DefaultIvyConfiguration
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
object Published
|
||||
{
|
||||
val x = 3
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
|
||||
import sbt._
|
||||
|
||||
class TestUse(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)
|
||||
val published = "test" % "test-ivy" % "1.0"
|
||||
val publishedT = "test" % "test-ivy" % "1.0" % "test"
|
||||
val publishedR = "test" % "test-ivy" % "1.0" % "runtime"
|
||||
val mavenC = "test" % "test" % "1.0"
|
||||
val mavenT = "test" % "test" % "1.0" % "test"
|
||||
val mavenR = "test" % "test" % "1.0" % "runtime"
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
|
||||
import sbt._
|
||||
|
||||
class TestUseIvy(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def managedStyle = ManagedStyle.Ivy
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)
|
||||
val published = "test" % "test-ivy" % "1.0"
|
||||
val publishedT = "test" % "test-ivy" % "1.0" % "test"
|
||||
val publishedR = "test" % "test-ivy" % "1.0" % "runtime"
|
||||
|
||||
val mavenC = "test" % "test" % "1.0"
|
||||
val mavenT = "test" % "test" % "1.0" % "test"
|
||||
val mavenR = "test" % "test" % "1.0" % "runtime"
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.name=test-ivy
|
||||
project.organization=test
|
||||
project.version=1.0
|
||||
|
|
@ -3,5 +3,5 @@ import sbt._
|
|||
class TestPublish(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def managedStyle = ManagedStyle.Ivy
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)(Resolver.mavenStylePatterns)
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)(Patterns(false, Resolver.mavenStyleBasePattern))
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
import sbt._
|
||||
|
||||
class TestUse(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def managedStyle = ManagedStyle.Ivy
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)(Patterns(false, Resolver.mavenStyleBasePattern))
|
||||
val mavenC = "org.example" % "test-ivy" % "1.0"
|
||||
val mavenT = "org.example" % "test-ivy" % "1.0" % "test"
|
||||
val mavenR = "org.example" % "test-ivy" % "1.0" % "runtime"
|
||||
}
|
||||
|
|
@ -1,7 +1,3 @@
|
|||
object Use
|
||||
{
|
||||
def y = Published.x
|
||||
}
|
||||
object UseIvy
|
||||
{
|
||||
def yi = PublishedIvy.x
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=test-ivy
|
||||
project.organization=org.example
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object PublishedMaven
|
||||
{
|
||||
val x = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
|
||||
import sbt._
|
||||
|
||||
class TestUse(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)
|
||||
val mavenC = "org.example" % "test" % "1.0"
|
||||
val mavenT = "org.example" % "test" % "1.0" % "test"
|
||||
val mavenR = "org.example" % "test" % "1.0" % "runtime"
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object UseMaven
|
||||
{
|
||||
def y = PublishedMaven.x
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
project.name=test
|
||||
project.organization=test
|
||||
project.organization=org.example
|
||||
project.version=1.0
|
||||
|
|
@ -1,27 +1,16 @@
|
|||
# publish a jar with Published with managedStyle = ManagedStyle.Maven
|
||||
|
||||
$ copy-file changes/Published.scala src/main/scala/Published.scala [success]
|
||||
$ copy-file changes/maven/Published.scala src/main/scala/Published.scala [success]
|
||||
> publish
|
||||
[success]
|
||||
|
||||
|
||||
# publish a jar with PublishedIvy with managedStyle = ManagedStyle.Ivy
|
||||
|
||||
$ delete src project lib_managed [success]
|
||||
$ copy-file changes/ivy.build.properties project/build.properties [success]
|
||||
$ copy-file changes/TestPublishIvyStyle.scala project/build/TestPublish.scala [success]
|
||||
$ reload [success]
|
||||
$ copy-file changes/PublishedIvy.scala src/main/scala/PublishedIvy.scala [success]
|
||||
> publish
|
||||
[success]
|
||||
|
||||
# get and compile against each published jar with managedStyle = ManagedStyle.Maven
|
||||
|
||||
$ delete src project/build lib_managed [success]
|
||||
$ copy-file changes/TestUse.scala project/build/TestUse.scala [success]
|
||||
$ copy-file changes/build.properties project/build.properties [success]
|
||||
$ copy-file changes/maven/TestUse.scala project/build/TestUse.scala [success]
|
||||
$ copy-file changes/maven/use.build.properties project/build.properties [success]
|
||||
$ reload [success]
|
||||
$ copy-file changes/Use.scala src/main/scala/Use.scala [success]
|
||||
$ copy-file changes/maven/Use.scala src/main/scala/Use.scala [success]
|
||||
|
||||
> compile
|
||||
[failure]
|
||||
|
|
@ -30,15 +19,25 @@ $ copy-file changes/Use.scala src/main/scala/Use.scala [success]
|
|||
[success]
|
||||
> compile
|
||||
[success]
|
||||
$ delete src project lib_managed repo [success]
|
||||
|
||||
|
||||
# publish a jar with PublishedIvy with managedStyle = ManagedStyle.Ivy
|
||||
|
||||
$ copy-file changes/ivy/publish.build.properties project/build.properties [success]
|
||||
$ copy-file changes/ivy/TestPublish.scala project/build/TestPublish.scala [success]
|
||||
$ reload [success]
|
||||
$ copy-file changes/ivy/Published.scala src/main/scala/Published.scala [success]
|
||||
> publish
|
||||
[success]
|
||||
|
||||
# get and compile against each published jar with managedStyle = ManagedStyle.Ivy
|
||||
|
||||
$ delete src project/build lib_managed [success]
|
||||
$ copy-file changes/TestUseIvy.scala project/build/TestUseIvy.scala [success]
|
||||
$ copy-file changes/build.properties project/build.properties [success]
|
||||
$ delete src project lib_managed [success]
|
||||
$ copy-file changes/ivy/TestUse.scala project/build/TestUse.scala [success]
|
||||
$ copy-file changes/ivy/use.build.properties project/build.properties [success]
|
||||
$ reload [success]
|
||||
$ copy-file changes/Use.scala src/main/scala/Use.scala [success]
|
||||
$ copy-file changes/ivy/Use.scala src/main/scala/Use.scala [success]
|
||||
|
||||
> compile
|
||||
[failure]
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
# load the project definition with transitive dependencies enabled
|
||||
# and check that they are not downloaded
|
||||
|
||||
$ touch transitive
|
||||
[success]
|
||||
$ reload
|
||||
[success]
|
||||
$ touch transitive [success]
|
||||
$ reload [success]
|
||||
|
||||
> update
|
||||
[success]
|
||||
|
|
@ -18,10 +16,9 @@ $ reload
|
|||
# load the project definition with transitive dependencies disabled
|
||||
# and check that they are not downloaded
|
||||
|
||||
$ delete transitive
|
||||
[success]
|
||||
$ reload
|
||||
[success]
|
||||
$ delete ivy-cache
|
||||
$ delete transitive [success]
|
||||
$ reload [success]
|
||||
|
||||
> update
|
||||
[success]
|
||||
|
|
|
|||
Loading…
Reference in New Issue