aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2016-05-03 00:45:50 +0300
committerChristopher Vogt <oss.nsp@cvogt.org>2016-05-03 10:27:23 +0300
commit323dd568b61a49c0ac17dbf3ad50098e82c2989b (patch)
treef67f5f259ff73f4c3a516310bc1d8e342eb56e98 /test
parentaf207e272664720b77b376214292b0c5716fc20b (diff)
downloadcbt-323dd568b61a49c0ac17dbf3ad50098e82c2989b.tar.gz
cbt-323dd568b61a49c0ac17dbf3ad50098e82c2989b.tar.bz2
cbt-323dd568b61a49c0ac17dbf3ad50098e82c2989b.zip
Convenience factory methods for Resolvers
Diffstat (limited to 'test')
-rw-r--r--test/simple/build/build.scala54
-rw-r--r--test/test.scala40
2 files changed, 47 insertions, 47 deletions
diff --git a/test/simple/build/build.scala b/test/simple/build/build.scala
index ab901e9..b5955c9 100644
--- a/test/simple/build/build.scala
+++ b/test/simple/build/build.scala
@@ -7,34 +7,32 @@ class Build(context: cbt.Context) extends BasicBuild(context){
super.dependencies
++
Seq(
- GitDependency("https://github.com/xdotai/diff.git", "698717469b8dd86e8570b86354892be9c0654caf"),
- // FIXME: make the below less verbose
- MavenResolver(context.cbtHasChanged,context.paths.mavenCache,MavenResolver.central).resolve(
- ScalaDependency("com.typesafe.play", "play-json", "2.4.4"),
- MavenDependency("joda-time", "joda-time", "2.9.2"),
- // the below tests pom inheritance with dependencyManagement and variable substitution for pom properties
- MavenDependency("org.eclipse.jgit", "org.eclipse.jgit", "4.2.0.201601211800-r"),
- // the below tests pom inheritance with variable substitution for pom xml tag contents
- MavenDependency("com.spotify", "missinglink-core", "0.1.1"),
- // the below tests pom inheritance with variable substitution being parts of strings
- MavenDependency("cc.factorie","factorie_2.11","1.2")
- // the dependency below uses a maven version range. Currently not supported.
- // TODO: put in a proper error message for version range not supported
- //MavenDependency("com.github.nikita-volkov", "sext", "0.2.4")
- // currently breaks with can't find https://repo1.maven.org/maven2/org/apache/avro/avro-mapred/1.7.7/avro-mapred-1.7.7-hadoop2.pom.sha1
- // org.apache.spark:spark-sql_2.11:1.6.1
- ),
- MavenResolver(
- context.cbtHasChanged,
- context.paths.mavenCache,
- MavenResolver.central,
- MavenResolver.bintray("tpolecat"),
- MavenResolver.sonatypeSnapshots
- ).resolve(
- "org.cvogt" %% "play-json-extensions" % "0.8.0",
- "org.tpolecat" %% "tut-core" % "0.4.2",
- "ai.x" %% "lens" % "1.0.0-SNAPSHOT"
- )
+ GitDependency("https://github.com/xdotai/diff.git", "698717469b8dd86e8570b86354892be9c0654caf")
+ ) ++
+ // FIXME: make the below less verbose
+ Resolver( mavenCentral ).bind(
+ ScalaDependency("com.typesafe.play", "play-json", "2.4.4"),
+ MavenDependency("joda-time", "joda-time", "2.9.2"),
+ // the below tests pom inheritance with dependencyManagement and variable substitution for pom properties
+ MavenDependency("org.eclipse.jgit", "org.eclipse.jgit", "4.2.0.201601211800-r"),
+ // the below tests pom inheritance with variable substitution for pom xml tag contents
+ MavenDependency("com.spotify", "missinglink-core", "0.1.1"),
+ // the below tests pom inheritance with variable substitution being parts of strings
+ MavenDependency("cc.factorie","factorie_2.11","1.2")
+ // the dependency below uses a maven version range. Currently not supported.
+ // TODO: put in a proper error message for version range not supported
+ //MavenDependency("com.github.nikita-volkov", "sext", "0.2.4")
+ // currently breaks with can't find https://repo1.maven.org/maven2/org/apache/avro/avro-mapred/1.7.7/avro-mapred-1.7.7-hadoop2.pom.sha1
+ // org.apache.spark:spark-sql_2.11:1.6.1
+ ) ++
+ Resolver(
+ mavenCentral,
+ bintray("tpolecat"),
+ sonatypeSnapshots
+ ).bind(
+ "org.cvogt" %% "play-json-extensions" % "0.8.0",
+ "org.tpolecat" %% "tut-core" % "0.4.2",
+ "ai.x" %% "lens" % "1.0.0-SNAPSHOT"
)
)
}
diff --git a/test/test.scala b/test/test.scala
index bebd143..b425cfa 100644
--- a/test/test.scala
+++ b/test/test.scala
@@ -2,6 +2,7 @@ import cbt._
import scala.collection.immutable.Seq
import java.util.concurrent.ConcurrentHashMap
import java.io.File
+import java.net.URL
// micro framework
object Main{
@@ -76,7 +77,7 @@ object Main{
val cache = cbtHome ++ "/cache"
val mavenCache = cache ++ "/maven"
val cbtHasChanged = true
- val mavenCentral = MavenResolver(cbtHasChanged, mavenCache, MavenResolver.central)
+ def Resolver(urls: URL*) = MavenResolver(cbtHasChanged, mavenCache, urls: _*)
{
val noContext = ContextImplementation(
@@ -97,12 +98,11 @@ object Main{
)
val b = new BasicBuild(noContext){
- override def dependencies = Seq(
- mavenCentral.resolve(
+ override def dependencies =
+ Resolver(mavenCentral).bind(
MavenDependency("net.incongru.watchservice","barbary-watchservice","1.0"),
MavenDependency("net.incongru.watchservice","barbary-watchservice","1.0")
)
- )
}
val cp = b.classpath
assert(cp.strings.distinct == cp.strings, "duplicates in classpath: " ++ cp.string)
@@ -110,36 +110,38 @@ object Main{
// test that messed up artifacts crash with an assertion (which should tell the user what's up)
assertException[AssertionError](){
- mavenCentral.resolveOne( MavenDependency("com.jcraft", "jsch", " 0.1.53") ).classpath
+ Resolver(mavenCentral).bindOne( MavenDependency("com.jcraft", "jsch", " 0.1.53") ).classpath
}
assertException[AssertionError](){
- mavenCentral.resolveOne( MavenDependency("com.jcraft", null, "0.1.53") ).classpath
+ Resolver(mavenCentral).bindOne( MavenDependency("com.jcraft", null, "0.1.53") ).classpath
}
assertException[AssertionError](){
- mavenCentral.resolveOne( MavenDependency("com.jcraft", "", " 0.1.53") ).classpath
+ Resolver(mavenCentral).bindOne( MavenDependency("com.jcraft", "", " 0.1.53") ).classpath
}
assertException[AssertionError](){
- mavenCentral.resolveOne( MavenDependency("com.jcraft%", "jsch", " 0.1.53") ).classpath
+ Resolver(mavenCentral).bindOne( MavenDependency("com.jcraft%", "jsch", " 0.1.53") ).classpath
}
assertException[AssertionError](){
- mavenCentral.resolveOne( MavenDependency("", "jsch", " 0.1.53") ).classpath
+ Resolver(mavenCentral).bindOne( MavenDependency("", "jsch", " 0.1.53") ).classpath
}
(
- MavenResolver(
- cbtHasChanged, mavenCache, MavenResolver.central, MavenResolver.bintray("tpolecat")
- ).resolve(
- lib.ScalaDependency("org.tpolecat","tut-core","0.4.2", scalaMajorVersion="2.11")
+ Dependencies(
+ Resolver( mavenCentral, bintray("tpolecat") ).bind(
+ lib.ScalaDependency("org.tpolecat","tut-core","0.4.2", scalaMajorVersion="2.11")
+ )
).classpath.strings
++
- MavenResolver(cbtHasChanged, mavenCache,MavenResolver.sonatype).resolve(
+ Dependencies(
+ Resolver(sonatypeReleases).bind(
MavenDependency("org.cvogt","play-json-extensions_2.11","0.8.0")
- ).classpath.strings
+ )
+ ).classpath.strings
++
- MavenResolver(
- cbtHasChanged, mavenCache, MavenResolver.central, MavenResolver.sonatypeSnapshots
- ).resolve(
- MavenDependency("ai.x","lens_2.11","1.0.0-SNAPSHOT")
+ Dependencies(
+ Resolver( mavenCentral, sonatypeSnapshots ).bind(
+ MavenDependency("ai.x","lens_2.11","1.0.0-SNAPSHOT")
+ )
).classpath.strings
).foreach{
path => assert(new File(path).exists, path)