summaryrefslogtreecommitdiff
path: root/platform-paper/build.gradle.kts
blob: bea62b605553e34013029554c62c4add74bdbf97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
plugins {
    kotlin("jvm")
    kotlin("plugin.serialization")
    id("com.gradleup.shadow")
    id("xyz.jpenilla.run-paper")
    id("org.jetbrains.dokka")
}

version = findProperty("paperVersion")?.toString() ?: "0.0.0"

repositories {
    maven("https://repo.papermc.io/repository/maven-public/") {
        name = "papermc-repo"
    }
}

dependencies {
    // Engine module (provides serialization, coroutines, ktor)
    api(project(":engine"))

    // Paper-specific dependencies
    compileOnly("io.papermc.paper:paper-api:26.1.2.build.64-stable")
    implementation("com.charleskorn.kaml:kaml:0.104.0") // YAML configuration
    implementation("org.jetbrains.kotlin:kotlin-reflect:2.3.21") // Annotation processing

    // Test dependencies
    testImplementation("io.papermc.paper:paper-api:26.1.2.build.64-stable")
    testImplementation("io.mockk:mockk:1.14.9")
    testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.11.0")
}

tasks {
    shadowJar {
        archiveClassifier.set("")
        archiveBaseName.set("LunaticChat")
    }

    jar {
        enabled = false
    }

    runServer {
        minecraftVersion("26.1.1")
    }

    processResources {
        val gitCommitHash =
            providers
                .exec {
                    commandLine("git", "rev-parse", "--short", "HEAD")
                }.standardOutput
                .asText
                .get()
                .trim()

        val isNightly = providers.gradleProperty("isNightly").orNull?.toBoolean() ?: false
        val props =
            mapOf(
                "version" to project.version,
                "gitCommitHash" to gitCommitHash,
                "channel" to if (isNightly) "nightly" else "stable",
            )
        inputs.properties(props)
        filteringCharset = "UTF-8"
        filesMatching("paper-plugin.yml") {
            expand(props)
        }
        filesMatching("build-info.properties") {
            expand(props)
        }
    }

    build {
        dependsOn(shadowJar)
    }
}