mirror of https://github.com/sbt/sbt.git
No longer need "->default" in configurations (automatically mapped).
git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@1049 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
parent
feb7c0dc10
commit
9666c641d6
|
|
@ -383,8 +383,7 @@ object ManageDependencies
|
|||
val module = toDefaultModuleDescriptor(md)
|
||||
val parser = new CustomXmlParser.CustomParser(ivy.getSettings)
|
||||
parser.setMd(module)
|
||||
val defaultConf = if(defaultConfiguration.contains("->")) defaultConfiguration else (defaultConfiguration + "->default(compile)")
|
||||
parser.setDefaultConf(defaultConf)
|
||||
parser.setDefaultConf(defaultConfiguration)
|
||||
addDependencies(module, extraDependencies, parser)
|
||||
module
|
||||
}
|
||||
|
|
@ -626,6 +625,8 @@ object ManageDependencies
|
|||
import XmlModuleDescriptorParser.Parser
|
||||
class CustomParser(settings: IvySettings) extends Parser(CustomXmlParser, settings) with NotNull
|
||||
{
|
||||
setDefaultConfMapping("*->default(compile)")
|
||||
|
||||
def setSource(url: URL) =
|
||||
{
|
||||
super.setResource(new URLResource(url))
|
||||
|
|
|
|||
|
|
@ -253,7 +253,10 @@ object Resolver
|
|||
def apply(name: String): FileRepository = FileRepository(name, defaultFileConfiguration, ivyStylePatterns)
|
||||
/** Constructs a file resolver with the given name and base directory. */
|
||||
def apply(name: String, baseDirectory: File)(implicit basePatterns: Patterns): FileRepository =
|
||||
{
|
||||
if(baseDirectory.exists && !baseDirectory.isDirectory) error("Not a directory: " + baseDirectory.getAbsolutePath) else baseDirectory.mkdirs()
|
||||
baseRepository(baseDirectory.toURI)(FileRepository(name, defaultFileConfiguration, _))
|
||||
}
|
||||
}
|
||||
object url
|
||||
{
|
||||
|
|
@ -328,12 +331,7 @@ object Configurations
|
|||
private[sbt] val DefaultMavenConfiguration = defaultConfiguration(true)
|
||||
private[sbt] val DefaultIvyConfiguration = defaultConfiguration(false)
|
||||
private[sbt] def DefaultConfiguration(mavenStyle: Boolean) = if(mavenStyle) DefaultMavenConfiguration else DefaultIvyConfiguration
|
||||
private[sbt] def defaultConfiguration(mavenStyle: Boolean) =
|
||||
{
|
||||
val base = if(mavenStyle) Configurations.Compile else Configurations.Default
|
||||
config(base.name + "->default(compile)")
|
||||
}
|
||||
|
||||
private[sbt] def defaultConfiguration(mavenStyle: Boolean) = if(mavenStyle) Configurations.Compile else Configurations.Default
|
||||
private[sbt] def removeDuplicates(configs: Iterable[Configuration]) = Set(scala.collection.mutable.Map(configs.map(config => (config.name, config)).toSeq: _*).values.toList: _*)
|
||||
}
|
||||
/** Represents an Ivy configuration. */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
object Published
|
||||
{
|
||||
val x = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object PublishedIvy
|
||||
{
|
||||
val x = 4
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
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)
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
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"
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
|
||||
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"
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
object Use
|
||||
{
|
||||
def y = Published.x
|
||||
}
|
||||
object UseIvy
|
||||
{
|
||||
def yi = PublishedIvy.x
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=test-use
|
||||
project.organization=test
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=test-ivy
|
||||
project.organization=test
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=test-ivy-use
|
||||
project.organization=test
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=test
|
||||
project.organization=test
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import sbt._
|
||||
|
||||
class TestPublish(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def managedStyle = ManagedStyle.Maven // the default, but make it explicit
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
# publish a jar with Published with managedStyle = ManagedStyle.Maven
|
||||
|
||||
$ copy-file changes/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]
|
||||
$ reload [success]
|
||||
$ copy-file changes/Use.scala src/main/scala/Use.scala [success]
|
||||
|
||||
> compile
|
||||
[failure]
|
||||
|
||||
> update
|
||||
[success]
|
||||
> compile
|
||||
[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]
|
||||
$ reload [success]
|
||||
$ copy-file changes/Use.scala src/main/scala/Use.scala [success]
|
||||
|
||||
> compile
|
||||
[failure]
|
||||
|
||||
> update
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
Loading…
Reference in New Issue