File tree Expand file tree Collapse file tree 8 files changed +52
-3
lines changed
src/main/kotlin/dev/slne/surf/surfapi/gradle Expand file tree Collapse file tree 8 files changed +52
-3
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ plugins {
2020group = groupId
2121version = buildString {
2222 append(mcVersion)
23- append(" -1.1.10 " )
23+ append(" -1.2.0 " )
2424 if (snapshot) append(" -SNAPSHOT" )
2525}
2626
Original file line number Diff line number Diff line change 1+ package dev.slne.surf.surfapi.gradle
2+
3+ enum class SurfCloudModules (val module : String ) {
4+ COMMON (" surf-cloud-api-common" ),
5+ CLIENT_COMMON (" surf-cloud-api-client-common" ),
6+ CLIENT_PAPER (" surf-cloud-api-client-paper" ),
7+ CLIENT_VELOCITY (" surf-cloud-api-client-velocity" ),
8+ SERVER (" surf-cloud-api-server" ),
9+ }
Original file line number Diff line number Diff line change 11package dev.slne.surf.surfapi.gradle.platform.common
22
3+ import dev.slne.surf.surfapi.gradle.SurfCloudModules
34import org.gradle.api.model.ObjectFactory
45import org.gradle.kotlin.dsl.property
56import org.jetbrains.annotations.MustBeInvokedByOverriders
@@ -9,6 +10,7 @@ abstract class CommonSurfExtension(protected val objects: ObjectFactory) {
910 internal val surfApiScope = objects.property<String >()
1011 internal val publishingUrl = objects.property<String >().convention(" https://repo.slne.dev/repository/maven-releases" )
1112 internal val publishingRepoName = objects.property<String >().convention(" maven-releases" )
13+ internal val cloudModule = objects.property<SurfCloudModules >()
1214
1315 fun addSurfApiToClasspath (value : Boolean ) {
1416 addSurfApiToClasspath.set(value)
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import org.gradle.kotlin.dsl.withType
1717import org.jetbrains.kotlin.allopen.gradle.AllOpenExtension
1818import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
1919import org.jetbrains.kotlin.gradle.utils.COMPILE_ONLY
20+ import org.jetbrains.kotlin.gradle.utils.IMPLEMENTATION
2021
2122abstract class CommonSurfPlugin <E : CommonSurfExtension >(
2223 protected val platformName : String ,
@@ -130,8 +131,6 @@ abstract class CommonSurfPlugin<E : CommonSurfExtension>(
130131 .distinct()
131132 .toList()
132133
133- println (" contains surf-cloud-api-common: ${deps.any { it.contains(" surf-cloud-api-common" ) }} " )
134-
135134 dependencyDependentRelocations.forEach { (dependency, relocations) ->
136135 if (deps.any { it.contains(dependency) }) {
137136 logger.warn(" Dependency $dependency found. Applying relocations." )
@@ -190,6 +189,20 @@ abstract class CommonSurfPlugin<E : CommonSurfExtension>(
190189 }
191190 }
192191
192+ val cloudModule = extension.cloudModule.orNull
193+ if (cloudModule != null ) {
194+ dependencies {
195+ add(
196+ IMPLEMENTATION ,
197+ platform(" dev.slne.surf.cloud:surf-cloud-bom:${Constants .SURF_API_VERSION } " )
198+ )
199+ add(
200+ COMPILE_ONLY ,
201+ " dev.slne.surf.cloud:${cloudModule.module} :${Constants .SURF_API_VERSION } "
202+ )
203+ }
204+ }
205+
193206 afterEvaluated0(extension)
194207 }
195208
Original file line number Diff line number Diff line change 11package dev.slne.surf.surfapi.gradle.platform.core
22
3+ import dev.slne.surf.surfapi.gradle.SurfCloudModules
34import dev.slne.surf.surfapi.gradle.platform.common.CommonSurfExtension
45import org.gradle.api.model.ObjectFactory
56import org.gradle.kotlin.dsl.listProperty
@@ -8,4 +9,16 @@ import javax.inject.Inject
89open class CoreSurfExtension @Inject constructor(objects : ObjectFactory ) :
910 CommonSurfExtension (objects) {
1011 val authors = objects.listProperty<String >().convention(mutableListOf (" SLNE Development" ))
12+
13+ fun withCloudCommon () {
14+ cloudModule.set(SurfCloudModules .COMMON )
15+ }
16+
17+ fun withCloudClientCommon () {
18+ cloudModule.set(SurfCloudModules .CLIENT_COMMON )
19+ }
20+
21+ fun withCloudServer () {
22+ cloudModule.set(SurfCloudModules .SERVER )
23+ }
1124}
Original file line number Diff line number Diff line change 11package dev.slne.surf.surfapi.gradle.platform.paper
22
3+ import dev.slne.surf.surfapi.gradle.SurfCloudModules
34import dev.slne.surf.surfapi.gradle.platform.core.CoreSurfExtension
45import org.gradle.api.model.ObjectFactory
56
67abstract class AbstractPaperSurfExtension (objects : ObjectFactory ) : CoreSurfExtension(objects) {
8+ fun withCloudClientPaper () {
9+ cloudModule.set(SurfCloudModules .CLIENT_PAPER )
10+ }
711}
Original file line number Diff line number Diff line change 11package dev.slne.surf.surfapi.gradle.platform.velocity
22
3+ import dev.slne.surf.surfapi.gradle.SurfCloudModules
34import dev.slne.surf.surfapi.gradle.platform.core.CoreSurfExtension
45import org.gradle.api.Project
56import org.gradle.api.model.ObjectFactory
@@ -9,4 +10,8 @@ open class VelocitySurfExtension @Inject constructor(
910 private val project : Project ,
1011 objects : ObjectFactory ,
1112) : CoreSurfExtension(objects) {
13+
14+ fun withCloudClientVelocity () {
15+ cloudModule.set(SurfCloudModules .CLIENT_VELOCITY )
16+ }
1217}
You can’t perform that action at this time.
0 commit comments