Skip to content

Commit 28200b5

Browse files
authored
Merge branch 'main' into update/scalafmt-core-3.8.6
2 parents 1e39112 + c7efda0 commit 28200b5

File tree

6 files changed

+128
-41
lines changed

6 files changed

+128
-41
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,24 @@ concurrency:
2424

2525
jobs:
2626
build:
27-
name: Build and Test
27+
name: Test
2828
strategy:
2929
matrix:
30-
os: [ubuntu-latest]
30+
os: [ubuntu-22.04]
3131
scala: [2.13, 3]
3232
java: [temurin@8]
3333
project: [rootJVM]
3434
runs-on: ${{ matrix.os }}
3535
timeout-minutes: 60
3636
steps:
37-
- name: Install sbt
38-
if: contains(runner.os, 'macos')
39-
run: brew install sbt
40-
4137
- name: Checkout current branch (full)
4238
uses: actions/checkout@v4
4339
with:
4440
fetch-depth: 0
4541

42+
- name: Setup sbt
43+
uses: sbt/setup-sbt@v1
44+
4645
- name: Setup Java (temurin@8)
4746
id: setup-java-temurin-8
4847
if: matrix.java == 'temurin@8'
@@ -60,18 +59,18 @@ jobs:
6059
run: sbt githubWorkflowCheck
6160

6261
- name: Check headers and formatting
63-
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
62+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
6463
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck
6564

6665
- name: Test
6766
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test
6867

6968
- name: Check binary compatibility
70-
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
69+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
7170
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues
7271

7372
- name: Generate API documentation
74-
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
73+
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-22.04'
7574
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc
7675

7776
- name: Make target directories
@@ -95,19 +94,18 @@ jobs:
9594
if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')
9695
strategy:
9796
matrix:
98-
os: [ubuntu-latest]
97+
os: [ubuntu-22.04]
9998
java: [temurin@8]
10099
runs-on: ${{ matrix.os }}
101100
steps:
102-
- name: Install sbt
103-
if: contains(runner.os, 'macos')
104-
run: brew install sbt
105-
106101
- name: Checkout current branch (full)
107102
uses: actions/checkout@v4
108103
with:
109104
fetch-depth: 0
110105

106+
- name: Setup sbt
107+
uses: sbt/setup-sbt@v1
108+
111109
- name: Setup Java (temurin@8)
112110
id: setup-java-temurin-8
113111
if: matrix.java == 'temurin@8'
@@ -167,22 +165,21 @@ jobs:
167165

168166
dependency-submission:
169167
name: Submit Dependencies
170-
if: github.event_name != 'pull_request'
168+
if: github.event.repository.fork == false && github.event_name != 'pull_request'
171169
strategy:
172170
matrix:
173-
os: [ubuntu-latest]
171+
os: [ubuntu-22.04]
174172
java: [temurin@8]
175173
runs-on: ${{ matrix.os }}
176174
steps:
177-
- name: Install sbt
178-
if: contains(runner.os, 'macos')
179-
run: brew install sbt
180-
181175
- name: Checkout current branch (full)
182176
uses: actions/checkout@v4
183177
with:
184178
fetch-depth: 0
185179

180+
- name: Setup sbt
181+
uses: sbt/setup-sbt@v1
182+
186183
- name: Setup Java (temurin@8)
187184
id: setup-java-temurin-8
188185
if: matrix.java == 'temurin@8'
@@ -206,19 +203,18 @@ jobs:
206203
name: Generate Site
207204
strategy:
208205
matrix:
209-
os: [ubuntu-latest]
206+
os: [ubuntu-22.04]
210207
java: [temurin@11]
211208
runs-on: ${{ matrix.os }}
212209
steps:
213-
- name: Install sbt
214-
if: contains(runner.os, 'macos')
215-
run: brew install sbt
216-
217210
- name: Checkout current branch (full)
218211
uses: actions/checkout@v4
219212
with:
220213
fetch-depth: 0
221214

