Merge pull request #2172 from dwijnand/add-MavenRepository.localIfFile

Add localIfFile to MavenRepository, & use it.
This commit is contained in:
eugene yokota 2015-08-23 17:02:16 -04:00
commit 7bb08fe776
3 changed files with 18 additions and 3 deletions

View File

@ -120,7 +120,7 @@ private[sbt] object ConvertResolver {
}
}
val resolver = new PluginCapableResolver
resolver.setRepository(new LocalIfFileRepo)
if (repo.localIfFile) resolver.setRepository(new LocalIfFileRepo)
initializeMavenStyle(resolver, repo.name, repo.root)
resolver.setPatterns() // has to be done after initializeMavenStyle, which calls methods that overwrite the patterns
resolver

View File

@ -33,8 +33,10 @@ sealed case class ChainedResolver(name: String, resolvers: Seq[Resolver]) extend
/** An instance of a remote maven repository. Note: This will use Aether/Maven to resolve artifacts. */
sealed case class MavenRepository(name: String, root: String) extends Resolver {
override def toString = name + ": " + root
override def toString = s"$name: $root"
def isCache: Boolean = false
def localIfFile: Boolean = true
def withLocalIfFile(value: Boolean) = new MavenRepository(name, root) { override def localIfFile = value }
}
/**
@ -42,7 +44,7 @@ sealed case class MavenRepository(name: String, root: String) extends Resolver {
* the metadata is different (see Aether ML discussion).
*/
final class MavenCache(name: String, val rootFile: File) extends MavenRepository(name, rootFile.toURI.toURL.toString) {
override val toString = "cache:" + name + ": " + rootFile.getAbsolutePath
override val toString = s"cache:$name: ${rootFile.getAbsolutePath}"
override def isCache: Boolean = true
}
object MavenCache {

View File

@ -0,0 +1,13 @@
[@dwijnand]: http://github.com/dwijnand
[2172]: https://github.com/sbt/sbt/pull/2172
### Fixes with compatibility implications
### Improvements
- Adds localIfFile to MavenRepository, to force artifacts to be copied to the cache.
[#2172][2172] by [@dwijnand][@dwijnand]
### Bug fixes