From 2c3db4e1ed46059736440e494fe400dcb2f50e9f Mon Sep 17 00:00:00 2001 From: Christopher Vogt Date: Thu, 22 Jun 2017 00:19:08 -0400 Subject: add basic support for maven version ranges --- test/simple/build/build.scala | 15 ++++++++------- test/test.scala | 29 +++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) (limited to 'test') diff --git a/test/simple/build/build.scala b/test/simple/build/build.scala index 3465ec3..66bee95 100644 --- a/test/simple/build/build.scala +++ b/test/simple/build/build.scala @@ -7,6 +7,9 @@ class Build(val context: cbt.Context) extends BaseBuild{ // FIXME: make the below less verbose Resolver( mavenCentral ).bind( ScalaDependency("com.typesafe.play", "play-json", "2.4.4"), + ScalaDependency("io.spray","spray-http","1.3.3"), + ScalaDependency( "com.lihaoyi", "scalatex-api", "0.3.6" ), + ScalaDependency( "com.lihaoyi", "scalatex-site", "0.3.6" ), 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"), @@ -16,15 +19,13 @@ class Build(val context: cbt.Context) extends BaseBuild{ MavenDependency("cc.factorie","factorie_2.11","1.2"), // test recursive substitution. see https://github.com/cvogt/cbt/issues/434 MavenDependency("com.amazonaws", "aws-java-sdk-s3", "1.11.86"), - // the dependency below uses a maven version range. Currently not supported. + // requires maven version ranges + MavenDependency("io.grpc", "grpc-netty", "1.2.0") + // the dependency below uses a maven version range with automatic minor version. Currently not supported. // TODO: put in a proper error message for version range not supported - //MavenDependency("com.github.nikita-volkov", "sext", "0.2.4") + // 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 - // currently fails, let's see if because of a bug - // io.spray:spray-http:1.3.3 - ScalaDependency( "com.lihaoyi", "scalatex-api", "0.3.6" ), - ScalaDependency( "com.lihaoyi", "scalatex-site", "0.3.6" ) + // ScalaDependency("org.apache.spark","spark-sql_2.11","1.6.1") ) ++ Resolver( mavenCentral, sonatypeReleases ).bind( "org.scalameta" %% "scalameta" % "1.1.0" diff --git a/test/test.scala b/test/test.scala index 55ce205..9cb7fd9 100644 --- a/test/test.scala +++ b/test/test.scala @@ -242,6 +242,35 @@ object Main{ ScaffoldTest.main(Array()) + Seq( + "1.0" -> "1.0", + "1.0-M1" -> "1.0-M1", + "1.0.0" -> "1.0.0", + "[1.0.0]" -> "1.0.0", + "[1.0.0)" -> "1.0.0", + "(1.0.0]" -> "1.0.0", + "(1.0.0)" -> "1.0.0", + "(,1.0.0]" -> "1.0.0", + "[,1.0.0]" -> "1.0.0", + "[,1.0.0)" -> "1.0.0", + "(,1.0.0)" -> "1.0.0", + "(1.0.0,]" -> "1.0.0", + "[1.0.0,]" -> "1.0.0", + "[1.0.0,)" -> "1.0.0", + "(1.0.0,)" -> "1.0.0", + "(1.0.0,1.0.1]" -> "1.0.0", + "[1.0.0,1.0.1]" -> "1.0.0", + "[1.0.0,1.0.1)" -> "1.0.0", + "(1.0.0,1.0.1)" -> "1.0.0" + ).foreach{ + case (input, expected) => + val actual = BoundMavenDependency.extractVersion(input) + assert( + expected === actual, + s"for $input expected $expected got $actual" + ) + } + usage("nothing") compile("nothing") //clean("nothing") -- cgit v1.2.3