diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-03 00:09:19 -0400 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2016-04-03 00:09:26 -0400 |
commit | 83d6e39764103bde44d5812aa873ed7537cc8c97 (patch) | |
tree | 60a070ef1511aa525cec9bf4c19034804b829679 /test/test.scala | |
parent | 8eae49b7b0a39f23518680b56429314db3d977e1 (diff) | |
download | cbt-83d6e39764103bde44d5812aa873ed7537cc8c97.tar.gz cbt-83d6e39764103bde44d5812aa873ed7537cc8c97.tar.bz2 cbt-83d6e39764103bde44d5812aa873ed7537cc8c97.zip |
Implement alternative resolvers
This commit also
- requires Dependencies to explicitly implement canBeCached
- unifies some logic for dependency downloading
- moves SBT-like dependency DSL into its own trait
- error message showing build directory for exceptions in builds
Not splitting this up in favor of faster progress to 1.0.
The user facing API can probably be slightly improved using implicits
inside of BasicBuild, but we can do that later.
Diffstat (limited to 'test/test.scala')
-rw-r--r-- | test/test.scala | 53 |
1 files changed, 38 insertions, 15 deletions
diff --git a/test/test.scala b/test/test.scala index 811e619..2c4f391 100644 --- a/test/test.scala +++ b/test/test.scala @@ -1,12 +1,14 @@ import cbt._ import cbt.paths._ import scala.collection.immutable.Seq +import java.io.File // micro framework object Main{ def main(_args: Array[String]): Unit = { val args = new Stage1ArgsParser(_args.toVector) implicit val logger: Logger = new Logger(args.enabledLoggers) + val lib = new Lib(logger) var successes = 0 var failures = 0 @@ -69,19 +71,14 @@ object Main{ logger.test( "Running tests " ++ _args.toList.toString ) - usage("nothing") - compile("nothing") - usage("multi-build") - compile("multi-build") - usage("simple") - compile("simple") - { val noContext = Context(cbtHome ++ "/test/nothing", Seq(), logger, false, new ClassLoaderCache(logger)) val b = new Build(noContext){ override def dependencies = Seq( - JavaDependency("net.incongru.watchservice","barbary-watchservice","1.0"), - JavaDependency("net.incongru.watchservice","barbary-watchservice","1.0") + MavenRepository.central.resolve( + MavenDependency("net.incongru.watchservice","barbary-watchservice","1.0"), + MavenDependency("net.incongru.watchservice","barbary-watchservice","1.0") + ) ) } val cp = b.classpath @@ -90,22 +87,48 @@ object Main{ // test that messed up artifacts crash with an assertion (which should tell the user what's up) assertException[AssertionError](){ - JavaDependency("com.jcraft", "jsch", " 0.1.53").classpath + MavenRepository.central.resolveOne( MavenDependency("com.jcraft", "jsch", " 0.1.53") ).classpath } assertException[AssertionError](){ - JavaDependency("com.jcraft", null, "0.1.53").classpath + MavenRepository.central.resolveOne( MavenDependency("com.jcraft", null, "0.1.53") ).classpath } assertException[AssertionError](){ - JavaDependency("com.jcraft", "", " 0.1.53").classpath + MavenRepository.central.resolveOne( MavenDependency("com.jcraft", "", " 0.1.53") ).classpath } assertException[AssertionError](){ - JavaDependency("com.jcraft%", "jsch", " 0.1.53").classpath + MavenRepository.central.resolveOne( MavenDependency("com.jcraft%", "jsch", " 0.1.53") ).classpath } assertException[AssertionError](){ - JavaDependency("", "jsch", " 0.1.53").classpath + MavenRepository.central.resolveOne( MavenDependency("", "jsch", " 0.1.53") ).classpath } - + ( + MavenRepository.combine( + MavenRepository.central, MavenRepository.bintray("tpolecat") + ).resolve( + lib.ScalaDependency("org.tpolecat","tut-core","0.4.2", scalaMajorVersion="2.11") + ).classpath.strings + ++ + MavenRepository.sonatype.resolve( + MavenDependency("org.cvogt","play-json-extensions_2.11","0.8.0") + ).classpath.strings + ++ + MavenRepository.combine( + MavenRepository.central, MavenRepository.sonatypeSnapshots + ).resolve( + MavenDependency("ai.x","lens_2.11","1.0.0-SNAPSHOT") + ).classpath.strings + ).foreach{ + path => assert(new File(path).exists, path) + } + + usage("nothing") + compile("nothing") + usage("multi-build") + compile("multi-build") + usage("simple") + compile("simple") + System.err.println(" DONE!") System.err.println( successes.toString ++ " succeeded, "++ failures.toString ++ " failed" ) if(failures > 0) System.exit(1) else System.exit(0) |