diff --git a/src/sbt-test/sbt-one-log/multi/build.sbt b/src/sbt-test/sbt-one-log/multi/build.sbt index e63322b..2c8ab84 100644 --- a/src/sbt-test/sbt-one-log/multi/build.sbt +++ b/src/sbt-test/sbt-one-log/multi/build.sbt @@ -1,5 +1,3 @@ -import java.io.File - val expected = Set[String]( "org.slf4j:log4j-over-slf4j:1.7.7" ,"org.slf4j:jcl-over-slf4j:1.7.7" @@ -33,29 +31,9 @@ TaskKey[Unit]("check") <<= (allDeps) map { deps => () } -TaskKey[Unit]("deleteLogback") := { - val resourceDir = (resourceDirectory in Compile).value - val resourceDirInTest = (resourceDirectory in Test).value - val logbackXML = resourceDir / "logback.xml" - val logbackTestXML = resourceDirInTest / "logback-test.xml" - logbackXML.delete() - logbackTestXML.delete() -} - -TaskKey[Unit]("checkLogback") := { - val resourceDir = (resourceDirectory in Compile).value - val resourceDirInTest = (resourceDirectory in Test).value - val logbackXML = resourceDir / "logback.xml" - val logbackTestXML = resourceDirInTest / "logback-test.xml" - if(!logbackXML.exists()) error(s"$logbackXML is not generated") - if(!logbackTestXML.exists()) error(s"$logbackTestXML is not generated") -} - val allDeps = taskKey[Seq[ModuleID]]("get all dependency with transivate modueID") allDeps <<= (externalDependencyClasspath in Compile) map { - cp => - cp.flatMap(_.get(Keys.moduleID.key)) + cp => + cp.flatMap(_.get(Keys.moduleID.key)) } - -net.virtualvoid.sbt.graph.Plugin.graphSettings diff --git a/src/sbt-test/sbt-one-log/multi/module1/build.sbt b/src/sbt-test/sbt-one-log/multi/module1/build.sbt new file mode 100644 index 0000000..2c8ab84 --- /dev/null +++ b/src/sbt-test/sbt-one-log/multi/module1/build.sbt @@ -0,0 +1,39 @@ +val expected = Set[String]( + "org.slf4j:log4j-over-slf4j:1.7.7" + ,"org.slf4j:jcl-over-slf4j:1.7.7" + ,"org.slf4j:jul-to-slf4j:1.7.7" + ,"org.slf4j:slf4j-api:1.7.7" + ,"ch.qos.logback:logback-classic:1.1.2" + ,"ch.qos.logback:logback-core:1.1.2" + ,"commons-logging:commons-logging:99-empty" + ,"commons-logging:commons-logging-api:99-empty" + ,"log4j:log4j:99-empty" + ,"com.typesafe.scala-logging:scala-logging-api_2.10:2.1.2" + ,"com.typesafe.scala-logging:scala-logging-slf4j_2.10:2.1.2" +) + +val excluded = Set[(String,String)]( + "org.slf4j" -> "slf4j-log4j12", + "org.slf4j" -> "slf4j-jcl", + "org.slf4j" -> "slf4j-jdk14" +) + +TaskKey[Unit]("check") <<= (allDeps) map { deps => + val all = deps.map(_.toString).toSet + expected.foreach{ ept => + if(!all.contains(ept)) error(s"libraryDependencies [$ept] error!") + } + //if(!expected.subsetOf(deps.map(_.toString).toSet)) + // error("libraryDependencies error!") + deps.map(d => (d.organization,d.name)).foreach{ d => + if(excluded.contains(d)) error(s"excludeDependencies [$d] error!") + } + () +} + +val allDeps = taskKey[Seq[ModuleID]]("get all dependency with transivate modueID") + +allDeps <<= (externalDependencyClasspath in Compile) map { + cp => + cp.flatMap(_.get(Keys.moduleID.key)) +} diff --git a/src/sbt-test/sbt-one-log/multi/module2/build.sbt b/src/sbt-test/sbt-one-log/multi/module2/build.sbt new file mode 100644 index 0000000..e67cffe --- /dev/null +++ b/src/sbt-test/sbt-one-log/multi/module2/build.sbt @@ -0,0 +1,37 @@ +val expected = Set[String]( + "org.slf4j:jcl-over-slf4j:1.7.7" + ,"org.slf4j:jul-to-slf4j:1.7.7" + ,"org.slf4j:slf4j-api:1.7.7" + ,"ch.qos.logback:logback-classic:1.1.2" + ,"ch.qos.logback:logback-core:1.1.2" + ,"commons-logging:commons-logging:99-empty" + ,"commons-logging:commons-logging-api:99-empty" + ,"com.typesafe.scala-logging:scala-logging-api_2.10:2.1.2" + ,"com.typesafe.scala-logging:scala-logging-slf4j_2.10:2.1.2" +) + +val excluded = Set[(String,String)]( + "org.slf4j" -> "slf4j-log4j12", + "org.slf4j" -> "slf4j-jcl", + "org.slf4j" -> "slf4j-jdk14" +) + +TaskKey[Unit]("check") <<= (allDeps) map { deps => + val all = deps.map(_.toString).toSet + expected.foreach{ ept => + if(!all.contains(ept)) error(s"libraryDependencies [$ept] error!") + } + //if(!expected.subsetOf(deps.map(_.toString).toSet)) + // error("libraryDependencies error!") + deps.map(d => (d.organization,d.name)).foreach{ d => + if(excluded.contains(d)) error(s"excludeDependencies [$d] error!") + } + () +} + +val allDeps = taskKey[Seq[ModuleID]]("get all dependency with transivate modueID") + +allDeps <<= (externalDependencyClasspath in Compile) map { + cp => + cp.flatMap(_.get(Keys.moduleID.key)) +} diff --git a/src/sbt-test/sbt-one-log/multi/module3/build.sbt b/src/sbt-test/sbt-one-log/multi/module3/build.sbt new file mode 100644 index 0000000..1f34581 --- /dev/null +++ b/src/sbt-test/sbt-one-log/multi/module3/build.sbt @@ -0,0 +1,36 @@ +val expected = Set[String]( + "org.slf4j:log4j-over-slf4j:1.7.7" + ,"org.slf4j:jul-to-slf4j:1.7.7" + ,"org.slf4j:slf4j-api:1.7.7" + ,"ch.qos.logback:logback-classic:1.1.2" + ,"ch.qos.logback:logback-core:1.1.2" + ,"log4j:log4j:99-empty" + ,"com.typesafe.scala-logging:scala-logging-api_2.10:2.1.2" + ,"com.typesafe.scala-logging:scala-logging-slf4j_2.10:2.1.2" +) + +val excluded = Set[(String,String)]( + "org.slf4j" -> "slf4j-log4j12", + "org.slf4j" -> "slf4j-jcl", + "org.slf4j" -> "slf4j-jdk14" +) + +TaskKey[Unit]("check") <<= (allDeps) map { deps => + val all = deps.map(_.toString).toSet + expected.foreach{ ept => + if(!all.contains(ept)) error(s"libraryDependencies [$ept] error!") + } + //if(!expected.subsetOf(deps.map(_.toString).toSet)) + // error("libraryDependencies error!") + deps.map(d => (d.organization,d.name)).foreach{ d => + if(excluded.contains(d)) error(s"excludeDependencies [$d] error!") + } + () +} + +val allDeps = taskKey[Seq[ModuleID]]("get all dependency with transivate modueID") + +allDeps <<= (externalDependencyClasspath in Compile) map { + cp => + cp.flatMap(_.get(Keys.moduleID.key)) +} diff --git a/src/sbt-test/sbt-one-log/multi/test b/src/sbt-test/sbt-one-log/multi/test index 15675b1..20813b8 100644 --- a/src/sbt-test/sbt-one-log/multi/test +++ b/src/sbt-test/sbt-one-log/multi/test @@ -1 +1,7 @@ > check +> project module1 +> check +> project module2 +> check +> project module3 +> check diff --git a/src/sbt-test/sbt-one-log/simple/test b/src/sbt-test/sbt-one-log/simple/test index 9463f54..54ebd60 100644 --- a/src/sbt-test/sbt-one-log/simple/test +++ b/src/sbt-test/sbt-one-log/simple/test @@ -1,6 +1,6 @@ > check > deleteLogback -> generateLogbackXML -> test:generateLogbackXML +> generateLogbackXml +> test:generateLogbackXml > checkLogback diff --git a/version.sbt b/version.sbt index 6243c9f..3265844 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -version in ThisBuild := "1.0-SNAPSHOT" +version in ThisBuild := "1.0.0"