-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sbt
145 lines (134 loc) · 4.46 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
val scala212 = "2.12.20"
val scala213 = "2.13.15"
val scala300 = "3.3.4"
val versionsBase = Seq(scala212, scala213)
val versionsJVM = versionsBase :+ scala300
val versionsJS = versionsJVM
val versionsNative = versionsJVM
ThisBuild / scalaVersion := scala213
ThisBuild / versionScheme := Some("early-semver")
ThisBuild / resolvers ++= Resolver.sonatypeOssRepos("snapshots")
inThisBuild(
List(
description := "A version of java.time library for Scala.js and Scala Native",
organization := "org.ekrich",
homepage := Some(url("https://github.com/ekrich/sjavatime")),
licenses := List(
"BSD 3-Clause" ->
url("https://github.com/ekrich/sjavatime/blob/master/LICENSE.txt")
),
developers := List(
// for this fork
Developer(id = "ekrich",
name = "Eric K Richardson",
email = "[email protected]",
url = url("http://github.ekrich.org/")),
// original developers
Developer(id = "sjrd",
name = "Sébastien Doeraene",
email = "",
url = url("https://github.com/sjrd/")),
Developer(id = "gzm0",
name = "Tobias Schlatter",
email = "",
url = url("https://github.com/gzm0/")),
Developer(id = "nicolasstucki",
name = "Nicolas Stucki",
email = "",
url = url("https://github.com/nicolasstucki/"))
)
)
)
val depSettings = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Nil
case Some((2, 12)) => Seq("-target:jvm-1.8", "-Xsource:3")
case Some((2, 13)) => Seq("-Xsource:3")
case _ => Nil
}
}
lazy val disabledDocsSettings = Def.settings(
Compile / doc / sources := Nil
)
val commonSettings: Seq[Setting[_]] = Seq(
scalacOptions ++= Seq("-unchecked", "-deprecation",
"-feature") ++ depSettings.value
)
lazy val root = (project in file("."))
.settings(
name := "sjavatime-root",
crossScalaVersions := Nil,
doc / aggregate := false,
doc := (sjavatimeJS / Compile / doc).value,
packageDoc / aggregate := false,
packageDoc := (sjavatimeJS / Compile / packageDoc).value
)
.settings(skipPublish: _*)
.aggregate(
sjavatimeJS,
sjavatimeNative,
testSuiteJVM,
testSuiteJS,
testSuiteNative
)
lazy val sjavatime = crossProject(JSPlatform, NativePlatform)
.crossType(CrossType.Full)
.settings(commonSettings)
.settings(disabledDocsSettings)
.settings(
Test / test := {},
Compile / packageBin / mappings ~= {
_.filter(!_._2.endsWith(".class"))
}
)
.jsSettings(
crossScalaVersions := versionsJS
)
.nativeSettings(
Compile / run := {},
crossScalaVersions := versionsNative,
logLevel := Level.Info // Info or Debug
)
lazy val sjavatimeJS = sjavatime.js
lazy val sjavatimeNative = sjavatime.native
lazy val testSuite = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(commonSettings)
.settings(skipPublish)
.settings(
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-s", "-v")
)
.jvmSettings(
name := "java.time testSuite on JVM",
crossScalaVersions := versionsJVM,
libraryDependencies +=
"com.github.sbt" % "junit-interface" % "0.13.3" % Test
)
.jsSettings(
name := "java.time testSuite on JS",
crossScalaVersions := versionsJS,
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.CommonJSModule))
)
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.jsConfigure(_.dependsOn(sjavatimeJS))
.nativeSettings(
name := "java.time testSuite on Native",
crossScalaVersions := versionsNative,
addCompilerPlugin(
"org.scala-native" % "junit-plugin" % nativeVersion cross CrossVersion.full
),
libraryDependencies += "org.scala-native" %%% "junit-runtime" % nativeVersion
)
.nativeConfigure(_.dependsOn(sjavatimeNative))
lazy val testSuiteJS = testSuite.js
lazy val testSuiteNative = testSuite.native
lazy val testSuiteJVM = testSuite.jvm
val skipPublish = Seq(
// no artifacts in this project
publishArtifact := false,
// make-pom has a more specific publishArtifact setting already
// so needs specific override
makePom / publishArtifact := false,
// no docs to publish
packageDoc / publishArtifact := false,
publish / skip := true
)