-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.sbt
168 lines (127 loc) · 6.42 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// Building both for JVM and JavaScript runtimes.
// To convince SBT not to publish any root level artifacts, I had a look at how scala-java-time does it.
// See https://github.com/cquiroz/scala-java-time/blob/master/build.sbt as a "template" for this build file.
// shadow sbt-scalajs' crossProject and CrossType from Scala.js 0.6.x
import sbtcrossproject.CrossPlugin.autoImport.{crossProject, CrossType}
val scalaVer = "3.0.0"
val crossScalaVer = Seq(scalaVer, "2.13.6")
ThisBuild / description := "Extensible XML query API with multiple DOM-like implementations"
ThisBuild / organization := "eu.cdevreeze.yaidom"
ThisBuild / version := "1.14.0-SNAPSHOT"
ThisBuild / scalaVersion := scalaVer
ThisBuild / crossScalaVersions := crossScalaVer
ThisBuild / semanticdbEnabled := true // enable SemanticDB
ThisBuild / semanticdbVersion := scalafixSemanticdb.revision // only required for Scala 2.x
ThisBuild / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case (Some((3, _))) =>
Seq("-unchecked", "-source:3.0-migration")
case _ =>
Seq("-Wconf:cat=unused-imports:w,cat=unchecked:w,cat=deprecation:w,cat=feature:w,cat=lint:w", "-Ytasty-reader", "-Xsource:3")
})
ThisBuild / Test / publishArtifact := false
ThisBuild / publishMavenStyle := true
ThisBuild / publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
}
ThisBuild / pomExtra := pomData
ThisBuild / pomIncludeRepository := { _ => false }
// Scala-xml, scalatest and scalatestplus are common dependencies, but "%%%" does not seem to work well for JS now.
// ThisBuild / libraryDependencies += "org.scala-lang.modules" %%% "scala-xml" % "2.0.0"
// ThisBuild / libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.9" % Test
// ThisBuild / libraryDependencies += "org.scalatestplus" %%% "scalacheck-1-15" % "3.2.9.0" % Test
lazy val root = project.in(file("."))
.aggregate(yaidomJVM, yaidomJS)
.settings(
name := "yaidom",
// Thanks, scala-java-time, for showing us how to prevent any publishing of root level artifacts:
// No, SBT, we don't want any artifacts for root. No, not even an empty jar.
publish := {},
publishLocal := {},
publishArtifact := false,
Keys.`package` := file(""))
lazy val yaidom = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full)
.in(file("."))
.jvmSettings(
libraryDependencies += "org.scala-lang.modules" %%% "scala-xml" % "2.0.0",
libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.9" % Test,
libraryDependencies += "org.scalatestplus" %%% "scalacheck-1-15" % "3.2.9.0" % Test,
// By all means, override this version of Saxon if needed, possibly with a Saxon-EE release!
libraryDependencies += "net.sf.saxon" % "Saxon-HE" % "9.9.1-8",
libraryDependencies += "com.github.ben-manes.caffeine" % "caffeine" % "2.9.0",
libraryDependencies += "junit" % "junit" % "4.13.2" % Test,
libraryDependencies += "org.scalacheck" %%% "scalacheck" % "1.15.4" % Test,
// JUnit tests (the ones intentionally written in Java) should run as well
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test,
libraryDependencies += "org.ccil.cowan.tagsoup" % "tagsoup" % "1.2.1" % Test,
libraryDependencies += "org.jdom" % "jdom2" % "2.0.6" % Test,
libraryDependencies += ("xom" % "xom" % "1.3.7" % Test).intransitive(),
libraryDependencies += ("com.fasterxml.woodstox" % "woodstox-core" % "6.2.6" % Test).intransitive(),
libraryDependencies += "org.codehaus.woodstox" % "stax2-api" % "4.2.1" % Test,
Compile / unmanagedSources / excludeFilter := (CrossVersion.partialVersion(scalaVersion.value) match {
case (Some((3, _))) =>
new SimpleFileFilter(f => f.toString.contains("ScalaXmlWrapperTest") ||
f.toString.contains("DocumentParserTest") || f.toString.contains("XbrlInstanceQueryTest"))
case _ =>
NothingFilter
}),
testOptions += Tests.Argument(TestFrameworks.JUnit, "+q", "-v"),
mimaPreviousArtifacts := Set("eu.cdevreeze.yaidom" %%% "yaidom" % "1.11.0")
)
.jsConfigure(_.enablePlugins(TzdbPlugin))
.jsSettings(
// Add support for the DOM in `run` and `test`
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv(),
libraryDependencies ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case (Some((3, _))) =>
Seq(
"org.scala-lang.modules" % "scala-xml_sjs1_3" % "2.0.0",
"org.scalatest" % "scalatest_sjs1_3" % "3.2.9" % Test,
"org.scalatestplus" % "scalacheck-1-15_sjs1_3" % "3.2.9.0" % Test,
"io.github.cquiroz" % "scala-java-time_sjs1_3" % "2.3.0",
// Hopefully for3Use2_13 soon not needed anymore
"org.scala-js" % "scalajs-dom_sjs1_2.13" % "1.1.0",
// Hopefully for3Use2_13 soon not needed anymore
"com.lihaoyi" % "scalatags_sjs1_2.13" % "0.9.4" % Optional
)
case _ =>
Seq(
"org.scala-lang.modules" % "scala-xml_sjs1_2.13" % "2.0.0",
"org.scalatest" % "scalatest_sjs1_2.13" % "3.2.9" % Test,
"org.scalatestplus" % "scalacheck-1-15_sjs1_2.13" % "3.2.9.0" % Test,
"io.github.cquiroz" % "scala-java-time_sjs1_2.13" % "2.3.0",
"org.scala-js" % "scalajs-dom_sjs1_2.13" % "1.1.0",
"com.lihaoyi" % "scalatags_sjs1_2.13" % "0.9.4" % Optional
)
}),
Test / parallelExecution := false,
mimaPreviousArtifacts := Set("eu.cdevreeze.yaidom" %%% "yaidom" % "1.11.0")
)
lazy val yaidomJVM = yaidom.jvm
lazy val yaidomJS = yaidom.js
lazy val pomData =
<url>https://github.com/dvreeze/yaidom</url>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>Yaidom is licensed under Apache License, Version 2.0</comments>
</license>
</licenses>
<scm>
<connection>scm:git:git@github.com:dvreeze/yaidom.git</connection>
<url>https://github.com/dvreeze/yaidom.git</url>
<developerConnection>scm:git:git@github.com:dvreeze/yaidom.git</developerConnection>
</scm>
<developers>
<developer>
<id>dvreeze</id>
<name>Chris de Vreeze</name>
<email>chris.de.vreeze@caiway.net</email>
</developer>
</developers>