-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.sbt
More file actions
156 lines (140 loc) · 5.57 KB
/
build.sbt
File metadata and controls
156 lines (140 loc) · 5.57 KB
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
import xerial.sbt.Sonatype.sonatypeCentralHost
import net.nmoncho.sbt.dependencycheck.settings._
val scala213Version = "2.13.16"
val scala3Version = "3.3.4"
val zioVersion = "2.1.14"
val openFeatureSdkVersion = "1.20.2"
// OpenFeature Specification Compatibility
// Spec version: v0.8.0 (https://github.com/open-feature/spec)
// This library implements the dynamic-context (server-side) paradigm
ThisBuild / scalaVersion := scala3Version
ThisBuild / crossScalaVersions := Seq(scala213Version, scala3Version)
ThisBuild / organization := "io.github.etacassiopeia"
// Version is derived from git tags by sbt-dynver
// Tags should follow SemVer: v0.1.0, v1.0.0, etc.
// Snapshots are automatically versioned as: 0.1.0+3-abcd1234-SNAPSHOT
ThisBuild / homepage := Some(url("https://github.com/EtaCassiopeia/zio-openfeature"))
ThisBuild / licenses := List("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0"))
ThisBuild / developers := List(
Developer(
id = "EtaCassiopeia",
name = "Mohsen Zainalpour",
email = "zainalpour@gmail.com",
url = url("https://github.com/EtaCassiopeia")
)
)
ThisBuild / scmInfo := Some(
ScmInfo(
url("https://github.com/EtaCassiopeia/zio-openfeature"),
"scm:git:git@github.com:EtaCassiopeia/zio-openfeature.git"
)
)
// Publishing to Sonatype Central
ThisBuild / sonatypeCredentialHost := sonatypeCentralHost
ThisBuild / versionScheme := Some("semver-spec")
// Common scalac options for both versions
ThisBuild / scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-unchecked",
"-language:implicitConversions",
"-language:higherKinds"
)
// Version-specific scalac options
ThisBuild / scalacOptions ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq("-Xsource:3", "-Wconf:cat=scala3-migration:w")
case Some((3, _)) => Seq("-Xfatal-warnings", "-Yretain-trees")
case _ => Seq()
}
}
ThisBuild / coverageEnabled := false
ThisBuild / coverageMinimumStmtTotal := 80
ThisBuild / coverageFailOnMinimum := true
// Version-specific source directories
lazy val crossVersionSourceDirs = Seq(
Compile / unmanagedSourceDirectories ++= {
val sourceDir = (Compile / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(sourceDir / "scala-2")
case Some((3, _)) => Seq(sourceDir / "scala-3")
case _ => Seq()
}
},
Test / unmanagedSourceDirectories ++= {
val sourceDir = (Test / sourceDirectory).value
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) => Seq(sourceDir / "scala-2")
case Some((3, _)) => Seq(sourceDir / "scala-3")
case _ => Seq()
}
}
)
lazy val commonSettings = Seq(
testFrameworks += new TestFramework("zio.test.sbt.ZTestFramework"),
libraryDependencies ++= Seq(
"dev.zio" %% "zio-test" % zioVersion % Test,
"dev.zio" %% "zio-test-sbt" % zioVersion % Test
)
) ++ crossVersionSourceDirs
lazy val root = (project in file("."))
.aggregate(core, testkit, extras, ofrep)
.settings(
name := "zio-openfeature",
publish / skip := true,
dependencyCheckFailBuildOnCVSS := 7,
dependencyCheckNvdApi := NvdApiSettings(apiKey = sys.env.getOrElse("NVD_API_KEY", "")),
dependencyCheckDataDirectory := Some(new File(Path.userHome.absolutePath, ".dependency-check/data"))
)
// Core module - ZIO wrapper around OpenFeature SDK
lazy val core = (project in file("core"))
.settings(
name := "zio-openfeature-core",
commonSettings,
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-streams" % zioVersion,
"dev.openfeature" % "sdk" % openFeatureSdkVersion
)
)
// Extras module - built-in providers (HOCON, env vars, caching wrapper)
lazy val extras = (project in file("extras"))
.dependsOn(core)
.settings(
name := "zio-openfeature-extras",
commonSettings,
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-cache" % "0.2.3",
"com.typesafe" % "config" % "1.4.3"
)
)
// OFREP module - OpenFeature Remote Evaluation Protocol provider.
// Kept separate from `extras` so callers who only want HOCON/env vars don't pull in the OFREP contrib provider's
// transitive HTTP-client stack (Jackson, Guava, Commons Validator, SLF4J).
lazy val ofrep = (project in file("ofrep"))
.dependsOn(core)
.settings(
name := "zio-openfeature-ofrep",
commonSettings,
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.openfeature.contrib.providers" % "ofrep" % "0.0.1",
"org.wiremock" % "wiremock" % "3.10.0" % Test
),
// GHSA-72hv-8253-57qq (jackson-core <2.18.0) is patched in 2.18+; the OFREP contrib provider pulls 2.21.2, so we
// override jackson-core to that version to avoid a split Jackson family (core 2.18 / databind 2.21 → runtime
// NoSuchMethodError). Scoped to this module so other modules aren't dragged into Jackson alignment they don't need.
dependencyOverrides += "com.fasterxml.jackson.core" % "jackson-core" % "2.21.2"
)
// Testkit module - testing utilities
lazy val testkit = (project in file("testkit"))
.dependsOn(core)
.settings(
name := "zio-openfeature-testkit",
commonSettings,
libraryDependencies ++= Seq(
"dev.zio" %% "zio" % zioVersion,
"dev.zio" %% "zio-test" % zioVersion
)
)