@@ -21,6 +21,8 @@ dependencies {
2121 // VelocityInternals reaches ConnectedPlayer#getConnection()#getChannel() through MethodHandles.
2222 annotationProcessor(libs.velocity.api)
2323 compileOnly(libs.velocity.api)
24+ // The api of the very jar the proxy image ships, so what compiles is what runs.
25+ compileOnly(files(" proxy/plugins/ViaVersion-5.12.0.jar" ))
2426
2527 // The session count on the server list ping and the trace store the shipper puts to are ipc
2628 // services, so the generated SessionClient and AnticheatClient ride along. They drag in
@@ -42,6 +44,9 @@ dependencies {
4244 implementation(libs.prometheus)
4345 implementation(libs.prometheus.httpserver)
4446
47+ // BackendsTest stands a fake ProxyServer up in front of Backends.
48+ testImplementation(libs.velocity.api)
49+
4550 // Tap tests drive an EmbeddedChannel; velocity-api brings no netty of its own.
4651 testImplementation(libs.netty.transport)
4752 testImplementation(libs.netty.codec)
@@ -163,11 +168,12 @@ val stageProxy = tasks.register<Sync>("stageProxy") {
163168 from(tasks.shadowJar) { into(" plugins" ) }
164169}
165170
166- // A local run of the very thing that ships, differing only in what has to differ: the hub to
167- // forward to, the bind port, and the forwarding secret, each of which is a gradle property.
171+ // A local run of the very thing that ships, differing only in what has to differ: the bind port
172+ // and the forwarding secret, each of which is a gradle property. The hub comes from the ipc
173+ // session service like it does in production; DevServer answers with itself.
168174// Velocity's own state (logs, lang, plugin data) is left alone between runs.
169175//
170- // ./gradlew :bin:proxy-plugin:runProxy -PproxyHub=127.0.0.1:25565 - PproxySecret=abcdef
176+ // ./gradlew :bin:proxy-plugin:runProxy -PproxySecret=abcdef
171177val proxyRunDir = layout.buildDirectory.dir(" proxy/run" )
172178val prepareProxyRun = tasks.register<Sync >(" prepareProxyRun" ) {
173179 group = " proxy"
@@ -179,11 +185,9 @@ val prepareProxyRun = tasks.register<Sync>("prepareProxyRun") {
179185 include(" plugins/*/**" )
180186 }
181187
182- val hub = providers.gradleProperty(" proxyHub" ).getOrElse(" 127.0.0.1:25565" )
183188 val bind = providers.gradleProperty(" proxyBind" ).getOrElse(" 0.0.0.0:25577" )
184189 val secret = providers.gradleProperty(" proxySecret" ).getOrElse(" abcdef" )
185190 val cookieSecret = providers.gradleProperty(" proxyCookieSecret" ).getOrElse(" local dev" )
186- inputs.property(" hub" , hub)
187191 inputs.property(" bind" , bind)
188192 inputs.property(" secret" , secret)
189193 inputs.property(" cookieSecret" , cookieSecret)
@@ -192,16 +196,15 @@ val prepareProxyRun = tasks.register<Sync>("prepareProxyRun") {
192196 val dir = runDir.get().asFile
193197 val config = dir.resolve(" velocity.toml" )
194198 config.writeText(config.readText()
195- .replace(Regex (" (?m)^bind = \" .*\" $" ), " bind = \" $bind \" " )
196- .replace(Regex (" (?m)^anyhub = \" .*\" $" ), " anyhub = \" $hub \" " ))
199+ .replace(Regex (" (?m)^bind = \" .*\" $" ), " bind = \" $bind \" " ))
197200 dir.resolve(" forwarding.secret" ).writeText(secret)
198201 dir.resolve(" cookie.secret" ).writeText(cookieSecret)
199202 }
200203}
201204
202205tasks.register<JavaExec >(" runProxy" ) {
203206 group = " proxy"
204- description = " Runs the staged proxy locally, in front of -PproxyHub (127.0.0.1:25565) ."
207+ description = " Runs the staged proxy locally, in front of whatever hub the ipc session service names ."
205208 dependsOn(prepareProxyRun)
206209 workingDir = proxyRunDir.get().asFile
207210 classpath = files(proxyRunDir.map { it.file(" velocity.jar" ) })
0 commit comments