aboutsummaryrefslogtreecommitdiff
path: root/root.gradle.kts
blob: f799ed79d6a198564f7036f8c211da90e95af22c (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
import at.skyhanni.sharedvariables.ProjectTarget
import com.replaymod.gradle.preprocess.Node

plugins {
    id("dev.deftu.gradle.preprocess") version "0.6.1"
    id("gg.essential.loom") version "1.6.+" apply false
    kotlin("jvm") version "2.0.0" apply false
    kotlin("plugin.power-assert") version "2.0.0" apply false
    id("com.google.devtools.ksp") version "2.0.0-1.0.24" apply false
    id("dev.architectury.architectury-pack200") version "0.1.3"
}

allprojects {
    group = "at.hannibal2.skyhanni"
    version = "0.27.Beta.9"
}

preprocess {
    val nodes = mutableMapOf<ProjectTarget, Node>()
    ProjectTarget.activeVersions().forEach { target ->
        nodes[target] = createNode(target.projectName, target.minecraftVersion.versionNumber, target.mappingStyle.identifier)
        val p = project(target.projectPath)
        if (target.isForge)
            p.extra.set("loom.platform", "forge")
    }
    ProjectTarget.activeVersions().forEach { child ->
        val parent = child.linkTo ?: return@forEach
        val pNode = nodes[parent]
        if (pNode == null) {
            println("Parent target to ${child.projectName} not available in this multi version stage. Not setting parent.")
            return@forEach
        }
        val mappingFile = file("versions/mapping-${parent.projectName}-${child.projectName}.txt")
        if (mappingFile.exists()) {
            pNode.link(nodes[child]!!, mappingFile)
            println("Loading mappings from $mappingFile")
        } else {
            pNode.link(nodes[child]!!)
            println("Skipped loading mappings from $mappingFile")
        }
    }
}