Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop interplay #773

Merged
merged 1 commit into from
Oct 19, 2023
Merged
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
29 changes: 19 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import scala.sys.process._

import com.typesafe.tools.mima.plugin.MimaPlugin._
import com.typesafe.tools.mima.core._
import interplay.ScalaVersions._

ThisBuild / resolvers ++= Resolver.sonatypeOssRepos("releases")

Expand All @@ -17,29 +15,42 @@ Global / onLoad := (Global / onLoad).value.andThen { s =>
}

lazy val commonSettings = Seq(
// Work around https://issues.scala-lang.org/browse/SI-9311
scalacOptions ~= (_.filterNot(_ == "-Xfatal-warnings")),
organization := "com.typesafe.play",
organizationName := "The Play Framework Project",
organizationHomepage := Some(url("https://playframework.com/")),
homepage := Some(url(s"https://github.com/playframework/${Common.repoName}")),
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
javacOptions ++= Seq("-encoding", "UTF-8", "-Xlint:-options"),
compile / javacOptions ++= Seq("--release", "11"),
doc / javacOptions := Seq("-source", "11"),
scalaVersion := "2.13.12", // scala213,
crossScalaVersions := Seq("2.13.12", "3.3.1"), // scala213,
pomExtra := scala.xml.NodeSeq.Empty, // Can be removed when dropping interplay
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-encoding", "utf8") ++
(CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, 13)) => Seq("-Xsource:3", "-Xmigration")
case _ => Seq.empty
}),
developers += Developer(
"playframework",
"The Play Framework Contributors",
"contact@playframework.com",
url("https://github.com/playframework")
),
pomIncludeRepository := { _ => false }
)

lazy val `play-slick-root` = (project in file("."))
.enablePlugins(PlayRootProject)
.aggregate(
`play-slick`,
`play-slick-evolutions`
)
.settings(commonSettings)
.settings(
publish / skip := true
)

lazy val `play-slick` = (project in file("src/core"))
.enablePlugins(PlayLibrary, Playdoc, MimaPlugin)
.enablePlugins(Omnidoc, Playdoc, MimaPlugin)
.configs(Docs)
.settings(libraryDependencies ++= Dependencies.core)
.settings(mimaSettings)
Expand All @@ -50,7 +61,7 @@ lazy val `play-slick` = (project in file("src/core"))
.settings(commonSettings)

lazy val `play-slick-evolutions` = (project in file("src/evolutions"))
.enablePlugins(PlayLibrary, Playdoc, MimaPlugin)
.enablePlugins(Omnidoc, Playdoc, MimaPlugin)
.configs(Docs)
.settings(libraryDependencies ++= Dependencies.evolutions)
.settings(mimaSettings)
Expand All @@ -65,8 +76,6 @@ lazy val docs = project
.dependsOn(`play-slick-evolutions`)
.settings(commonSettings)

ThisBuild / playBuildRepoName := "play-slick"

// Binary compatibility is tested against this version
val previousVersion: Option[String] = Some("5.2.0-RC1")

Expand Down
4 changes: 3 additions & 1 deletion project/CommonSettings.scala → project/Common.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import sbt._

import sbt.Keys._

object CommonSettings extends AutoPlugin {
object Common extends AutoPlugin {

val repoName = "play-slick"

override def requires = plugins.JvmPlugin
override def trigger = allRequirements
Expand Down
53 changes: 53 additions & 0 deletions project/Omnidoc.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
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 omnidocGithubRepo: Option[String] = Some(s"playframework/${Common.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)
}
)

}
32 changes: 32 additions & 0 deletions project/Playdoc.scala
Original file line number Diff line number Diff line change
@@ -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)

}
8 changes: 3 additions & 5 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
resolvers ++= DefaultOptions.resolvers(snapshot = true)
resolvers ++= Seq(
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" % "sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-RC3"))
addSbtPlugin("com.typesafe.play" % "play-docs-sbt-plugin" % sys.props.getOrElse("play.version", "2.9.0-RC3"))
addSbtPlugin("com.typesafe.play" % "interplay" % sys.props.get("interplay.version").getOrElse("3.1.7"))

addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3")
Expand Down