-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
209 lines (180 loc) · 5.83 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
209
import java.nio.charset.StandardCharsets
import java.time.Year
plugins {
id "fabric-loom" version "0.2.0-SNAPSHOT"
id "net.minecrell.licenser" version "0.2.1"
id "com.matthewprenger.cursegradle" version "1.1.2"
id "maven-publish"
}
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
group = "com.github.GlassPane"
archivesBaseName = "Cardinal"
version = "${mod_version}"
minecraft {
}
processResources {
// this will ensure that this task is redone when there"s a change
inputs.property "version", project.version
// replace stuff in fabric.mod.json, nothing else
from(sourceSets.main.resources.srcDirs) {
include "fabric.mod.json"
// add mod metadata
expand "version": project.version
}
// copy everything else, that"s not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude "fabric.mod.json"
}
}
repositories {
maven {
name = "NerdHubMC"
url = "https://maven.abusedmaster.xyz"
}
maven {
name = "CurseForge"
url = "https://minecraft.curseforge.com/api/maven"
}
maven {
name = "JitPack"
url = "https://jitpack.io"
}
}
dependencies {
minecraft "com.mojang:minecraft:${mc_version}"
mappings "net.fabricmc:yarn:${yarn_mappings}"
modCompile "net.fabricmc:fabric-loader:${loader_version}"
modCompile "net.fabricmc:fabric:${fabric_version}"
modCompile "com.github.GlassPane:Mesh:${mesh_version}"
compileOnly "com.google.code.findbugs:jsr305:${findbugs_version}"
}
compileJava {
options.encoding = StandardCharsets.UTF_8.name()
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption("Xdoclint:none", "-quiet")
}
}
}
jar {
from "LICENSE.md"
manifest.mainAttributes(
"Implementation-Title": project.archivesBaseName,
"Implementation-Version": project.version,
"Maven-Artifact": "${project.group}:${project.name}:${project.version}".toLowerCase(Locale.ROOT),
"Built-On-Minecraft": "${mc_version}",
"Built-On-Java": "${System.getProperty("java.vm.version")} (${System.getProperty("java.vm.vendor")})"
)
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
classifier = "sources"
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
from "LICENSE.md"
classifier = "javadoc"
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact javadocJar
artifact sourcesJar
pom {
name = "Mesh"
url = "https://github.com/GlassPane/Cardinal"
licenses {
license {
name = "GNU Lesser General Public License"
url = "https://github.com/GlassPane/Cardinal/blob/master/LICENSE.md"
}
}
scm {
url = "https://github.com/GlassPane/Cardinal"
connection = "scm:git:git://github.com/GlassPane/Cardinal.git"
developerConnection = "scm:git:[email protected]:GlassPane/Cardinal.git"
}
issueManagement {
system = "github"
url = "https://github.com/GlassPane/Cardinal/issues"
}
}
}
}
repositories {
//mavenLocal() //uncomment this to publish to the local maven
//publish to the nerdhub maven if credentials are set
if (project.hasProperty("nerdhub_maven_user")) {
maven {
name = "NerdHub"
url = findProperty("nerdhub_maven_url")
credentials {
username = findProperty("nerdhub_maven_user")
password = findProperty("nerdhub_maven_pass")
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}
curseforge {
if (project.hasProperty("curse_key")) {
apiKey = findProperty("curse_key")
}
if (project.hasProperty("curseforge_id")) {
project {
id = findProperty("curseforge_id")
mainArtifact(jar) {
displayName = "${project.archivesBaseName} MC${mc_version} v${mod_version}"
}
releaseType = project.release_type
//TODO remove when MC 1.14 releases
//usually automatically determined by the CurseGradle plugin
addGameVersion '1.14-Snapshot'
//changelogType = "markdown"
//changelog = change_log //TODO generate changelog
//relations {
//
//}
addArtifact javadocJar
addArtifact sourcesJar
}
options {
forgeGradleIntegration = false
}
}
}
license {
header = file("code_quality/${license_header}_HEADER.txt")
// Apply licenses only to main source set
sourceSets = [project.sourceSets.main]
include "**/*.java"
charset = StandardCharsets.UTF_8.name()
style {
java = "BLOCK_COMMENT"
}
newLine = false // Disables the empty line between the header and package name
ignoreFailures = true //Ignore failures and only print a warning on license violations
//export variables
ext {
year = Year.now()
projectDisplayName = project.archivesBaseName
}
}
tasks.publish.dependsOn build
afterEvaluate {
//make curseforge task depend on build
if (project.hasProperty("curseforge_id")) {
tasks.each {
if (it.name == "curseforge" + findProperty(curseforge_id)) {
it.dependsOn build
it.mustRunAfter build
}
}
}
}