diff --git a/sbt/src/sbt-test/dependency-management/force/build.sbt b/sbt/src/sbt-test/dependency-management/force/build.sbt new file mode 100755 index 000000000..3d49d87a9 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/force/build.sbt @@ -0,0 +1,21 @@ +lazy val root = (project in file(".")). + settings( + ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), + libraryDependencies <++= baseDirectory (libraryDeps), + TaskKey[Unit]("check-forced") <<= check("1.2.14"), + TaskKey[Unit]("check-depend") <<= check("1.2.13") + ) + +def libraryDeps(base: File) = { + val slf4j = Seq("org.slf4j" % "slf4j-log4j12" % "1.1.0") // Uses log4j 1.2.13 + if ((base / "force").exists) slf4j :+ ("log4j" % "log4j" % "1.2.14" force()) else slf4j +} + +def check(ver: String) = + (dependencyClasspath in Compile) map { jars => + val log4j = jars map (_.data) collect { + case f if f.getName contains "log4j-" => f.getName + } + if (log4j.size != 1 || !log4j.head.contains(ver)) + error("Did not download the correct jar.") + } diff --git a/sbt/src/sbt-test/dependency-management/force/project/TestProject.scala b/sbt/src/sbt-test/dependency-management/force/project/TestProject.scala deleted file mode 100755 index e914f17af..000000000 --- a/sbt/src/sbt-test/dependency-management/force/project/TestProject.scala +++ /dev/null @@ -1,27 +0,0 @@ -import sbt._ -import Import._ -import Keys._ - -object TestProject extends Build -{ - lazy val root = Project("root", file(".")) settings( - ivyPaths <<= (baseDirectory, target)( (dir, t) => new IvyPaths(dir, Some(t / "ivy-cache"))), - libraryDependencies <++= baseDirectory (libraryDeps), - TaskKey[Unit]("check-forced") <<= check("1.2.14"), - TaskKey[Unit]("check-depend") <<= check("1.2.13") - ) - - def libraryDeps(base: File) = { - val slf4j = Seq("org.slf4j" % "slf4j-log4j12" % "1.1.0") // Uses log4j 1.2.13 - if ((base / "force").exists) slf4j :+ ("log4j" % "log4j" % "1.2.14" force()) else slf4j - } - - def check(ver: String) = - (dependencyClasspath in Compile) map { jars => - val log4j = jars map (_.data) collect { - case f if f.getName contains "log4j-" => f.getName - } - if (log4j.size != 1 || !log4j.head.contains(ver)) - error("Did not download the correct jar.") - } -}