Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 8 additions & 29 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,50 +23,29 @@ jobs:
name: Binary Compatibility
uses: playframework/.github/.github/workflows/binary-check.yml@v4

check-docs-8:
name: Docs Java 8
uses: playframework/.github/.github/workflows/cmd.yml@v4
with:
java: 8
scala: 2.12.x
cmd: sbt ++$MATRIX_SCALA docs/test

check-docs-11:
check-docs:
name: Docs
uses: playframework/.github/.github/workflows/cmd.yml@v4
with:
java: 11
scala: 2.12.x, 2.13.x, 3.x
java: 17
scala: 2.13.x, 3.x
cmd: sbt ++$MATRIX_SCALA docs/test

tests-8:
name: Tests
needs:
- "check-code-style"
- "check-binary-compatibility"
- "check-docs-8"
uses: playframework/.github/.github/workflows/cmd.yml@v4
with:
java: 8
scala: 2.12.x
cmd: sbt ++$MATRIX_SCALA publishLocal test

tests-11:
tests:
name: Tests
needs:
- "check-code-style"
- "check-binary-compatibility"
- "check-docs-11"
- "check-docs"
uses: playframework/.github/.github/workflows/cmd.yml@v4
with:
java: 11
scala: 2.12.x, 2.13.x, 3.x
java: 17
scala: 2.13.x, 3.x
cmd: sbt ++$MATRIX_SCALA publishLocal test

finish:
name: Finish
if: github.event_name == 'pull_request'
needs: # Should be last
- "tests-8"
- "tests-11"
- "tests"
uses: playframework/.github/.github/workflows/rtm.yml@v4
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
uses: playframework/.github/.github/workflows/publish.yml@v4
secrets: inherit
with:
java: 8
java: 17
9 changes: 0 additions & 9 deletions akka/src/test/scala-2.13-/AkkaCompat.scala

This file was deleted.

137 changes: 15 additions & 122 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -204,63 +204,19 @@ lazy val `anorm-core` = project
ProblemFilters.exclude[IncompatibleResultTypeProblem]("anorm.ColumnNotFound.copy$default$2")
),
libraryDependencies ++= {
val h2Ver = sys.props.get("java.version") match {
case Some(v) if v.startsWith("1.8") =>
"2.2.224"

case _ =>
"2.3.230"
}

Seq(
"joda-time" % "joda-time" % "2.14.2",
"org.joda" % "joda-convert" % "3.0.1",
"org.scala-lang.modules" %% "scala-parser-combinators" % parserCombinatorsVer.value,
"org.scala-lang.modules" %% "scala-xml" % xmlVer % Test,
"com.h2database" % "h2" % h2Ver % Test,
"org.scala-lang.modules" %% "scala-xml" % xmlVer % Test,
"com.h2database" % "h2" % "2.3.230" % Test,
acolyte
) ++ specs2Test
},
) ++ armShading ++ licensing
)
.dependsOn(`anorm-tokenizer`)

lazy val `anorm-iteratee` = project
.in(file("iteratee"))
.settings(
Seq(
sourceDirectory := {
val v = scalaBinaryVersion.value

if (v == "3" || v == "2.13") new java.io.File("/no/sources")
else sourceDirectory.value
},
mimaPreviousArtifacts := {
val v = scalaBinaryVersion.value

if (v == "3" || v == "2.13") Set.empty[ModuleID]
else Set(organization.value %% name.value % "2.6.10")
},
publish / skip := {
val v = scalaBinaryVersion.value

v == "3" || v == "2.13"
},
libraryDependencies ++= {
val v = scalaBinaryVersion.value

if (v == "3" || v == "2.13") Seq.empty[ModuleID]
else
Seq(
"com.typesafe.play" %% "play-iteratees" % "2.6.1",
"org.scala-lang.modules" %% "scala-xml" % xmlVer % Test,
acolyte
) ++ specs2Test
}
) ++ licensing
)
.dependsOn(`anorm-core`)

// ---

lazy val akkaVer = Def.setting[String] {
Expand Down Expand Up @@ -291,80 +247,27 @@ lazy val `anorm-akka` = project
"org.scala-lang.modules" %% "scala-xml" % xmlVer % Test,
("com.typesafe.akka" %% "akka-stream-testkit" % akkaVer.value % Test).exclude("org.scala-lang.modules", "*")
) ++ specs2Test,
scalacOptions ++= Seq("-Wconf:msg=.*(onDownstreamFinish|ActorMaterializer).*:s"),
Test / unmanagedSourceDirectories += {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n < 13 =>
(Test / sourceDirectory).value / "scala-2.13-"

case _ =>
(Test / sourceDirectory).value / "scala-2.13+"

}
}
scalacOptions ++= Seq("-Wconf:msg=.*(onDownstreamFinish|ActorMaterializer).*:s")
) ++ licensing
)
.dependsOn(`anorm-core`)

lazy val pekkoVer = Def.setting[String]("1.6.0")

lazy val pekkoEnabled = Def.setting[Boolean] {
val v = scalaBinaryVersion.value

v != "2.12"
}