215+
- name: Setup sbt
216+
uses: sbt/setup-sbt@v1
217+
222218
- name: Setup Java (temurin@8)
223219
id: setup-java-temurin-8
224220
if: matrix.java == 'temurin@8'

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ThisBuild / tlSonatypeUseLegacyHost := false
1717
// publish website from this branch
1818
ThisBuild / tlSitePublishBranch := Some("main")
1919

20-
val Scala213 = "2.13.14"
20+
val Scala213 = "2.13.16"
2121
ThisBuild / crossScalaVersions := Seq(Scala213, "3.3.3")
2222
ThisBuild / scalaVersion := Scala213 // the default Scala
2323

core/src/main/scala/org.typelevel/catapult/LaunchDarklyClient.scala

Lines changed: 77 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package org.typelevel.catapult
1818

1919
import cats.effect.std.{Dispatcher, Queue}
2020
import cats.effect.{Async, Resource}
21-
import cats.~>
21+
import cats.{~>, Applicative}
2222
import com.launchdarkly.sdk.server.interfaces.{FlagValueChangeEvent, FlagValueChangeListener}
2323
import com.launchdarkly.sdk.server.{LDClient, LDConfig}
2424
import com.launchdarkly.sdk.LDValue
@@ -115,7 +115,7 @@ trait LaunchDarklyClient[F[_]] {
115115
*/
116116
def flush: F[Unit]
117117

118-
def mapK[G[_]](fk: F ~> G): LaunchDarklyClient[G]
118+
def mapK[G[_]](fk: F ~> G): LaunchDarklyClient[G] = LaunchDarklyClient.mapK[F, G](this)(fk)
119119
}
120120

121121
object LaunchDarklyClient {
@@ -213,17 +213,84 @@ object LaunchDarklyClient {
213213

214214
override def flush: F[Unit] = unsafeWithJavaClient(_.flush())
215215

216-
override def mapK[G[_]](fk: F ~> G): LaunchDarklyClient[G] = new LaunchDarklyClient.Default[G] {
217-
override def unsafeWithJavaClient[A](f: LDClient => A): G[A] = fk(
218-
self.unsafeWithJavaClient(f)
219-
)
216+
// TODO: Remove on next bin changing release, had to keep this for bin-compat.
217+
override def mapK[G[_]](fk: F ~> G): LaunchDarklyClient[G] = LaunchDarklyClient.mapK(this)(fk)
218+
}
219+
220+
def noop[F[_]](implicit F: Applicative[F]): LaunchDarklyClient[F] = new LaunchDarklyClient[F] {
221+
override def boolVariation[Ctx: ContextEncoder](
222+
featureKey: String,
223+
context: Ctx,
224+
defaultValue: Boolean,
225+
): F[Boolean] = F.pure(defaultValue)
226+
override def doubleVariation[Ctx: ContextEncoder](
227+
featureKey: String,
228+
context: Ctx,
229+
defaultValue: Double,
230+
): F[Double] = F.pure(defaultValue)
231+
override def intVariation[Ctx: ContextEncoder](
232+
featureKey: String,
233+
context: Ctx,
234+
defaultValue: Int,
235+
): F[Int] = F.pure(defaultValue)
236+
override def jsonValueVariation[Ctx: ContextEncoder](
237+
featureKey: String,
238+
context: Ctx,
239+
defaultValue: LDValue,
240+
): F[LDValue] = F.pure(defaultValue)
241+
override def stringVariation[Ctx: ContextEncoder](
242+
featureKey: String,
243+
context: Ctx,
244+
defaultValue: String,
245+
): F[String] = F.pure(defaultValue)
246+
247+
override def trackFlagValueChanges[Ctx: ContextEncoder](
248+
featureKey: String,
249+
context: Ctx,
250+
): fs2.Stream[F, FlagValueChangeEvent] = fs2.Stream.empty
251+
252+
override def flush: F[Unit] = Applicative[F].unit
253+
}
254+
255+
def mapK[F[_], G[_]](self: LaunchDarklyClient[F])(fk: F ~> G): LaunchDarklyClient[G] =
256+
new LaunchDarklyClient[G] {
257+
override def boolVariation[Ctx: ContextEncoder](
258+
featureKey: String,
259+
context: Ctx,
260+
defaultValue: Boolean,
261+
): G[Boolean] = fk(self.boolVariation(featureKey, context, defaultValue))
262+
263+
override def doubleVariation[Ctx: ContextEncoder](
264+
featureKey: String,
265+
context: Ctx,
266+
defaultValue: Double,
267+
): G[Double] = fk(self.doubleVariation(featureKey, context, defaultValue))
268+
269+
override def intVariation[Ctx: ContextEncoder](
270+
featureKey: String,
271+
context: Ctx,
272+
defaultValue: Int,
273+
): G[Int] = fk(self.intVariation(featureKey, context, defaultValue))
274+
275+
override def jsonValueVariation[Ctx: ContextEncoder](
276+
featureKey: String,
277+
context: Ctx,
278+
defaultValue: LDValue,
279+
): G[LDValue] = fk(self.jsonValueVariation(featureKey, context, defaultValue))
280+
281+
override def stringVariation[Ctx: ContextEncoder](
282+
featureKey: String,
283+
context: Ctx,
284+
defaultValue: String,
285+
): G[String] = fk(self.stringVariation(featureKey, context, defaultValue))
220286

221-
override def trackFlagValueChanges[Ctx](featureKey: String, context: Ctx)(implicit
222-
ctxEncoder: ContextEncoder[Ctx]
223-
): Stream[G, FlagValueChangeEvent] =
287+
override def trackFlagValueChanges[Ctx: ContextEncoder](
288+
featureKey: String,
289+
context: Ctx,
290+
): fs2.Stream[G, FlagValueChangeEvent] =
224291
self.trackFlagValueChanges(featureKey, context).translate(fk)
225292

226293
override def flush: G[Unit] = fk(self.flush)
227294
}
228-
}
295+
229296
}

