Skip to content

Commit

Permalink
Merge pull request #260 from Atry/pr4
Browse files Browse the repository at this point in the history
Avoid libraryDependencies for internal dependencies
  • Loading branch information
Atry authored Jun 10, 2019
2 parents 0e94467 + bfdbd8b commit fafc6d2
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 88 deletions.
15 changes: 10 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ lazy val `domains-task` =
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}"""
)
.dependsOn(`keywords-Shift`,
`keywords-Each` % Test,
`keywords-Fork` % Test,
`keywords-Using` % Test,
`keywords-Yield` % Test,
Expand Down Expand Up @@ -60,7 +61,7 @@ lazy val `keywords-Continue` =
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""",
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}"""
)
.dependsOn(Dsl)
.dependsOn(Dsl, `keywords-Each` % Test)

lazy val `keywords-ContinueJS` = `keywords-Continue`.js
lazy val `keywords-ContinueJVM` = `keywords-Continue`.jvm
Expand Down Expand Up @@ -95,7 +96,7 @@ lazy val `keywords-AsynchronousIo` =
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""",
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}"""
)
.dependsOn(`keywords-Shift`, `comprehension` % Test)
.dependsOn(`keywords-Shift`, `keywords-Each` % Test, `keywords-Using` % Test, `comprehension` % Test, `domains-task` % Test)
lazy val `keywords-AsynchronousIoJS` = `keywords-AsynchronousIo`.js
lazy val `keywords-AsynchronousIoJVM` = `keywords-AsynchronousIo`.jvm

Expand Down Expand Up @@ -194,7 +195,7 @@ lazy val `keywords-ForEach` =
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""",
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}"""
)
.dependsOn(Dsl)
.dependsOn(Dsl, `keywords-Each` % Test)
lazy val `keywords-ForEachJS` = `keywords-ForEach`.js
lazy val `keywords-ForEachJVM` = `keywords-ForEach`.jvm

Expand All @@ -205,7 +206,7 @@ lazy val `keywords-Each` =
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""",
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}"""
)
.dependsOn(Dsl, `keywords-Shift`, `keywords-Continue` % Test)
.dependsOn(Dsl, `keywords-Shift`)
lazy val `keywords-EachJS` = `keywords-Each`.js
lazy val `keywords-EachJVM` = `keywords-Each`.jvm

Expand Down Expand Up @@ -233,7 +234,7 @@ lazy val `keywords-Yield` =
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-BangNotation` in Compile).value}""",
scalacOptions += raw"""-Xplugin:${(packageBin in `compilerplugins-ResetEverywhere` in Compile).value}"""
)
.dependsOn(Dsl, `keywords-Shift` % Test, `keywords-Continue` % Test)
.dependsOn(Dsl, `keywords-Shift` % Test, `keywords-Each` % Test, `keywords-Continue` % Test)
lazy val `keywords-YieldJS` = `keywords-Yield`.js
lazy val `keywords-YieldJVM` = `keywords-Yield`.jvm

Expand Down Expand Up @@ -289,6 +290,10 @@ lazy val comprehension =
`keywords-FlatMap`,
`keywords-WithFilter`,
`keywords-Return`,
`keywords-Each` % Test,
`keywords-Yield` % Test,
`keywords-Using` % Test,
`keywords-Continue` % Test,
)
lazy val comprehensionJS = comprehension.js
lazy val comprehensionJVM = comprehension.jvm
Expand Down
12 changes: 0 additions & 12 deletions comprehension/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,3 @@ scalacOptions in Compile ++= {
}

libraryDependencies += "org.scalatest" %%% "scalatest" % "3.0.6-SNAP2" % Test

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-asynchronousio" % "1.3.1" % Test

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-yield" % "1.3.1" % Test

libraryDependencies += "com.thoughtworks.dsl" %%% "domains-task" % "1.3.1" % Optional

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-continue" % "1.3.1" % Test

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-using" % "1.3.1" % Test
4 changes: 0 additions & 4 deletions domains-task/.jvm/jvm.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,3 @@ exampleSuperTypes := exampleSuperTypes.value.map {
case otherTrait =>
otherTrait
}

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Optional

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-fork" % "1.3.1" % Optional
8 changes: 0 additions & 8 deletions keywords-AsynchronousIo/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,3 @@ scalacOptions ++= {
None
}
}

