-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sbt
112 lines (86 loc) · 4.02 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
// 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.2.2"
val crossScalaVer = Seq(scalaVer) // Used to add version 2.13.10 as cross-version
ThisBuild / description := "XPath parser and XPath AST API"
ThisBuild / organization := "eu.cdevreeze.xpathparser"
ThisBuild / version := "0.9.0-SNAPSHOT"
ThisBuild / scalaVersion := scalaVer
ThisBuild / crossScalaVersions := crossScalaVer
ThisBuild / scalacOptions ++= (CrossVersion.partialVersion(scalaVersion.value) match {
case (Some((3, _))) =>
Seq("-unchecked", "-deprecation", "-feature", "-Xfatal-warnings")
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 }
val catsVersion = "2.9.0"
// This is what I wanted to do, but that caused ScalaJS linker errors. Hence the repeated dependencies below.
// ThisBuild / libraryDependencies += "org.typelevel" %%% "cats-core" % catsVersion
// ThisBuild / libraryDependencies += "org.typelevel" %%% "cats-parse" % "0.3.9"
ThisBuild / libraryDependencies += "org.scalatest" %%% "scalatest" % "3.2.11" % Test
lazy val root = project.in(file("."))
.aggregate(xpathparserJVM, xpathparserJS)
.settings(
name := "xpathparser",
// 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 xpathparser = crossProject(JSPlatform, JVMPlatform)
.crossType(CrossType.Full)
.in(file("."))
.jvmSettings(
libraryDependencies += "org.typelevel" %%% "cats-core" % catsVersion,
libraryDependencies += "org.typelevel" %%% "cats-parse" % "0.3.9",
mimaPreviousArtifacts := Set("eu.cdevreeze.xpathparser" %%% "xpathparser" % "0.7.0")
)
.jsSettings(
// Do we need this jsEnv?
jsEnv := new org.scalajs.jsenv.jsdomnodejs.JSDOMNodeJSEnv(),
scalaJSUseMainModuleInitializer := false,
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.4.0",
libraryDependencies += "org.typelevel" %%% "cats-core" % catsVersion,
libraryDependencies += "org.typelevel" %%% "cats-parse" % "0.3.9",
libraryDependencies += "com.lihaoyi" %%% "pprint" % "0.8.1",
mimaPreviousArtifacts := Set("eu.cdevreeze.xpathparser" %%% "xpathparser" % "0.7.0")
)
lazy val xpathparserJVM = xpathparser.jvm
lazy val xpathparserJS = xpathparser.js
lazy val pomData =
<url>https://github.com/dvreeze/xpathparser</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>XPathParser is licensed under Apache License, Version 2.0</comments>
</license>
</licenses>
<scm>
<connection>scm:git:git@github.com:dvreeze/xpathparser.git</connection>
<url>https://github.com/dvreeze/xpathparser.git</url>
<developerConnection>scm:git:git@github.com:dvreeze/xpathparser.git</developerConnection>
</scm>
<developers>
<developer>
<id>dvreeze</id>
<name>Chris de Vreeze</name>
<email>chris.de.vreeze@caiway.net</email>
</developer>
</developers>