mtl/src/main/scala/org.typelevel/catapult/mtl/LaunchDarklyMTLClient.scala

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,29 @@ object LaunchDarklyMTLClient {
140140
Stream.eval(contextAsk.ask).flatMap(launchDarklyClient.trackFlagValueChanges(featureKey, _))
141141
}
142142

143+
def noop[F[_]](implicit F: Applicative[F]): LaunchDarklyMTLClient[F] =
144+
new LaunchDarklyMTLClient[F] {
145+
override def boolVariation(featureKey: String, defaultValue: Boolean): F[Boolean] =
146+
F.pure(defaultValue)
147+
148+
override def stringVariation(featureKey: String, defaultValue: String): F[String] =
149+
F.pure(defaultValue)
150+
151+
override def intVariation(featureKey: String, defaultValue: Int): F[Int] =
152+
F.pure(defaultValue)
153+
154+
override def doubleVariation(featureKey: String, defaultValue: Double): F[Double] =
155+
F.pure(defaultValue)
156+
157+
override def jsonValueVariation(featureKey: String, defaultValue: LDValue): F[LDValue] =
158+
F.pure(defaultValue)
159+
160+
override def trackFlagValueChanges(featureKey: String): Stream[F, FlagValueChangeEvent] =
161+
Stream.empty
162+
163+
override val flush: F[Unit] = F.unit
164+
}
165+
143166
def mapK[F[_], G[_]](ldc: LaunchDarklyMTLClient[F])(fk: F ~> G): LaunchDarklyMTLClient[G] =
144167
new LaunchDarklyMTLClient[G] {
145168
override def boolVariation(featureKey: String, defaultValue: Boolean): G[Boolean] =
@@ -160,6 +183,6 @@ object LaunchDarklyMTLClient {
160183
override def trackFlagValueChanges(featureKey: String): Stream[G, FlagValueChangeEvent] =
161184
ldc.trackFlagValueChanges(featureKey).translate(fk)
162185

163-
override def flush: G[Unit] = fk(ldc.flush)
186+
override val flush: G[Unit] = fk(ldc.flush)
164187
}
165188
}

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.10.1
1+
sbt.version=1.10.7

project/plugins.sbt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.2")
2-
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.7.2")
3-
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")
1+
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.7.7")
2+
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % "0.7.7")
3+
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2")
4+
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.7")

0 commit comments

Comments
 (0)