-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbuild.gradle
163 lines (140 loc) · 5.47 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/*
* MoreMcmeta is a Minecraft mod expanding texture configuration capabilities.
* Copyright (C) 2023 soir20
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation version 3 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import org.gradle.internal.os.OperatingSystem
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
}
architectury {
minecraft = project.minecraftVersion
}
subprojects {
apply plugin: "dev.architectury.loom"
loom {
silentMojangMappingsLicense()
}
task signJar() {
doLast {
if (project.hasProperty("keyStore")) {
ant.signjar(
jar: remapJar.getArchiveFile().get().getAsFile().path,
keystore: project.keyStore,
alias: project.keyStoreAlias,
storepass: project.keyStorePass,
keypass: project.keyStoreKeyPass
)
}
}
}
build.dependsOn(signJar)
def lwjglNatives
switch (OperatingSystem.current()) {
case OperatingSystem.LINUX:
lwjglNatives = "natives-linux"
break
case OperatingSystem.MAC_OS:
lwjglNatives = "natives-macos"
break
case OperatingSystem.WINDOWS:
lwjglNatives = "natives-windows"
break
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraftVersion}"
mappings loom.officialMojangMappings()
// Include plugins by default
def final INCLUDE_DEFAULT_PLUGINS = (System.getenv("INCLUDE_DEFAULT_PLUGINS") ?: "true").toBoolean()
if (INCLUDE_DEFAULT_PLUGINS && project.name != "common") {
modRuntimeOnly(include("io.github.moremcmeta:json-parser-plugin-${project.name}:${project.jsonReaderVersion}"))
modRuntimeOnly(include("io.github.moremcmeta:properties-parser-plugin-${project.name}:${project.propertiesReaderVersion}"))
modRuntimeOnly(include("io.github.moremcmeta:animation-plugin-${project.name}:${project.animationVersion}"))
modRuntimeOnly(include("io.github.moremcmeta:texture-plugin-${project.name}:${project.textureVersion}"))
modRuntimeOnly(include("io.github.moremcmeta:gui-plugin-${project.name}:${project.guiVersion}"))
}
modCompileOnly "maven.modrinth:sodium:${project.sodium_version}"
modCompileOnly "maven.modrinth:embeddium:${project.embeddium_version}"
testImplementation "junit:junit:${project.junitVersion}"
testImplementation "org.lwjgl:lwjgl:${rootProject.lwjglVersion}"
testRuntimeOnly "org.lwjgl:lwjgl:${rootProject.lwjglVersion}:${lwjglNatives}"
}
processResources {
filesMatching("**/*.mixins.json") {
expand "javaVersion": project.javaVersion
}
}
}
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
def final SNAPSHOT_SUFFIX = "-prerelease"
project.ext.modVersion = System.getenv("MOD_VERSION") ?: "DEV"
project.ext.isSnapshot = project.modVersion.endsWith(SNAPSHOT_SUFFIX)
// Include Minecraft version for snapshots since Forge requires the version to start with a number
version = "${project.minecraftVersion}-${project.modVersion}"
group = project.mavenGroup
archivesBaseName = project.modArchivesBaseName
project.ext.mavenArtifactId = "${archivesBaseName}-${project.name}"
project.ext.mavenVersion = isSnapshot
? "${version.substring(0, version.length() - SNAPSHOT_SUFFIX.length())}-SNAPSHOT"
: version
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = project.javaVersion.toInteger()
}
java {
withSourcesJar()
}
repositories {
maven {
url "https://maven.pkg.github.com/moremcmeta/*/"
credentials {
username System.getenv("MOREMCMETA_MAVEN_USER") ?: project.moremcmetaMavenUser
password System.getenv("MOREMCMETA_MAVEN_PASS") ?: project.moremcmetaMavenPass
}
}
exclusiveContent {
forRepository {
maven {
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
}
publishing {
publications {
maven(MavenPublication) {
artifactId = project.mavenArtifactId
version = project.mavenVersion
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/MoreMcmeta/core"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}