libraryDependencies += "com.thoughtworks.dsl" %%% "comprehension" % "1.3.1" % Optional

libraryDependencies += "com.thoughtworks.dsl" %%% "domains-task" % "1.3.1" % Optional

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-using" % "1.3.1" % Optional

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Optional
2 changes: 0 additions & 2 deletions keywords-Continue/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ libraryDependencies ++= {
Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full))
}
}

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test
1 change: 0 additions & 1 deletion keywords-Each/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ libraryDependencies ++= {

libraryDependencies += "com.thoughtworks.enableIf" %% "enableif" % "1.1.6"

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-yield" % "1.3.1" % Test
Original file line number Diff line number Diff line change
Expand Up @@ -151,50 +151,4 @@ class EachSpec extends FreeSpec with Matchers {
}
}

"Given a continuation that uses Yield and Each expressions" - {

def asyncFunction: Stream[String] !! Unit = _ {
!Yield("Entering asyncFunction")
val subThreadId: Int = !Each(Seq(0, 1))
!Yield(s"Fork sub-thread $subThreadId")
!Yield("Leaving asyncFunction")
}

"When create a generator that contains Yield, Shift, and Each expressions" - {

def generator: Stream[String] = {
!Yield("Entering generator")
val threadId = !Each(Seq(0, 1))
!Yield(s"Fork thread $threadId")
!Shift(asyncFunction)
Stream("Leaving generator")
}

"Then the generator should contains yield values" in {
generator should be(
Seq(
/**/ "Entering generator",
/****/ "Fork thread 0",
/******/ "Entering asyncFunction",
/********/ "Fork sub-thread 0",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator",
/********/ "Fork sub-thread 1",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator",
/****/ "Fork thread 1",
/******/ "Entering asyncFunction",
/********/ "Fork sub-thread 0",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator",
/********/ "Fork sub-thread 1",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator"
))
}

}

}

}
2 changes: 0 additions & 2 deletions keywords-ForEach/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ scalacOptions in Compile ++= {
case _ => Seq.empty
}
}

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test
2 changes: 0 additions & 2 deletions keywords-Using/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,3 @@ scalacOptions ++= {
None
}
}

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-await" % "1.3.1" % Test
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ object Using {
* Therefore, the final value of `n` should be `(1 + 20) * 2 = 42`.
*
* {{{
* import com.thoughtworks.dsl.Dsl.reset
* Future {
* !Await(multiplicationAfterAddition)
* multiplicationAfterAddition.map { _ =>
* n should be(42)
* }: @reset
* }
* }}}
*
*/
Expand Down
2 changes: 0 additions & 2 deletions keywords-Yield/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,3 @@ libraryDependencies ++= {
Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full))
}
}

libraryDependencies += "com.thoughtworks.dsl" %%% "keywords-each" % "1.3.1" % Test
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,52 @@ import scala.runtime.NonLocalReturnControl
*/
class YieldSpec extends FreeSpec with Matchers {

"Given a continuation that uses Yield and Each expressions" - {

def asyncFunction: Stream[String] !! Unit = _ {
!Yield("Entering asyncFunction")
val subThreadId: Int = !Each(Seq(0, 1))
!Yield(s"Fork sub-thread $subThreadId")
!Yield("Leaving asyncFunction")
}

"When create a generator that contains Yield, Shift, and Each expressions" - {

def generator: Stream[String] = {
!Yield("Entering generator")
val threadId = !Each(Seq(0, 1))
!Yield(s"Fork thread $threadId")
!Shift(asyncFunction)
Stream("Leaving generator")
}

"Then the generator should contains yield values" in {
generator should be(
Seq(
/**/ "Entering generator",
/****/ "Fork thread 0",
/******/ "Entering asyncFunction",
/********/ "Fork sub-thread 0",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator",
/********/ "Fork sub-thread 1",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator",
/****/ "Fork thread 1",
/******/ "Entering asyncFunction",
/********/ "Fork sub-thread 0",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator",
/********/ "Fork sub-thread 1",
/**********/ "Leaving asyncFunction",
/**********/ "Leaving generator"
))
}

}

}

"stream" - {

def shouldCompile = {
Expand Down

0 comments on commit fafc6d2

Please sign in to comment.