Skip to content
Merged

sbt 2 #862

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
4 changes: 2 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
with:
java: 21, 17
scala: 2.13.x, 3.x
cmd: cd docs && sbt ++$MATRIX_SCALA validateCode
cmd: cd docs && sbt "++$MATRIX_SCALA ; validateCode"

tests:
name: Tests
Expand All @@ -42,7 +42,7 @@ jobs:
java: 21, 17
scala: 2.13.x, 3.x
cmd: >-
sbt ++$MATRIX_SCALA test
sbt --server ++$MATRIX_SCALA test

scripted-tests:
name: Scripted tests
Expand Down
34 changes: 20 additions & 14 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ lazy val root = project
publish / skip := true,
)
.settings(
(Compile / headerSources) ++=
(Compile / headerSources) ++= Def.uncached(
((baseDirectory.value ** ("*.properties" || "*.md" || "*.sbt"))
--- (baseDirectory.value ** "target" ** "*")
--- (baseDirectory.value / ".github" ** "*")
--- (baseDirectory.value / "docs" ** "*")
--- (baseDirectory.value / "sbt-play-ebean" ** "*")).get ++
(baseDirectory.value / "project" ** "*.scala" --- (baseDirectory.value ** "target" ** "*")).get
--- (baseDirectory.value / "sbt-play-ebean" ** "*")).get() ++
(baseDirectory.value / "project" ** "*.scala" --- (baseDirectory.value ** "target" ** "*")).get()
),
)

lazy val core = project
Expand All @@ -58,11 +59,14 @@ lazy val core = project
crossScalaVersions := Seq(scala213, scala3App),
Dependencies.ebean,
mimaSettings,
Compile / compile := enhanceEbeanClasses(
(Compile / dependencyClasspath).value,
(Compile / compile).value,
(Compile / classDirectory).value,
"play/db/ebean/**"
Compile / compile := Def.uncached(
enhanceEbeanClasses(
(Compile / dependencyClasspath).value,
(Compile / compile).value,
(Compile / classDirectory).value,
"play/db/ebean/**",
fileConverter.value,
)
),
)

Expand All @@ -74,12 +78,12 @@ lazy val plugin = project
organization := "org.playframework",
Dependencies.plugin,
addSbtPlugin("org.playframework" % "sbt-plugin" % Versions.play),
scalaVersion := scala212,
scalaVersion := scala3Plugin,
crossScalaVersions := Seq(scala212, scala3Plugin),
pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" => "1.12.9"
case _ => "2.0.0-RC11"
case _ => "2.0.8"
}
},
scalacOptions ++= {
Expand All @@ -104,8 +108,9 @@ lazy val plugin = project
scriptedDependencies := publishLocal.value,
)
.settings(
(Compile / headerSources) ++=
(sourceDirectory.value / "sbt-test" ** ("*.java" || "*.sbt")).get
(Compile / headerSources) ++= Def.uncached(
(sourceDirectory.value / "sbt-test" ** ("*.java" || "*.sbt")).get()
),
)

def resolveScriptedScala(version: String): String =
Expand All @@ -129,10 +134,11 @@ def enhanceEbeanClasses(
classpath: Classpath,
analysis: CompileAnalysis,
classDirectory: File,
pkg: String
pkg: String,
converter: FileConverter,
): CompileAnalysis = {
// Ebean (really hacky sorry)
val cp = classpath.map(_.data.toURI.toURL).toArray :+ classDirectory.toURI.toURL
val cp = classpath.map(_.data).map(converter.toPath).map(_.toFile.toURI.toURL).toArray :+ classDirectory.toURI.toURL
val cl = new java.net.URLClassLoader(cp)
val t = cl
.loadClass("io.ebean.enhance.Transformer")
Expand Down
14 changes: 8 additions & 6 deletions docs/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ lazy val docs = project
libraryDependencies += component("play-java-forms"),
libraryDependencies += component("play-test") % Test,
libraryDependencies += "com.h2database" % "h2" % "2.5.250" % Test,
PlayDocsKeys.javaManualSourceDirectories := (baseDirectory.value / "manual" / "working" / "javaGuide" ** "code").get,
PlayDocsKeys.javaManualSourceDirectories := (baseDirectory.value / "manual" / "working" / "javaGuide" ** "code")
.get(),
// No resource directories shuts the ebean agent up about java sources in the classes directory
Test / unmanagedResourceDirectories := Nil,
Test / parallelExecution := false,
Expand All @@ -40,23 +41,24 @@ lazy val docs = project
FileType("properties") -> HeaderCommentStyle.hashLineComment,
FileType("md") -> CommentStyle(new LineCommentCreator("<!---", "-->"), commentBetween("<!---", "*", "-->"))
),
Compile / headerSources ++=
Compile / headerSources ++= Def.uncached(
((baseDirectory.value ** ("*.properties" || "*.md" || "*.sbt"))
--- (baseDirectory.value ** "target" ** "*")).get,
--- (baseDirectory.value ** "target" ** "*")).get()
),
)
.settings(PlayEbean.unscopedSettings: _*)
.settings(PlayEbean.unscopedSettings)
.settings(
inConfig(Test)(
Seq(
playEbeanModels := Seq("javaguide.ebean.*")
)
): _*
)
)
.dependsOn(playEbean)

lazy val playEbean = ProjectRef(Path.fileProperty("user.dir").getParentFile, "core")

val _ = sys.props += ("sbt_validateCode" -> List(
val ignore = sys.props += ("sbt_validateCode" -> List(
"evaluateSbtFiles",
"validateDocs",
).mkString(";"))
2 changes: 1 addition & 1 deletion docs/project/build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>

sbt.version=1.13.0
sbt.version=2.0.8
14 changes: 7 additions & 7 deletions project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,33 @@ object Common extends AutoPlugin {

val repoName = "play-ebean"

override def globalSettings: Seq[Setting[_]] =
override def globalSettings: Seq[Setting[?]] =
Seq(
// organization
organization := "org.playframework",
organizationName := "The Play Framework Project",
organizationHomepage := Some(url("https://playframework.com/")),
organizationHomepage := Some(uri("https://playframework.com/")),
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-encoding", "utf8"),
javacOptions ++= Seq("-encoding", "UTF-8"),
// legal
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
licenses := Seq(License("Apache-2.0", uri("https://www.apache.org/licenses/LICENSE-2.0.html"))),
// on the web
homepage := Some(url(s"https://github.com/playframework/$repoName")),
homepage := Some(uri(s"https://github.com/playframework/$repoName")),
scmInfo := Some(
ScmInfo(
url(s"https://github.com/playframework/$repoName"),
uri(s"https://github.com/playframework/$repoName"),
s"scm:git:git@github.com:playframework/$repoName.git"
)
),
developers += Developer(
"playframework",
"The Play Framework Contributors",
"contact@playframework.com",
url("https://github.com/playframework")
uri("https://github.com/playframework")
)
)

override def projectSettings: Seq[Def.Setting[_]] =
override def projectSettings: Seq[Def.Setting[?]] =
Seq(
headerLicense := Some(
HeaderLicense.Custom(
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Copyright (C) from 2022 The Play Framework Contributors <https://github.com/playframework>, 2011-2021 Lightbend Inc. <https://www.lightbend.com>

sbt.version=1.13.0
sbt.version=2.0.8