lazy val `anorm-pekko` = project
.in(file("pekko"))
.settings(
Seq(
mimaPreviousArtifacts := Set.empty,
sourceDirectory := {
if (!pekkoEnabled.value) new java.io.File("/no/sources")
else sourceDirectory.value
},
publishArtifact := pekkoEnabled.value,
publish := Def.taskDyn {
val ver = scalaBinaryVersion.value
val go = publish.value

Def.task {
if (pekkoEnabled.value) {
go
}
}
}.value,
libraryDependencies ++= {
if (pekkoEnabled.value) {
Seq("pekko-testkit", "pekko-stream").map { m =>
("org.apache.pekko" %% m % pekkoVer.value % Provided).exclude("org.scala-lang.modules", "*")
}
} else {
Seq.empty
}
},
libraryDependencies ++= {
if (pekkoEnabled.value) {
Seq(
acolyte,
"org.scala-lang.modules" %% "scala-xml" % xmlVer % Test,
"org.apache.pekko" %% "pekko-stream-testkit" % pekkoVer.value % Test
) ++ specs2Test
} else {
Seq.empty
}
libraryDependencies ++= Seq("pekko-testkit", "pekko-stream").map { m =>
("org.apache.pekko" %% m % pekkoVer.value % Provided).exclude("org.scala-lang.modules", "*")
},
scalacOptions ++= Seq("-Wconf:cat=deprecation&msg=.*(onDownstreamFinish|ActorMaterializer).*:s"),
Test / unmanagedSourceDirectories ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, n)) if n < 13 =>
Seq((Test / sourceDirectory).value / "scala-2.13-")

case _ =>
Seq((Test / sourceDirectory).value / "scala-2.13+")

}
}
libraryDependencies ++= Seq(
acolyte,
"org.scala-lang.modules" %% "scala-xml" % xmlVer % Test,
"org.apache.pekko" %% "pekko-stream-testkit" % pekkoVer.value % Test
) ++ specs2Test,
scalacOptions ++= Seq("-Wconf:cat=deprecation&msg=.*(onDownstreamFinish|ActorMaterializer).*:s")
) ++ licensing
)
.dependsOn(`anorm-core`)
Expand Down Expand Up @@ -422,7 +325,6 @@ lazy val `anorm-parent` = project
.aggregate(
`anorm-tokenizer`,
`anorm-core`,
`anorm-iteratee`,
`anorm-akka`,
`anorm-pekko`,
`anorm-postgres`,
Expand Down Expand Up @@ -452,19 +354,10 @@ lazy val docs = project

(manualDir / "javaGuide" ** "code").get ++ (manualDir / "scalaGuide" ** "code").get
},
libraryDependencies ++= {
if (scalaBinaryVersion.value == "2.12") {
Seq(
"com.typesafe.play" %% "play-jdbc" % "2.8.22" % Test,
"com.typesafe.play" %% "play-specs2" % "2.8.22" % Test
)
} else {
Seq(
"org.playframework" %% "play-jdbc" % "3.0.10" % Test,
"org.playframework" %% "play-specs2" % "3.0.10" % Test
)
}
},
libraryDependencies ++= Seq(
"org.playframework" %% "play-jdbc" % "3.0.10" % Test,
"org.playframework" %% "play-specs2" % "3.0.10" % Test
),
libraryDependencies ++= Seq(
"com.h2database" % "h2" % "1.4.199"
),
Expand Down
42 changes: 0 additions & 42 deletions core/src/main/scala-2.13-/Compat.scala

This file was deleted.

26 changes: 0 additions & 26 deletions docs/manual/working/scalaGuide/main/sql/ScalaAnorm.md
Original file line number Diff line number Diff line change
Expand Up @@ -1016,32 +1016,6 @@ def source(implicit m: Materializer, connection: Connection): Source[String, Fut
})
```

#### Iteratee

It's possible to use Anorm along with [Play Iteratees](https://www.playframework.com/documentation/latest/Iteratees), using the following dependencies.

```scala
libraryDependencies ++= Seq(
"org.playframework.anorm" %% "anorm-iteratee" % "ANORM_VERSION",
"com.typesafe.play" %% "play-iteratees" % "ITERATEES_VERSION")
```

> For a Play application, as `play-iteratees` is provided there is no need to add this dependency.

> Since Scala 2.13, `play-iteratees` is no longer available.

Then the parsed results from Anorm can be turned into [`Enumerator`](https://www.playframework.com/documentation/latest/api/scala/index.html#play.api.libs.iteratee.Enumerator).

```scala
import java.sql.Connection
import scala.concurrent.ExecutionContext.Implicits.global
import anorm._
import play.api.libs.iteratee._

def resultAsEnumerator(implicit con: Connection): Enumerator[String] =
Iteratees.from(SQL"SELECT * FROM Test", SqlParser.scalar[String])
```

### Retrieving data along with execution context

Moreover data, query execution involves context information like SQL warnings that may be raised (and may be fatal or not), especially when working with stored SQL procedure.
Comment thread
gaeljw marked this conversation as resolved.
Expand Down
Loading
Loading