-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
124 lines (101 loc) · 3.52 KB
/
build.gradle
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import dev.nanite.mlp.tasks.SingleOutputJar
plugins {
id("dev.nanite.mlp") version("0.0.4")
id("java")
id "me.modmuss50.mod-publish-plugin" version "0.3.0"
id("fabric-loom") version("1.3.9") apply(false)
id("net.minecraftforge.gradle") version("6.0.+") apply(false)
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
multiLoader.root() {
minecraftVersion.set(project.property("minecraft_version"))
modID.set(project.property("mod_id"))
splitSources.set(true)
accessWidenerFile.set(project(":common").file("src/main/resources/${mod_id}.accesswidener"))
dataGen {
useFabric.set(project(":common").file("src/generated/resources"))
}
}
allprojects {
def isSnapshot = providers.environmentVariable('SNAPSHOT').is("true")
version = "${mod_version}+mc${minecraft_version}${isSnapshot ? '-SNAPSHOT' : ''}"
setArchivesBaseName("${mod_name}-${project.name}".toLowerCase())
group = project.property("maven_group")
}
subprojects {
apply plugin: 'dev.nanite.mlp'
apply plugin: 'maven-publish'
afterEvaluate {
sourceSets.main.resources.srcDir(project.file('src/generated/resources'))
}
base {
archivesName = "${mod_name}-${project.name}".toLowerCase()
}
tasks.withType(ProcessResources).configureEach {
outputs.upToDateWhen { false }
}
repositories {
mavenLocal()
maven {
name = "Creeperhost"
url = uri("https://maven.creeperhost.net/")
}
maven {
name = "nanite"
url = uri("https://maven.nanite.dev/releases")
}
}
publishing {
repositories {
if (providers.environmentVariable("NANITE_TOKEN").isPresent()) {
maven {
def isSnapshot = providers.environmentVariable('SNAPSHOT').is("true")
url "https://maven.nanite.dev/${isSnapshot ? 'snapshots' : 'releases'}"
credentials {
username = "nanite"
password = providers.environmentVariable("NANITE_TOKEN").get()
}
}
}
}
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.getArchivesBaseName()
}
}
}
}
publishMods {
dryRun = providers.environmentVariable("CURSE_TOKEN").getOrNull() == null
changelog = file("./CHANGELOG.md").text
version = "${mod_version}"
type = STABLE
def fabricOptions = publishOptions {
file = project.provider { project(":fabric").tasks.remapJar }.flatMap { it.archiveFile }
displayName = "${project.name} Fabric ${mod_version}+mc${minecraft_version}"
modLoaders.add("fabric")
}
def forgeOptions = publishOptions {
file = project.provider { project(":forge").tasks.jar }.flatMap { it.archiveFile }
displayName = "${project.name} Forge ${mod_version}+mc${minecraft_version}"
modLoaders.add("forge")
}
def curseForgeOptions = curseforgeOptions {
accessToken = providers.environmentVariable("CURSE_TOKEN")
projectId = "${curse_id}"
minecraftVersions.add("${minecraft_version}")
requires {
slug = "trenzalore"
}
}
curseforge("curseforgeFabric") {
from(curseForgeOptions, fabricOptions)
requires {
slug = "fabric-api"
}
}
curseforge("curseforgeForge") {
from(curseForgeOptions, forgeOptions)
}
}