forked from Glitchfiend/BiomesOPlenty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
208 lines (183 loc) · 5.84 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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "1000"
}
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
}
apply plugin: 'maven-publish'
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'org.spongepowered.mixin'
repositories { mavenLocal() }
group = "com.github.glitchfiend"
archivesBaseName = "${mod_name}"
version = "${minecraft_version}-${mod_version}.${System.getenv().BUILD_NUMBER}"
def mod_build_version = "${mod_version}.${System.getenv().BUILD_NUMBER}"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'official', version: minecraft_version
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client = {
workingDirectory = project.file("run")
source sourceSets.main
}
server = {
workingDirectory = project.file("run")
source sourceSets.main
}
data {
workingDirectory = project.file("run")
source sourceSets.main
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/'), '--existing', file('src/generated/resources/')
}
}
}
// Configure the source folders
sourceSets {
main {
java {
srcDir "src/main/java"
}
resources {
srcDir "src/main/resources"
srcDir 'src/generated/resources'
}
}
}
processResources {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
dependencies {
minecraft 'net.minecraftforge:forge:' + minecraft_version + '-' + forge_version
implementation fg.deobf("com.github.glitchfiend:TerraBlender-forge:${terrablender_version}")
}
jar {
manifest {
attributes([
'Specification-Title' : mod_name,
'Specification-Vendor' : mod_author,
'Specification-Version' : mod_build_version,
'Implementation-Title' : project.name,
'Implementation-Version' : mod_build_version,
'Implementation-Vendor' : mod_author,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Timestampe' : System.currentTimeMillis(),
'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})",
'Build-On-Minecraft' : minecraft_version
])
}
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
task apiJar(type: Jar) {
from(sourceSets.main.allJava) {
include "${mod_id}/api/**"
}
from (sourceSets.main.output) {
include 'LICENSE.txt'
include "${mod_id}/api/**"
}
// TODO: Investigate why there are duplicates produced in the first place
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
classifier = 'api'
}
def changelog_file = rootProject.file("build/${mod_name}-${version}-changelog.txt")
curseforge {
if (project.hasProperty('curseApiKey')) {
apiKey = project.getProperty('curseApiKey')
}
project {
id = mod_curseforge_id
if (changelog_file.exists()) {
changelog = changelog_file
}
releaseType = 'beta'
addGameVersion minecraft_version
mainArtifact(jar) {
displayName = "${mod_display_name} ${version}"
}
addArtifact deobfJar
addArtifact apiJar
relations {
requiredDependency 'terrablender'
}
}
}
artifacts {
if (changelog_file.exists()) {
archives changelog_file
}
archives jar
archives deobfJar
archives apiJar
}
publishing {
publications {
mavenJava(MavenPublication) {
// We must use artifact jar to ensure the Forge dependency is excluded from the pom, breaking fg.deobf()
artifact jar
artifact deobfJar
artifact apiJar
groupId project.group
artifactId project.archivesBaseName
version project.version
pom {
name = project.mod_name
description = project.mod_description
url = project.mod_git_url
scm {
url = project.mod_git_url
connection = project.mod_scm_url
developerConnection = project.mod_scm_url
}
issueManagement {
system = 'github'
url = project.mod_issues_url
}
licenses {
license {
name = 'All Rights Reserved'
}
}
developers {
developer {
id = 'adubbz'
name = 'Adubbz'
}
developer {
id = 'forstride'
name = 'Forstride'
}
}
}
}
}
repositories {
maven {
url "https://maven.minecraftforge.net/releases/"
authentication {
basic(BasicAuthentication)
}
credentials {
username = System.env.MAVEN_USER ?:'fake'
password = System.env.MAVEN_PASSWORD ?:'news'
}
}
}
}