aboutsummaryrefslogtreecommitdiff
path: root/lwjgl/build.gradle.kts
blob: 9f347bd1448704d737a2929cc0d22dd3f3d1e1d7 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
plugins {
    kotlin("jvm")
    id("gg.essential.defaults.repo")
    id("gg.essential.defaults.java")
    id("com.github.johnrengelman.shadow")
    id("maven-publish")
    id("signing")
    java
}

val mod_name: String by project
val mod_version: String by project
val mod_id: String by project

version = mod_version

repositories {
    maven("https://repo.polyfrost.cc/releases")
}
val shadeCompileOnly: Configuration by configurations.creating
val shadeRuntimeOnly: Configuration by configurations.creating

sourceSets {
    main {
        runtimeClasspath += shadeRuntimeOnly
    }
}

dependencies {
    shadeCompileOnly("org.lwjgl:lwjgl:3.3.1")
    shadeCompileOnly("org.lwjgl:lwjgl-stb:3.3.1")
    shadeCompileOnly("org.lwjgl:lwjgl-tinyfd:3.3.1")
    shadeCompileOnly("org.lwjgl:lwjgl-nanovg:3.3.1")

    shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-windows")
    shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-windows")
    shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-windows")
    shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-windows")
    shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-linux")
    shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-linux")
    shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-linux")
    shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-linux")
    shadeRuntimeOnly("org.lwjgl:lwjgl:3.3.1:natives-macos")
    shadeRuntimeOnly("org.lwjgl:lwjgl-stb:3.3.1:natives-macos")
    shadeRuntimeOnly("org.lwjgl:lwjgl-tinyfd:3.3.1:natives-macos")
    shadeRuntimeOnly("org.lwjgl:lwjgl-nanovg:3.3.1:natives-macos")
}

tasks {
    named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
        archiveClassifier.set("")
        configurations = listOf(shadeCompileOnly, shadeRuntimeOnly)
        exclude("META-INF/versions/**")
        exclude("**/module-info.class")
        exclude("**/package-info.class")
        relocate("org.lwjgl", "org.lwjgl3") {
            include("org.lwjgl.PointerBuffer")
            include("org.lwjgl.BufferUtils")
        }
        duplicatesStrategy = DuplicatesStrategy.EXCLUDE
        dependsOn(jar)
    }
    jar {
        enabled = false
    }
}

publishing {
    publications {
        register<MavenPublication>("lwjgl") {
            groupId = "cc.polyfrost"
            artifactId = "lwjgl"
            artifact(tasks["shadowJar"])
        }
    }

    repositories {
        maven {
            name = "releases"
            url = uri("https://repo.polyfrost.cc/releases")
            credentials(PasswordCredentials::class)
            authentication {
                create<BasicAuthentication>("basic")
            }
        }
        maven {
            name = "snapshots"
            url = uri("https://repo.polyfrost.cc/snapshots")
            credentials(PasswordCredentials::class)
            authentication {
                create<BasicAuthentication>("basic")
            }
        }
        maven {
            name = "private"
            url = uri("https://repo.polyfrost.cc/private")
            credentials(PasswordCredentials::class)
            authentication {
                create<BasicAuthentication>("basic")
            }
        }
    }
}