From 07ca6ee1bea0ea77e0ecc312031d08b9dacb3c5c Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 18 Jan 2025 23:47:29 +0000 Subject: [PATCH 1/2] Update macros, util to 2.6.5 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 19d7099a229fb..7db5621405583 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -70,7 +70,7 @@ object Dependencies { } object macwire { - val version = "2.6.4" + val version = "2.6.5" val macros = "com.softwaremill.macwire" %% "macros" % version % "provided" val util = "com.softwaremill.macwire" %% "util" % version % "provided" val tagging = "com.softwaremill.common" %% "tagging" % "2.3.5" From 99508b1cc42e0aaa0522ed7d2be8543cca36e6ec Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Mon, 20 Jan 2025 09:29:50 +0100 Subject: [PATCH 2/2] fix breaking changes in wire macro implicit resolution after softwaremill/macwire#373 --- app/Env.scala | 36 +++++++++++++----------- modules/game/src/main/Env.scala | 4 +-- modules/irc/src/main/Env.scala | 4 +-- modules/irc/src/main/IrcApi.scala | 5 ++-- modules/pool/src/main/PoolList.scala | 2 +- modules/push/src/main/Env.scala | 4 +-- modules/push/src/main/PushApi.scala | 5 ++-- modules/report/src/main/ReportApi.scala | 5 ++-- modules/round/src/main/Env.scala | 4 +-- modules/title/src/main/Env.scala | 8 +++--- modules/title/src/main/TitleApi.scala | 4 +-- modules/web/src/main/AssetManifest.scala | 2 +- 12 files changed, 44 insertions(+), 39 deletions(-) diff --git a/app/Env.scala b/app/Env.scala index 255e6682ca56a..ee3b4f84cbf17 100644 --- a/app/Env.scala +++ b/app/Env.scala @@ -11,33 +11,36 @@ final class Env( val config: Configuration, val controllerComponents: ControllerComponents, environment: Environment, - shutdown: akka.actor.CoordinatedShutdown + shutdown: akka.actor.CoordinatedShutdown, + cookieBaker: SessionCookieBaker )(using val system: akka.actor.ActorSystem, val executor: Executor)(using StandaloneWSClient, - akka.stream.Materializer, - SessionCookieBaker + akka.stream.Materializer ): val net: NetConfig = config.get[NetConfig]("net") - export net.{ domain, baseUrl, assetBaseUrlInternal } + export net.{ baseUrl, assetBaseUrlInternal } given mode: Mode = environment.mode given translator: lila.core.i18n.Translator = lila.i18n.Translator given scheduler: Scheduler = system.scheduler - given lila.core.config.RateLimit = net.rateLimit + given RateLimit = net.rateLimit + given NetDomain = net.domain // wire all the lila modules in the right order - val i18n: lila.i18n.Env.type = lila.i18n.Env - val mongo: lila.db.Env = wire[lila.db.Env] - val memo: lila.memo.Env = wire[lila.memo.Env] - val socket: lila.socket.Env = wire[lila.socket.Env] - val user: lila.user.Env = wire[lila.user.Env] - val mailer: lila.mailer.Env = wire[lila.mailer.Env] - val oAuth: lila.oauth.Env = wire[lila.oauth.Env] - val security: lila.security.Env = wire[lila.security.Env] - val pref: lila.pref.Env = wire[lila.pref.Env] - val relation: lila.relation.Env = wire[lila.relation.Env] - val game: lila.game.Env = wire[lila.game.Env] + val i18n: lila.i18n.Env.type = lila.i18n.Env + val mongo: lila.db.Env = wire[lila.db.Env] + val memo: lila.memo.Env = wire[lila.memo.Env] + val socket: lila.socket.Env = wire[lila.socket.Env] + val user: lila.user.Env = wire[lila.user.Env] + import user.flairApi.given + val mailer: lila.mailer.Env = wire[lila.mailer.Env] + val oAuth: lila.oauth.Env = wire[lila.oauth.Env] + val security: lila.security.Env = wire[lila.security.Env] + val pref: lila.pref.Env = wire[lila.pref.Env] + val relation: lila.relation.Env = wire[lila.relation.Env] + val game: lila.game.Env = wire[lila.game.Env] + import game.given val notifyM: lila.notify.Env = wire[lila.notify.Env] val irc: lila.irc.Env = wire[lila.irc.Env] val report: lila.report.Env = wire[lila.report.Env] @@ -62,6 +65,7 @@ final class Env( val forum: lila.forum.Env = wire[lila.forum.Env] val forumSearch: lila.forumSearch.Env = wire[lila.forumSearch.Env] val pool: lila.pool.Env = wire[lila.pool.Env] + import pool.isClockCompatible val lobby: lila.lobby.Env = wire[lila.lobby.Env] val setup: lila.setup.Env = wire[lila.setup.Env] val simul: lila.simul.Env = wire[lila.simul.Env] diff --git a/modules/game/src/main/Env.scala b/modules/game/src/main/Env.scala index 4063d9544d166..9401b9889aa2b 100644 --- a/modules/game/src/main/Env.scala +++ b/modules/game/src/main/Env.scala @@ -41,7 +41,7 @@ final class Env( val gameRepo = GameRepo(db(config.gameColl)) - val idGenerator = wire[IdGenerator] + given idGenerator: IdGenerator = wire[IdGenerator] val divider = wire[Divider] @@ -82,7 +82,7 @@ final class Env( export AnonCookie.json as anonCookieJson export AnonCookie.name as anonCookieName - lazy val newPlayer: lila.core.game.NewPlayer = new: + given newPlayer: lila.core.game.NewPlayer = new: export Player.make as apply export Player.makeAnon as anon diff --git a/modules/irc/src/main/Env.scala b/modules/irc/src/main/Env.scala index c173916e54784..8d2acffbc940b 100644 --- a/modules/irc/src/main/Env.scala +++ b/modules/irc/src/main/Env.scala @@ -11,11 +11,11 @@ import lila.core.misc.plan.ChargeEvent @Module final class Env( appConfig: Configuration, - getLightUser: lila.core.LightUser.Getter, noteApi: lila.core.user.NoteApi, ws: StandaloneWSClient, shutdown: akka.actor.CoordinatedShutdown, - mode: Mode + mode: Mode, + getLightUser: lila.core.LightUser.Getter )(using Executor): import ZulipClient.given diff --git a/modules/irc/src/main/IrcApi.scala b/modules/irc/src/main/IrcApi.scala index 0c71a6bfa4790..6cabe44343c0c 100644 --- a/modules/irc/src/main/IrcApi.scala +++ b/modules/irc/src/main/IrcApi.scala @@ -8,8 +8,9 @@ import lila.core.study.data.StudyChapterName final class IrcApi( zulip: ZulipClient, - noteApi: lila.core.user.NoteApi -)(using lightUser: LightUser.Getter, ec: Executor) + noteApi: lila.core.user.NoteApi, + lightUser: LightUser.Getter +)(using Executor) extends lila.core.irc.IrcApi: import IrcApi.* diff --git a/modules/pool/src/main/PoolList.scala b/modules/pool/src/main/PoolList.scala index 331b96e4f1752..d1925e1750b2e 100644 --- a/modules/pool/src/main/PoolList.scala +++ b/modules/pool/src/main/PoolList.scala @@ -29,7 +29,7 @@ object PoolList: val clockStringSet: Set[String] = all.view.map(_.clock.show) to Set - val isClockCompatible: IsClockCompatible = IsClockCompatible: clock => + given isClockCompatible: IsClockCompatible = IsClockCompatible: clock => clockStringSet contains clock.show def json(using lila.core.i18n.Translator) = Json.toJson(all) diff --git a/modules/push/src/main/Env.scala b/modules/push/src/main/Env.scala index 2831ab1c2caf0..38ce331504a91 100644 --- a/modules/push/src/main/Env.scala +++ b/modules/push/src/main/Env.scala @@ -21,13 +21,13 @@ final class Env( appConfig: Configuration, ws: StandaloneWSClient, db: lila.db.Db, - getLightUser: lila.core.LightUser.GetterFallback, gameProxy: lila.core.game.GameProxy, roundJson: lila.core.round.RoundJson, gameRepo: lila.core.game.GameRepo, namer: lila.core.game.Namer, notifyAllows: lila.core.notify.GetNotifyAllows, - postApi: lila.core.forum.ForumPostApi + postApi: lila.core.forum.ForumPostApi, + getLightUser: lila.core.LightUser.GetterFallback )(using Executor, Scheduler): private val config = appConfig.get[PushConfig]("push")(AutoConfig.loader) diff --git a/modules/push/src/main/PushApi.scala b/modules/push/src/main/PushApi.scala index 78010bce5dbf1..86ecb01f66ef1 100644 --- a/modules/push/src/main/PushApi.scala +++ b/modules/push/src/main/PushApi.scala @@ -22,8 +22,9 @@ final private class PushApi( gameRepo: lila.core.game.GameRepo, namer: lila.core.game.Namer, notifyAllows: lila.core.notify.GetNotifyAllows, - postApi: lila.core.forum.ForumPostApi -)(using Executor, Scheduler)(using lightUser: LightUser.GetterFallback): + postApi: lila.core.forum.ForumPostApi, + lightUser: lila.core.LightUser.GetterFallback +)(using Executor, Scheduler): import PushApi.* import PushApi.Data.payload diff --git a/modules/report/src/main/ReportApi.scala b/modules/report/src/main/ReportApi.scala index d1736d73ffdbd..446d3c1ea7c7c 100644 --- a/modules/report/src/main/ReportApi.scala +++ b/modules/report/src/main/ReportApi.scala @@ -21,9 +21,8 @@ final class ReportApi( isOnline: lila.core.socket.IsOnline, cacheApi: lila.memo.CacheApi, snoozer: lila.memo.Snoozer[Report.SnoozeKey], - thresholds: Thresholds, - domain: lila.core.config.NetDomain -)(using Executor, Scheduler) + thresholds: Thresholds +)(using Executor, Scheduler, lila.core.config.NetDomain) extends lila.core.report.ReportApi: import BSONHandlers.given diff --git a/modules/round/src/main/Env.scala b/modules/round/src/main/Env.scala index d1eb76914521f..70f8c1dba42e2 100644 --- a/modules/round/src/main/Env.scala +++ b/modules/round/src/main/Env.scala @@ -29,7 +29,6 @@ final class Env( appConfig: Configuration, db: lila.db.Db, gameRepo: GameRepo, - idGenerator: lila.game.IdGenerator, userRepo: lila.user.UserRepo, userApi: lila.user.UserApi, chatApi: lila.chat.ChatApi, @@ -56,7 +55,8 @@ final class Env( Executor, akka.stream.Materializer, lila.core.i18n.Translator, - lila.core.config.RateLimit + lila.core.config.RateLimit, + lila.game.IdGenerator ): private val (botSync, async) = (lightUserApi.isBotSync, lightUserApi.async) diff --git a/modules/title/src/main/Env.scala b/modules/title/src/main/Env.scala index 1cfe1e0049273..41b04ff8ec861 100644 --- a/modules/title/src/main/Env.scala +++ b/modules/title/src/main/Env.scala @@ -6,10 +6,10 @@ import lila.core.config.CollName import lila.core.lilaism.Lilaism.* @Module -final class Env(db: lila.db.Db, picfitApi: lila.memo.PicfitApi)(using - Executor, - lila.core.config.BaseUrl -)(using scheduler: Scheduler): +final class Env(db: lila.db.Db, picfitApi: lila.memo.PicfitApi, baseUrl: lila.core.config.BaseUrl)(using + ec: Executor, + scheduler: Scheduler +): private val requestColl = db(CollName("title_request")) diff --git a/modules/title/src/main/TitleApi.scala b/modules/title/src/main/TitleApi.scala index 72bc9d70c2ba3..5f8fab515a16a 100644 --- a/modules/title/src/main/TitleApi.scala +++ b/modules/title/src/main/TitleApi.scala @@ -9,7 +9,7 @@ import lila.core.perm.Granter import lila.db.dsl.{ *, given } import lila.memo.PicfitApi -final class TitleApi(coll: Coll, picfitApi: PicfitApi)(using Executor, BaseUrl): +final class TitleApi(coll: Coll, picfitApi: PicfitApi, baseUrl: BaseUrl)(using Executor): import TitleRequest.* @@ -94,7 +94,7 @@ Here is the feedback provided: $feedback -${summon[BaseUrl]}/verify-title +$baseUrl/verify-title """ lila.common.Bus.publish(SystemMsg(to, pm), "msgSystemSend") diff --git a/modules/web/src/main/AssetManifest.scala b/modules/web/src/main/AssetManifest.scala index 304d9824dbc80..23517126055c4 100644 --- a/modules/web/src/main/AssetManifest.scala +++ b/modules/web/src/main/AssetManifest.scala @@ -19,7 +19,7 @@ case class AssetMaps( modified: Instant ) -final class AssetManifest(environment: Environment, net: NetConfig)(using ws: StandaloneWSClient)(using +final class AssetManifest(environment: Environment, net: NetConfig, ws: StandaloneWSClient)(using Executor ): private var maps: AssetMaps = AssetMaps(Map.empty, Map.empty, Map.empty, java.time.Instant.MIN)