-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sbt
133 lines (118 loc) · 4.19 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
/*
* Copyright 2021 http4s.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.{ChromeDriver, ChromeOptions}
import org.openqa.selenium.firefox.{FirefoxOptions, FirefoxProfile}
import org.openqa.selenium.remote.server.{DriverFactory, DriverProvider}
import org.scalajs.jsenv.selenium.SeleniumJSEnv
import JSEnv._
name := "http4s-crypto"
ThisBuild / tlBaseVersion := "0.2"
ThisBuild / developers := List(
tlGitHubDev("armanbilge", "Arman Bilge")
)
ThisBuild / startYear := Some(2021)
ThisBuild / crossScalaVersions := Seq("3.3.1", "2.12.18", "2.13.11")
ThisBuild / githubWorkflowBuildPreamble ++= Seq(
WorkflowStep.Use(
UseRef.Public("actions", "setup-node", "v2.4.0"),
name = Some("Setup NodeJS v18 LTS"),
params = Map("node-version" -> "18"),
cond = Some("matrix.project == 'rootJS' && matrix.jsenv == 'NodeJS'")
)
)
val jsenvs = List(NodeJS, Chrome, Firefox).map(_.toString)
ThisBuild / githubWorkflowBuildMatrixAdditions += "jsenv" -> jsenvs
ThisBuild / githubWorkflowBuildSbtStepPreamble += s"set Global / useJSEnv := JSEnv.$${{ matrix.jsenv }}"
ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
for {
scala <- List("2.12", "3")
jsenv <- jsenvs.tail
} yield MatrixExclude(Map("scala" -> scala, "jsenv" -> jsenv))
}
ThisBuild / githubWorkflowBuildMatrixExclusions ++= {
for {
jsenv <- jsenvs.tail
project <- List("rootJVM", "rootNative")
} yield MatrixExclude(Map("project" -> project, "jsenv" -> jsenv))
}
lazy val useJSEnv =
settingKey[JSEnv]("Use Node.js or a headless browser for running Scala.js tests")
Global / useJSEnv := NodeJS
ThisBuild / Test / jsEnv := {
val old = (Test / jsEnv).value
useJSEnv.value match {
case NodeJS => old
case Firefox =>
val options = new FirefoxOptions()
options.setHeadless(true)
new SeleniumJSEnv(options)
case Chrome =>
val options = new ChromeOptions()
options.setHeadless(true)
new SeleniumJSEnv(options)
}
}
val catsVersion = "2.10.0"
val catsEffectVersion = "3.5.2"
val scodecBitsVersion = "1.1.38"
val munitVersion = "1.0.0-M10"
val munitCEVersion = "2.0.0-M3"
val disciplineMUnitVersion = "2.0.0-M3"
lazy val root = tlCrossRootProject.aggregate(crypto, testRuntime)
lazy val crypto = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.in(file("crypto"))
.settings(
name := "http4s-crypto",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-core" % catsVersion,
"org.typelevel" %%% "cats-effect-kernel" % catsEffectVersion,
"org.scodec" %%% "scodec-bits" % scodecBitsVersion,
"org.scalameta" %%% "munit" % munitVersion % Test,
"org.typelevel" %%% "cats-laws" % catsVersion % Test,
"org.typelevel" %%% "cats-effect" % catsEffectVersion % Test,
"org.typelevel" %%% "discipline-munit" % disciplineMUnitVersion % Test,
"org.typelevel" %%% "munit-cats-effect" % munitCEVersion % Test
)
)
.nativeSettings(
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "0.2.4").toMap,
unusedCompileDependenciesTest := {}
)
.dependsOn(testRuntime % Test)
lazy val testRuntime = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.in(file("test-runtime"))
.enablePlugins(BuildInfoPlugin, NoPublishPlugin)
.settings(
buildInfoPackage := "org.http4s.crypto"
)
.jvmSettings(
buildInfoKeys := Seq(
BuildInfoKey.sbtbuildinfoConstantEntry("runtime" -> "JVM")
)
)
.jsSettings(
buildInfoKeys := Seq(
BuildInfoKey("runtime" -> useJSEnv.value.toString)
)
)
.nativeSettings(
buildInfoKeys := Seq(
BuildInfoKey("runtime" -> "Native")
),
unusedCompileDependenciesTest := {}
)