aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 49d84f02084dd6b3c4a5404aa9ae49622452cd48 (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
plugins.apply 'fabric-loom'
plugins.apply 'io.shcm.shsupercm.fabric.fletchingtable'

version = "${property('mod.version')}+${stonecutter.current().version()}"
group = 'shcm.shsupercm.fabric.citresewn'

repositories {
    maven { url 'https://maven.terraformersmc.com/releases/' }
    maven { url 'https://maven.shedaniel.me/' }
}

dependencies {
    minecraft "com.mojang:minecraft:${stonecutter.current().version()}"
    mappings "net.fabricmc:yarn:${property('deps.yarn')}:v2"

    modImplementation "net.fabricmc:fabric-loader:${property('deps.fabric-loader')}"
    modImplementation "net.fabricmc.fabric-api:fabric-api:${property('deps.fabric-api')}"

    modImplementation "com.terraformersmc:modmenu:${property('deps.modmenu')}"
    modImplementation "me.shedaniel.cloth:cloth-config-fabric:${property('deps.cloth-config')}"

    include project(":defaults:${stonecutter.current().version()}")
}

fletchingTable {
    defaultMixinEnvironment = "auto"
}

loom {
    accessWidenerPath = file("../../src/main/resources/citresewn.accesswidener")

    runConfigs.configureEach {
        ideConfigGenerated = true
    }
}

java {
    withSourcesJar()
    sourceCompatibility = JavaVersion.VERSION_17
    targetCompatibility = JavaVersion.VERSION_17

    archivesBaseName = property('mod.jarname')
}

processResources {
    filesMatching('fabric.mod.json') {
        expand 'mod_version': version, 'mod_target_mc': project.property('mod.target-mc')
    }
}

jar {
    archiveClassifier.set 'dev'

    from rootProject.file('LICENSE')
}

if (stonecutter.current().isActiveVersion()) {
    plugins.apply 'com.modrinth.minotaur'
    plugins.apply 'com.matthewprenger.cursegradle'

    modrinth {
        token = TOKEN_MODRINTH
        projectId = property('publish.modrinth.id')
        uploadFile = remapJar
        changelog = java.nio.file.Files.readString(rootProject.file("Changelog.md").toPath())
        versionNumber = version
        versionName = "v" + version
        additionalFiles = [sourcesJar.outputs.getFiles().singleFile]
        gameVersions = Arrays.asList(property('mod.target-mc-publish').split(","))
    }

    curseforge {
        apiKey = TOKEN_CURSEFORGE
        project {
            id = property('publish.curseforge.id')
            changelogType = 'markdown'
            changelog = rootProject.file('Changelog.md')
            releaseType = 'release'
            mainArtifact(remapJar) {
                displayName = "v" + version
            }
            addGameVersion 'Fabric'
            for (String version : property('mod.target-mc-publish').split(","))
                addGameVersion version
        }
        options {
            forgeGradleIntegration = false
        }
    }

    rootProject.tasks.register('publish') {
        setGroup 'project'

        Task remapJarTask = tasks.getByName 'remapJar'
        Task curseforgeTask = tasks.getByName 'curseforge'
        Task modrinthTask = tasks.getByName 'modrinth'

        dependsOn remapJarTask, curseforgeTask, modrinthTask
        curseforgeTask.mustRunAfter remapJarTask
        modrinthTask.mustRunAfter remapJarTask
    }
}