Skip to content

Commit c90e6b2

Browse files
committed
feat: update version to 1.10.0 and add withSurfRedis method for improved Redis integration
1 parent be488d5 commit c90e6b2

File tree

5 files changed

+34
-8
lines changed

5 files changed

+34
-8
lines changed

surf-api-gradle-plugin/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ plugins {
2020
group = groupId
2121
version = buildString {
2222
append(mcVersion)
23-
append("-1.9.0")
23+
append("-1.10.0")
2424
if (snapshot) append("-SNAPSHOT")
2525
}
2626

surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/generators/pluginfiles/VelocityPluginFile.kt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,12 @@ class VelocityPluginFile(project: Project) : CommonPluginFile() {
8282
optional = false
8383
}
8484
}
85+
86+
if (extension.withSurfRedis.isPresent && !extension.surfRedisRelocation.isPresent) {
87+
register("surf-redis-velocity") {
88+
optional = false
89+
}
90+
}
8591
}
8692
}
8793

surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/core/CoreSurfExtension.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ open class CoreSurfExtension @Inject constructor(objects: ObjectFactory) :
2020
internal val surfDatabaseR2dbcVersion = objects.property<String>()
2121
internal val surfDatabaseR2dbcRelocation = objects.property<String>()
2222

23+
fun withSurfRedis() {
24+
withSurfRedis.set(true)
25+
withSurfRedis.finalizeValue()
26+
}
27+
28+
@Deprecated(
29+
level = DeprecationLevel.WARNING,
30+
message = "Plugins no longer shade surf-redis. Use the standard withSurfRedis() method instead.",
31+
)
2332
fun withSurfRedis(version: String, relocation: String) {
2433
withSurfRedis.set(true)
2534
withSurfRedis.finalizeValue()

surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/core/CoreSurfPlugin.kt

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package dev.slne.surf.surfapi.gradle.platform.core
22

33
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
4+
import dev.slne.surf.surfapi.gradle.generated.Constants
45
import dev.slne.surf.surfapi.gradle.platform.SurfApiPlatform
56
import dev.slne.surf.surfapi.gradle.platform.common.CommonSurfPlugin
67
import org.gradle.api.Project
78
import org.gradle.api.model.ObjectFactory
89
import org.gradle.kotlin.dsl.dependencies
910
import org.gradle.kotlin.dsl.withType
1011
import org.jetbrains.kotlin.gradle.utils.API
12+
import org.jetbrains.kotlin.gradle.utils.COMPILE_ONLY
1113

1214
internal abstract class AbstractCoreSurfPlugin<E : CoreSurfExtension>(
1315
platformName: String, platform: SurfApiPlatform,
@@ -20,13 +22,18 @@ internal abstract class AbstractCoreSurfPlugin<E : CoreSurfExtension>(
2022

2123
final override fun Project.afterEvaluated0(extension: E) {
2224
if (extension.withSurfRedis.get()) {
23-
dependencies {
24-
add(API, "dev.slne.surf:surf-redis:${extension.surfRedisVersion.get()}")
25-
}
26-
27-
tasks.withType<ShadowJar>().configureEach {
28-
doFirst {
29-
relocate("dev.slne.surf.redis", extension.surfRedisRelocation.get())
25+
if (extension.surfRedisRelocation.isPresent) {
26+
dependencies {
27+
add(API, "dev.slne.surf:surf-redis:${extension.surfRedisVersion.get()}")
28+
}
29+
tasks.withType<ShadowJar>().configureEach {
30+
doFirst {
31+
relocate("dev.slne.surf.redis", extension.surfRedisRelocation.get())
32+
}
33+
}
34+
} else {
35+
dependencies {
36+
add(COMPILE_ONLY, "dev.slne.surf:surf-redis-api:${Constants.SURF_API_VERSION}")
3037
}
3138
}
3239
}

surf-api-gradle-plugin/src/main/kotlin/dev/slne/surf/surfapi/gradle/platform/paper/plugin/PaperPluginSurfPlugin.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ internal class PaperPluginSurfPlugin :
6767
registerRequired("surf-core-paper")
6868
}
6969

70+
if (extension.withSurfRedis.isPresent && !extension.surfRedisRelocation.isPresent) {
71+
registerRequired("surf-redis-paper")
72+
}
73+
7074
extension.serverDependencies.orNull?.execute(this)
7175
}
7276
}

0 commit comments

Comments
 (0)