Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions surf-api-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ plugins {
group = groupId
version = buildString {
append(mcVersion)
append("-1.8.2")
append("-1.9.0")
if (snapshot) append("-SNAPSHOT")
}

Expand Down Expand Up @@ -163,4 +163,4 @@ idea {
java {
withJavadocJar()
withSourcesJar()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package dev.slne.surf.surfapi.gradle

internal enum class SurfCoreModules(val module: String) {
COMMON("surf-core-api-common"),
PAPER("surf-core-api-paper"),
VELOCITY("surf-core-api-velocity"),
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ class VelocityPluginFile(project: Project) : CommonPluginFile() {
optional = false
}
}

if (extension.coreModule.isPresent) {
register("surf-core-velocity") {
optional = false
}
}
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
package dev.slne.surf.surfapi.gradle.platform.common

import dev.slne.surf.surfapi.gradle.SurfCloudModules
import dev.slne.surf.surfapi.gradle.SurfCoreModules
import org.gradle.api.model.ObjectFactory
import org.gradle.kotlin.dsl.property
import org.jetbrains.annotations.MustBeInvokedByOverriders

abstract class CommonSurfExtension(protected val objects: ObjectFactory) {
internal val addSurfApiToClasspath = objects.property<Boolean>().convention(true)
internal val surfApiScope = objects.property<String>()
internal val publishingUrl = objects.property<String>().convention("https://repo.slne.dev/repository/maven-releases")
internal val publishingUrl =
objects.property<String>().convention("https://repo.slne.dev/repository/maven-releases")
internal val publishingRepoName = objects.property<String>().convention("maven-releases")
internal val cloudModule = objects.property<SurfCloudModules>()
internal val coreModule = objects.property<SurfCoreModules>()
internal val dependOnCloud = objects.property<Boolean>().convention(true)
internal val migrationMainClass = objects.property<String>()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,15 @@ abstract class CommonSurfPlugin<E : CommonSurfExtension>(
}
}

extension.coreModule.orNull?.let {
dependencies {
add(
COMPILE_ONLY,
"dev.slne.surf.core:${it.module}:${Constants.SURF_API_VERSION}"
)
}
}

afterEvaluated0(extension)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package dev.slne.surf.surfapi.gradle.platform.core

import dev.slne.surf.surfapi.gradle.SurfCloudModules
import dev.slne.surf.surfapi.gradle.SurfCoreModules
import dev.slne.surf.surfapi.gradle.platform.common.CommonSurfExtension
import org.gradle.api.model.ObjectFactory
import org.gradle.kotlin.dsl.listProperty
Expand Down Expand Up @@ -49,6 +50,18 @@ open class CoreSurfExtension @Inject constructor(objects: ObjectFactory) :
cloudModule.set(SurfCloudModules.SERVER)
}

fun withCoreCommon() {
coreModule.set(SurfCoreModules.COMMON)
}

fun withCorePaper() {
coreModule.set(SurfCoreModules.PAPER)
}

fun withCoreVelocity() {
coreModule.set(SurfCoreModules.VELOCITY)
}

fun migrationMainClass(value: String) {
migrationMainClass.set(value)
migrationMainClass.finalizeValue()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ internal class PaperPluginSurfPlugin :
if (extension.cloudModule.isPresent && extension.dependOnCloud.get()) {
registerRequired("surf-cloud-bukkit")
}
if (extension.coreModule.isPresent) {
registerRequired("surf-core-paper")
}

extension.serverDependencies.orNull?.execute(this)
}
}
Expand Down
Loading