From 42b5fe6fc399517e211441f3c9a3624489a65063 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Wed, 27 Sep 2023 15:42:36 +0200 Subject: [PATCH 1/3] MiMa checks Scala 3 artifacts now --- build.sbt | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/build.sbt b/build.sbt index 40921298..e70073e3 100644 --- a/build.sbt +++ b/build.sbt @@ -40,23 +40,12 @@ Global / onLoad := (Global / onLoad).value.andThen { s => s } -val previousVersion: Option[String] = Some("5.1.0") +val previousVersion: Option[String] = Some("6.0.0-RC2") lazy val mimaSettings = Seq( mimaBinaryIssueFilters ++= Seq( - // Dropping deprecated phantom-js support. - ProblemFilters.exclude[MissingClassProblem]("org.scalatestplus.play.PhantomJSFactory"), - ProblemFilters.exclude[MissingClassProblem]("org.scalatestplus.play.PhantomJSFactory$"), - ProblemFilters.exclude[MissingClassProblem]("org.scalatestplus.play.PhantomJSInfo"), - ProblemFilters.exclude[MissingClassProblem]("org.scalatestplus.play.PhantomJSInfo$") ), - mimaPreviousArtifacts := { - if (scalaBinaryVersion.value == "3") { - Set.empty - } else { - previousVersion.map(organization.value %% name.value % _).toSet - } - } + mimaPreviousArtifacts := previousVersion.map(organization.value %% name.value % _).toSet ) lazy val commonSettings = Seq( From 56f36e10dbb202a24cd677211246b369001b3d35 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Thu, 21 Sep 2023 17:01:43 +0200 Subject: [PATCH 2/3] Remove play sbt-plugin --- project/plugins.sbt | 1 - 1 file changed, 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index 4599a192..9045f177 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -6,7 +6,6 @@ resolvers ++= Seq( ) addSbtPlugin("com.typesafe.play" % "interplay" % sys.props.getOrElse("interplay.version", "3.1.7")) -addSbtPlugin("com.typesafe.play" % "sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-RC2")) addSbtPlugin("com.typesafe.play" % "play-docs-sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-RC2")) addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") From ebcd8ff5f0f1fc1f9dcb96fc5f6332f6a920cdf6 Mon Sep 17 00:00:00 2001 From: Sergey Morgunov Date: Thu, 14 Sep 2023 18:17:52 +0300 Subject: [PATCH 3/3] Drop interplay --- build.sbt | 35 ++++++++++++++++++++------- project/Omnidoc.scala | 55 +++++++++++++++++++++++++++++++++++++++++++ project/Playdoc.scala | 32 +++++++++++++++++++++++++ project/plugins.sbt | 10 ++++---- 4 files changed, 118 insertions(+), 14 deletions(-) create mode 100644 project/Omnidoc.scala create mode 100644 project/Playdoc.scala diff --git a/build.sbt b/build.sbt index e70073e3..e36ce420 100644 --- a/build.sbt +++ b/build.sbt @@ -17,7 +17,6 @@ import com.typesafe.tools.mima.core._ import sbt.util.{ Level => _, _ } import sbt.io.Path._ -import interplay.ScalaVersions._ val SeleniumVersion = "4.12.1" val SeleniumHtmlunitVersion = "4.12.0" @@ -27,7 +26,6 @@ val ScalatestVersion = "3.2.17" val ScalatestSeleniumVersion = ScalatestVersion + ".0" val ScalatestMockitoVersion = ScalatestVersion + ".0" -ThisBuild / playBuildRepoName := "scalatestplus-play" ThisBuild / resolvers ++= Resolver.sonatypeOssRepos("releases") // Customise sbt-dynver's behaviour to make it work with tags which aren't v-prefixed @@ -49,8 +47,8 @@ lazy val mimaSettings = Seq( ) lazy val commonSettings = Seq( - scalaVersion := scala213, - crossScalaVersions := Seq(scala213, scala3), + scalaVersion := "2.13.12", + crossScalaVersions := Seq("2.13.12", "3.3.1"), Test / parallelExecution := false, Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oTK"), headerLicense := Some( @@ -75,22 +73,26 @@ lazy val commonSettings = Seq( lazy val `scalatestplus-play-root` = project .in(file(".")) - .enablePlugins(PlayRootProject) .aggregate(`scalatestplus-play`) .settings(commonSettings) .settings( sonatypeProfileName := "org.scalatestplus.play", - mimaPreviousArtifacts := Set.empty + mimaPreviousArtifacts := Set.empty, + publish / skip := true ) lazy val `scalatestplus-play` = project .in(file("module")) - .enablePlugins(Playdoc, PlayLibrary) + .enablePlugins(Omnidoc, Playdoc) .configs(Docs) .settings( commonSettings, mimaSettings, organization := "org.scalatestplus.play", + organizationName := "The Play Framework Project", + organizationHomepage := Some(url("https://playframework.com")), + homepage := Some(url(s"https://github.com/playframework/${Omnidoc.repoName}")), + licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")), libraryDependencies ++= Seq( ws, nettyServer % Test, // Using netty for now, we can switch back to akkaHttpServer when it has Scala 3 artifacts @@ -103,18 +105,35 @@ lazy val `scalatestplus-play` = project "net.sourceforge.htmlunit" % "htmlunit-cssparser" % CssParserVersion ), Compile / doc / scalacOptions := Seq("-doc-title", "ScalaTest + Play, " + version.value), + doc / javacOptions := Seq("-source", "11"), Test / fork := true, Test / javaOptions ++= List( "-Dwebdriver.firefox.logfile=/dev/null", // disable GeckoDriver logs polluting the CI logs ), + scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-encoding", "utf8") ++ + (CrossVersion.partialVersion(scalaVersion.value) match { + case Some((2, 13)) => Seq("-Xsource:3", "-Xmigration") + case _ => Seq.empty + }), + javacOptions ++= Seq("-encoding", "UTF-8", "-Xlint:-options", "--release", "11"), + developers += Developer( + "playframework", + "The Play Framework Contributors", + "contact@playframework.com", + url("https://github.com/playframework") + ), + pomIncludeRepository := { _ => + false + } ) lazy val docs = project .in(file("docs")) - .enablePlugins(PlayDocsPlugin, PlayNoPublish) + .enablePlugins(PlayDocsPlugin) .configs(Docs) .settings( commonSettings, + publish / skip := true, libraryDependencies ++= Seq( "org.mockito" % "mockito-core" % MockitoVersion % Test, ), diff --git a/project/Omnidoc.scala b/project/Omnidoc.scala new file mode 100644 index 00000000..58f629cc --- /dev/null +++ b/project/Omnidoc.scala @@ -0,0 +1,55 @@ +import sbt._ +import sbt.Keys._ +import sbt.Package.ManifestAttributes + +/** + * This AutoPlugin adds the `Omnidoc-Source-URL` key on the MANIFEST.MF of artifact-sources.jar so later Omnidoc can use + * that value to link scaladocs to GitHub sources. + */ +object Omnidoc extends AutoPlugin { + + object autoImport { + lazy val omnidocSnapshotBranch = settingKey[String]("Git branch for development versions") + lazy val omnidocPathPrefix = settingKey[String]("Prefix before source directory paths") + lazy val omnidocSourceUrl = settingKey[Option[String]]("Source URL for scaladoc linking") + } + + val repoName = "scalatestplus-play" + + val omnidocGithubRepo: Option[String] = Some(s"playframework/${repoName}") + + val omnidocTagPrefix: Option[String] = Some("") + + val SourceUrlKey = "Omnidoc-Source-URL" + + override def requires = sbt.plugins.JvmPlugin + + override def trigger = noTrigger + + import autoImport.* + + override def projectSettings = Seq( + omnidocSourceUrl := omnidocGithubRepo.map { repo => + val development: String = (omnidocSnapshotBranch ?? "main").value + val tagged: String = omnidocTagPrefix.getOrElse("v") + version.value + val tree: String = if (isSnapshot.value) development else tagged + val prefix: String = "/" + (omnidocPathPrefix ?? "").value + val path: String = { + val buildDir: File = (ThisBuild / baseDirectory).value + val projDir: File = baseDirectory.value + val rel: Option[String] = IO.relativize(buildDir, projDir) + rel match { + case None if buildDir == projDir => "" // Same dir (sbt 0.13) + case Some("") => "" // Same dir (sbt 1.0) + case Some(childDir) => prefix + childDir // Child dir + case None => "" // Disjoint dirs (Rich: I'm not sure if this can happen) + } + } + s"https://github.com/${repo}/tree/${tree}${path}" + }, + Compile / packageSrc / packageOptions ++= omnidocSourceUrl.value.toSeq.map { url => + ManifestAttributes(SourceUrlKey -> url) + } + ) + +} diff --git a/project/Playdoc.scala b/project/Playdoc.scala new file mode 100644 index 00000000..d97f819e --- /dev/null +++ b/project/Playdoc.scala @@ -0,0 +1,32 @@ +import sbt._ +import sbt.Keys._ +import sbt.io.IO + +object Playdoc extends AutoPlugin { + + object autoImport { + final val Docs = config("docs") + val playdocDirectory = settingKey[File]("Base directory of play documentation") + val playdocPackage = taskKey[File]("Package play documentation") + } + + import autoImport._ + + override def requires = sbt.plugins.JvmPlugin + + override def trigger = noTrigger + + override def projectSettings = + Defaults.packageTaskSettings(playdocPackage, playdocPackage / mappings) ++ + Seq( + playdocDirectory := (ThisBuild / baseDirectory).value / "docs" / "manual", + playdocPackage / mappings := { + val base: File = playdocDirectory.value + base.allPaths.pair(IO.relativize(base.getParentFile(), _)) + }, + playdocPackage / artifactClassifier := Some("playdoc"), + playdocPackage / artifact ~= { _.withConfigurations(Vector(Docs)) } + ) ++ + addArtifact(playdocPackage / artifact, playdocPackage) + +} diff --git a/project/plugins.sbt b/project/plugins.sbt index 9045f177..cda3d972 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,13 +1,11 @@ resolvers ++= DefaultOptions.resolvers(snapshot = true) -resolvers ++= Seq( - Resolver.typesafeRepo("releases"), - Resolver.sonatypeRepo("releases"), - Resolver.sonatypeRepo("snapshots"), // used by deploy nightlies, which publish here & use -Dplay.version -) +resolvers ++= Resolver + .sonatypeOssRepos("snapshots") // used by deploy nightlies, which publish here & use -Dplay.version -addSbtPlugin("com.typesafe.play" % "interplay" % sys.props.getOrElse("interplay.version", "3.1.7")) addSbtPlugin("com.typesafe.play" % "play-docs-sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-RC2")) addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3") addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0") + +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12")