/
build.sbt
134 lines (127 loc) · 5.81 KB
/
build.sbt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/
import com.typesafe.play.docs.sbtplugin.Imports._
import com.typesafe.play.docs.sbtplugin._
import play.core.PlayVersion
import playbuild.JavaVersion
import playbuild.CrossJava
import de.heikoseeberger.sbtheader.FileType
import de.heikoseeberger.sbtheader.CommentStyle
import de.heikoseeberger.sbtheader.HeaderPlugin.autoImport.HeaderPattern.commentBetween
import de.heikoseeberger.sbtheader.LineCommentCreator
val DocsApplication = config("docs").hide
lazy val main = Project("Play-Documentation", file("."))
.enablePlugins(PlayDocsPlugin, SbtTwirl)
.settings(
// Avoid the use of deprecated APIs in the docs
scalacOptions ++= Seq("-deprecation"),
javacOptions ++= Seq(
"-encoding",
"UTF-8",
"-parameters",
"-Xlint:unchecked",
"-Xlint:deprecation",
) ++ {
val javaHomes = fullJavaHomes.value
JavaVersion.sourceAndTarget(javaHomes.get("8").orElse(javaHomes.get("system@8")))
},
ivyConfigurations += DocsApplication,
// We need to publishLocal playDocs since its jar file is
// a dependency of `docsJarFile` setting.
test in Test := ((test in Test).dependsOn(publishLocal in playDocs)).value,
resolvers += Resolver
.sonatypeRepo("releases"), // TODO: Delete this eventually, just needed for lag between deploying to sonatype and getting on maven central
version := PlayVersion.current,
libraryDependencies ++= Seq(
"com.typesafe" % "config" % "1.4.1" % Test,
"com.h2database" % "h2" % "1.4.200" % Test,
"org.mockito" % "mockito-core" % "2.18.3" % "test",
// https://github.com/logstash/logstash-logback-encoder/tree/logstash-logback-encoder-4.9#including
"net.logstash.logback" % "logstash-logback-encoder" % "5.1" % "test"
),
PlayDocsKeys.docsJarFile := Some((packageBin in (playDocs, Compile)).value),
PlayDocsKeys.playDocsValidationConfig := PlayDocsValidation.ValidationConfig(
downstreamWikiPages = Set(
"JavaEbean",
"ScalaAnorm",
"PlaySlick",
"PlaySlickMigrationGuide",
"ScalaTestingWithScalaTest",
"ScalaFunctionalTestingWithScalaTest",
"ScalaJson",
"ScalaJsonAutomated",
"ScalaJsonCombinators",
"ScalaJsonTransformers",
// These are not downstream pages, but they were renamed
// and are still linked in old migration guides.
"JavaDatabase",
"ScalaDatabase"
)
),
PlayDocsKeys.javaManualSourceDirectories :=
(baseDirectory.value / "manual" / "working" / "javaGuide" ** "code").get ++
(baseDirectory.value / "manual" / "gettingStarted" ** "code").get,
PlayDocsKeys.scalaManualSourceDirectories :=
(baseDirectory.value / "manual" / "working" / "scalaGuide" ** "code").get ++
(baseDirectory.value / "manual" / "tutorial" ** "code").get ++
(baseDirectory.value / "manual" / "experimental" ** "code").get,
PlayDocsKeys.commonManualSourceDirectories :=
(baseDirectory.value / "manual" / "working" / "commonGuide" ** "code").get ++
(baseDirectory.value / "manual" / "gettingStarted" ** "code").get,
unmanagedSourceDirectories in Test ++= (baseDirectory.value / "manual" / "detailedTopics" ** "code").get,
unmanagedResourceDirectories in Test ++= (baseDirectory.value / "manual" / "detailedTopics" ** "code").get,
// Don't include sbt files in the resources
excludeFilter in (Test, unmanagedResources) := (excludeFilter in (Test, unmanagedResources)).value || "*.sbt",
crossScalaVersions := Seq("2.13.8", "2.12.15"),
scalaVersion := "2.13.8",
fork in Test := true,
javaOptions in Test ++= Seq("-Xmx512m", "-Xms128m"),
headerLicense := Some(HeaderLicense.Custom("Copyright (C) Lightbend Inc. <https://www.lightbend.com>")),
headerMappings ++= Map(
FileType.xml -> CommentStyle.xmlStyleBlockComment,
FileType.conf -> CommentStyle.hashLineComment,
FileType("md") -> CommentStyle(new LineCommentCreator("<!---", "-->"), commentBetween("<!---", "*", "-->"))
),
sourceDirectories in javafmt in Test ++= (unmanagedSourceDirectories in Test).value,
sourceDirectories in javafmt in Test ++= (unmanagedResourceDirectories in Test).value,
// No need to show eviction warnings for Play documentation.
evictionWarningOptions in update := EvictionWarningOptions.default
.withWarnTransitiveEvictions(false)
.withWarnDirectEvictions(false)
)
.dependsOn(
playDocs,
playProject("Play") % "test",
playProject("Play-Specs2") % "test",
playProject("Play-Java") % "test",
playProject("Play-Java-Forms") % "test",
playProject("Play-Java-JPA") % "test",
playProject("Play-Guice") % "test",
playProject("Play-Caffeine-Cache") % "test",
playProject("Play-AHC-WS") % "test",
playProject("Play-OpenID") % "test",
playProject("Filters-Helpers") % "test",
playProject("Play-JDBC-Evolutions") % "test",
playProject("Play-JDBC") % "test",
playProject("Play-Logback") % "test",
playProject("Play-Java-JDBC") % "test",
playProject("Play-Akka-Http-Server") % "test",
playProject("Play-Netty-Server") % "test",
playProject("Play-Cluster-Sharding") % "test",
playProject("Play-Java-Cluster-Sharding") % "test"
)
lazy val playDocs = playProject("Play-Docs")
def playProject(name: String) = ProjectRef(Path.fileProperty("user.dir").getParentFile, name)
addCommandAlias(
"validateCode",
List(
"evaluateSbtFiles",
"clearCaches",
"validateDocs",
"headerCheckAll",
"scalafmtSbtCheck",
"scalafmtCheckAll",
"javafmtCheckAll",
).mkString(";")
)