summaryrefslogtreecommitdiff
path: root/archenemyexample/build.gradle.kts
blob: 946264ebc578f2c66fbbb5aefdc2ee587316b83a (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
import moe.nea.archenemy.MCSide

plugins {
    kotlin("multiplatform") version "1.9.10"
    id("moe.nea.archenemy.mojang")
}

repositories {
    mavenCentral()
    maven("https://maven.fabricmc.net")
}
val minecraft = mojang.minecraft("1.20.2", MCSide.CLIENT) as ModuleDependency
val officialMappings = mojang.officialMappings(
    "1.20.2", MCSide.CLIENT
)
val yarnMappings = mojang.yarnMappings(dependencies.create("net.fabricmc:yarn:1.20.2+build.4:v2"))
val intermediaryMappings = mojang.yarnMappings(dependencies.create("net.fabricmc:intermediary:1.20.2:v2"))

val whateverAttribute = Attribute.of("whatever", String::class.java)
kotlin {
    val allJvm by sourceSets.creating {
        this.dependencies {
        }
    }

    jvm("forge") {
        attributes.attribute(whateverAttribute, "forge")
        compilations.named("main").get().run {
            defaultSourceSet.dependsOn(allJvm)
            this.dependencies {
                implementation(
                    mojang.mapJar(
                        minecraft,
                        officialMappings,
                        "official",
                        "named"
                    )
                )
            }
        }
    }
    jvm("fabric") {
        attributes.attribute(whateverAttribute, "fabric")
        compilations.named("main").get().run {
            defaultSourceSet.dependsOn(allJvm)
            this.dependencies {
                val thingy = mojang.mapJar(
                    minecraft,
                    intermediaryMappings,
                    "official",
                    "intermediary"
                )
                implementation(
                    mojang.mapJar(
                        thingy as ModuleDependency,
                        yarnMappings,
                        "intermediary",
                        "named"
                    )
                )
            }
        }
    }
}